Files
@ 14eb78a4f466
Branch filter:
Location: majic-ansible-roles/roles/xmpp_server/molecule/default/tests/test_default.py - annotation
14eb78a4f466
3.1 KiB
text/x-python
MAR-129: Updated php_website role for Ansible 2.5.x and new Molecule:
- Include global linting configuration file in tests.
- Fixed linting issues.
- Fix deprecation warnings from Ansible (for apt module and
state=installed).
- Updated how the hosts are being referenced within tests.
- Include global linting configuration file in tests.
- Fixed linting issues.
- Fix deprecation warnings from Ansible (for apt module and
state=installed).
- Updated how the hosts are being referenced within tests.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | 701044d4cbba 701044d4cbba da031f975c67 701044d4cbba e970d4afbea4 da031f975c67 da031f975c67 e970d4afbea4 da031f975c67 da031f975c67 da031f975c67 da031f975c67 e970d4afbea4 e970d4afbea4 e970d4afbea4 e970d4afbea4 da031f975c67 da031f975c67 e970d4afbea4 da031f975c67 da031f975c67 da031f975c67 da031f975c67 e970d4afbea4 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 e970d4afbea4 da031f975c67 da031f975c67 da031f975c67 da031f975c67 e970d4afbea4 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 e970d4afbea4 da031f975c67 da031f975c67 da031f975c67 da031f975c67 e970d4afbea4 da031f975c67 da031f975c67 e970d4afbea4 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 e970d4afbea4 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 e970d4afbea4 da031f975c67 da031f975c67 da031f975c67 da031f975c67 e970d4afbea4 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 e970d4afbea4 da031f975c67 da031f975c67 da031f975c67 da031f975c67 e970d4afbea4 da031f975c67 e970d4afbea4 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 e970d4afbea4 da031f975c67 da031f975c67 da031f975c67 da031f975c67 e970d4afbea4 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 e970d4afbea4 da031f975c67 da031f975c67 da031f975c67 da031f975c67 e970d4afbea4 701044d4cbba e970d4afbea4 701044d4cbba da031f975c67 da031f975c67 da031f975c67 da031f975c67 701044d4cbba da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 | import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
'.molecule/ansible_inventory.yml').get_hosts(['parameters-mandatory', 'parameters-optional'])
def test_installed_packages(host):
"""
Tests if all the necessary packages have been installed.
"""
assert host.package('python-apt').is_installed
assert host.package('lua-sec').is_installed
assert host.package('lua-ldap').is_installed
assert host.package('prosody').is_installed
def test_prosody_apt_key(host):
"""
Tests if Prosody repository signing key has been imported.
"""
keys = host.run("apt-key list")
assert "1024D/74D9DBB5" in keys.stdout
assert "4096g/6C8F28BA" in keys.stdout
def test_prosody_repository(host):
"""
Tests if Prosody repository has been added.
"""
repository = host.file("/etc/apt/sources.list.d/packages_prosody_im_debian.list")
assert repository.is_file
assert repository.user == 'root'
assert repository.group == 'root'
assert repository.mode == 0o644
assert repository.content == "deb http://packages.prosody.im/debian jessie main"
def test_prosody_user(host):
"""
Tests if Prosody user has been set-up correctly to access TLS material.
"""
assert 'ssl-cert' in host.user('prosody').groups
def test_prosody_modules_directory(host):
"""
Tests if directory for storing additional Prosody modules is set-up
correctly.
"""
directory = host.file('/usr/local/lib/prosody/modules')
assert directory.is_directory
assert directory.user == 'root'
assert directory.group == 'root'
assert directory.mode == 0o755
def test_prosody_mod_auth_ldap(host):
"""
Tests if Prosody module mod_auth_ldap has been deployed correctly.
"""
module = host.file('/usr/local/lib/prosody/modules/mod_auth_ldap.lua')
assert module.is_file
assert module.user == 'root'
assert module.group == 'root'
assert module.mode == 0o644
assert 'module:provides("auth", provider);' in module.content
assert 'mod_auth_ldap' in module.content
def test_prosody_configuration_file(host):
"""
Tests if Prosody configuration file has correct permissions.
"""
with host.sudo():
config = host.file('/etc/prosody/prosody.cfg.lua')
assert config.is_file
assert config.user == 'root'
assert config.group == 'prosody'
assert config.mode == 0o640
def test_services(host):
"""
Tests if services are enabled and running.
"""
service = host.service('prosody')
assert service.is_enabled
assert service.is_running
def test_firewall_configuration_file(host):
"""
Tests if firewall configuration file has been deployed correctly.
"""
with host.sudo():
config = host.file('/etc/ferm/conf.d/30-xmpp.conf')
assert config.is_file
assert config.user == 'root'
assert config.group == 'root'
assert config.mode == 0o640
# @TODO: Tests which were not implemented due to lack of out-of-box tools:
#
# - Proxy capability.
# - MUC.
# - Server administration through XMPP.
|