This commit is contained in:
parent
616d2f61e6
commit
546b23ec5f
@ -1,6 +1,7 @@
|
||||
import time
|
||||
import testinfra.utils.ansible_runner
|
||||
|
||||
|
||||
def test_packages(host):
|
||||
packages = [
|
||||
'bareos-bconsole',
|
||||
@ -16,6 +17,7 @@ def test_packages(host):
|
||||
package = host.package(package_name)
|
||||
assert package.is_installed
|
||||
|
||||
|
||||
def test_client_config_file(host):
|
||||
config = host.file('/etc/bareos/bareos-fd.d/director/bareos-dir.conf')
|
||||
assert config.exists
|
||||
@ -25,6 +27,7 @@ def test_client_config_file(host):
|
||||
assert config.mode == 0o640
|
||||
assert config.contains('Name = bareos')
|
||||
|
||||
|
||||
def test_server_catalog_config_file(host):
|
||||
config = host.file('/etc/bareos/bareos-dir.d/catalog/ansible.conf')
|
||||
assert config.exists
|
||||
@ -34,6 +37,7 @@ def test_server_catalog_config_file(host):
|
||||
assert config.mode == 0o640
|
||||
assert config.contains('dbdriver = "sqlite3"')
|
||||
|
||||
|
||||
def test_server_clients_config_file(host):
|
||||
config = host.file('/etc/bareos/bareos-dir.d/client/ansible.conf')
|
||||
assert config.exists
|
||||
@ -43,6 +47,7 @@ def test_server_clients_config_file(host):
|
||||
assert config.mode == 0o640
|
||||
assert config.contains('Address = "localhost"')
|
||||
|
||||
|
||||
def test_server_fileset_config_file(host):
|
||||
config = host.file('/etc/bareos/bareos-dir.d/fileset/ansible.conf')
|
||||
assert config.exists
|
||||
@ -52,6 +57,7 @@ def test_server_fileset_config_file(host):
|
||||
assert config.mode == 0o640
|
||||
assert config.contains('File = "/etc"')
|
||||
|
||||
|
||||
def test_server_job_config_file(host):
|
||||
config = host.file('/etc/bareos/bareos-dir.d/job/ansible.conf')
|
||||
assert config.exists
|
||||
@ -65,6 +71,7 @@ def test_server_job_config_file(host):
|
||||
assert config.contains('FileSet = config_in_etc')
|
||||
assert config.contains('Maximum Bandwidth = 5Mb/s')
|
||||
|
||||
|
||||
def test_server_pool_config_file(host):
|
||||
config = host.file('/etc/bareos/bareos-dir.d/pool/ansible.conf')
|
||||
assert config.exists
|
||||
@ -74,6 +81,7 @@ def test_server_pool_config_file(host):
|
||||
assert config.mode == 0o640
|
||||
assert config.contains('VolumeRetention = 14')
|
||||
|
||||
|
||||
def test_server_schedule_config_file(host):
|
||||
config = host.file('/etc/bareos/bareos-dir.d/schedule/ansible.conf')
|
||||
assert config.exists
|
||||
@ -83,6 +91,7 @@ def test_server_schedule_config_file(host):
|
||||
assert config.mode == 0o640
|
||||
assert config.contains('Run = Level=Full weekly at 0:05')
|
||||
|
||||
|
||||
def test_server_console_config_file(host):
|
||||
config = host.file('/etc/bareos/bareos-dir.d/console/ansible.conf')
|
||||
assert config.exists
|
||||
@ -92,6 +101,7 @@ def test_server_console_config_file(host):
|
||||
assert config.mode == 0o640
|
||||
assert config.contains('Profile = "sysadmin"')
|
||||
|
||||
|
||||
def test_server_profile_config_file(host):
|
||||
config = host.file('/etc/bareos/bareos-dir.d/profile/ansible.conf')
|
||||
assert config.exists
|
||||
@ -101,6 +111,7 @@ def test_server_profile_config_file(host):
|
||||
assert config.mode == 0o640
|
||||
assert config.contains('Command ACL = "all"')
|
||||
|
||||
|
||||
def test_server_clean_old_config_file(host):
|
||||
files = [
|
||||
'catalog/MyCatalog.conf',
|
||||
@ -114,6 +125,7 @@ def test_server_clean_old_config_file(host):
|
||||
config = host.file('/etc/bareos/bareos-dir.d/%s' % file_name)
|
||||
assert not config.exists
|
||||
|
||||
|
||||
def test_storage_device_config_file(host):
|
||||
config = host.file('/etc/bareos/bareos-sd.d/device/ansible.conf')
|
||||
assert config.exists
|
||||
@ -124,17 +136,20 @@ def test_storage_device_config_file(host):
|
||||
assert config.contains('ArchiveDevice = /var/lib/bareos/storage')
|
||||
assert config.contains('AlwaysOpen = yes')
|
||||
|
||||
|
||||
def test_services(host):
|
||||
for service_name in ['bareos-fd', 'bareos-dir', 'bareos-sd']:
|
||||
service = host.service(service_name)
|
||||
assert service.is_running
|
||||
assert service.is_enabled
|
||||
|
||||
|
||||
def test_sockets(host):
|
||||
for port in [9101, 9102, 9103]:
|
||||
socket = host.socket('tcp://0.0.0.0:%s' % port)
|
||||
assert socket.is_listening
|
||||
|
||||
|
||||
def test_backup(host):
|
||||
host.run('echo "run job=localhost-full yes" | bconsole')
|
||||
time.sleep(10)
|
||||
@ -145,6 +160,7 @@ def test_backup(host):
|
||||
assert backup.group == 'bareos'
|
||||
assert backup.mode == 0o640
|
||||
|
||||
|
||||
def test_cron(host):
|
||||
path = host.file('/var/spool/cron/crontabs/root')
|
||||
assert path.exists
|
||||
|
||||
Loading…
Reference in New Issue
Block a user