Files
@ ff510f233909
Branch filter:
Location: majic-ansible-roles/roles/xmpp_server/molecule/default/tests/test_optional.py - annotation
ff510f233909
2.8 KiB
text/x-python
MAR-132: Added support for Debian 9 (Stretch) to php_website role:
- Implemented the necessary changes related to differences between PHP
versions and related paths (PHP 5 vs PHP 7).
- Set the shell for application system account explicitly (workaround
for Debian bug 865762 in Stretch).
- Updated Molecule tests to cover Debian 9.
- Updated Molecule test preparation playbook to account for a number
of differences between Jessie and Stretch (mainly related to mailing
functionality).
- Use more specific host groups in tests.
- Renamed a couple of variables in test for sending out mails to make
it clearer what is being looked up as part of regex matching.
- Updated Molecule tests where certain paths depend on what Debian
release they are ran against.
- Split-up Jessie-specific tests into separate file.
- Implemented the necessary changes related to differences between PHP
versions and related paths (PHP 5 vs PHP 7).
- Set the shell for application system account explicitly (workaround
for Debian bug 865762 in Stretch).
- Updated Molecule tests to cover Debian 9.
- Updated Molecule test preparation playbook to account for a number
of differences between Jessie and Stretch (mainly related to mailing
functionality).
- Use more specific host groups in tests.
- Renamed a couple of variables in test for sending out mails to make
it clearer what is being looked up as part of regex matching.
- Updated Molecule tests where certain paths depend on what Debian
release they are ran against.
- Split-up Jessie-specific tests into separate file.
2ada86e90026 2ada86e90026 da031f975c67 da031f975c67 da031f975c67 da031f975c67 2ada86e90026 da031f975c67 da031f975c67 e970d4afbea4 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 e970d4afbea4 da031f975c67 e970d4afbea4 e970d4afbea4 e970d4afbea4 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 e970d4afbea4 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 e970d4afbea4 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 e970d4afbea4 e970d4afbea4 e970d4afbea4 da031f975c67 da031f975c67 da031f975c67 da031f975c67 e970d4afbea4 da031f975c67 da031f975c67 e970d4afbea4 da031f975c67 da031f975c67 da031f975c67 da031f975c67 e970d4afbea4 e970d4afbea4 e970d4afbea4 da031f975c67 e970d4afbea4 da031f975c67 da031f975c67 e970d4afbea4 e970d4afbea4 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 | import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts(['parameters-optional'])
def test_prosody_tls_files(host):
"""
Tests if Prosody TLS private key and certificage have been deployed
correctly.
"""
hostname = host.run('hostname').stdout
with host.sudo():
tls_file = host.file('/etc/ssl/private/%s_xmpp.key' % hostname)
assert tls_file.is_file
assert tls_file.user == 'root'
assert tls_file.group == 'prosody'
assert tls_file.mode == 0o640
assert tls_file.content == open("tests/data/x509/parameters-optional_xmpp.key.pem", "r").read().rstrip()
tls_file = host.file('/etc/ssl/certs/%s_xmpp.pem' % hostname)
assert tls_file.is_file
assert tls_file.user == 'root'
assert tls_file.group == 'root'
assert tls_file.mode == 0o644
assert tls_file.content == open("tests/data/x509/parameters-optional_xmpp.cert.pem", "r").read().rstrip()
def test_certificate_validity_check_configuration(host):
"""
Tests if certificate validity check configuration file has been deployed
correctly.
"""
hostname = host.run('hostname').stdout
config = host.file('/etc/check_certificate/%s_xmpp.conf' % hostname)
assert config.is_file
assert config.user == 'root'
assert config.group == 'root'
assert config.mode == 0o644
assert config.content == "/etc/ssl/certs/%s_xmpp.pem" % hostname
def test_prosody_configuration_file_content(host):
"""
Tests if Prosody configuration file has correct content.
"""
hostname = host.run('hostname').stdout
with host.sudo():
config = host.file('/etc/prosody/prosody.cfg.lua')
assert "admins = { \"jane.doe@domain2\", \"mick.doe@domain3\", }" in config.content
assert "key = \"/etc/ssl/private/%s_xmpp.key\";" % hostname in config.content
assert "certificate = \"/etc/ssl/certs/%s_xmpp.pem\";" % hostname in config.content
assert "ldap_server = \"ldap-server\"" in config.content
assert "ldap_rootdn = \"cn=prosody,ou=services,dc=local\"" in config.content
assert "ldap_password = \"prosodypassword\"" in config.content
assert "ldap_filter = \"(&(mail=$user@$host)(memberOf=cn=xmpp,ou=groups,dc=local))\"" in config.content
assert "ldap_base = \"ou=people,dc=local\"" in config.content
assert """VirtualHost "domain2"
Component "conference.domain2" "muc"
restrict_room_creation = "local"
Component "proxy.domain2" "proxy65"
proxy65_acl = { "domain2" }""" in config.content
assert """VirtualHost "domain3"
Component "conference.domain3" "muc"
restrict_room_creation = "local"
Component "proxy.domain3" "proxy65"
proxy65_acl = { "domain3" }""" in config.content
|