Files
@ 449e6423959c
Branch filter:
Location: majic-ansible-roles/roles/preseed/molecule/default/tests/test_parameters_mandatory.py - annotation
449e6423959c
2.2 KiB
text/x-python
MAR-151: Added support for Debian 10 Buster to xmpp_server role:
- Updated role reference documentaiton.
- Updated role meta information.
- Updated tests.
- Enable lower-level TLS protocols (1.0/1.1) in global OpenSSL
configuration file on Buster in order to be able to test the
xmpp_server_tls_protocol parameter (otherwise Prosody completely
refuses to use them even if listed in its configuration).
- Move stretch-specific tests into its own file (for backported
lua-ldap library), and run them on Debian 9 Stretch machines only.
- Updated role reference documentaiton.
- Updated role meta information.
- Updated tests.
- Enable lower-level TLS protocols (1.0/1.1) in global OpenSSL
configuration file on Buster in order to be able to test the
xmpp_server_tls_protocol parameter (otherwise Prosody completely
refuses to use them even if listed in its configuration).
- Move stretch-specific tests into its own file (for backported
lua-ldap library), and run them on Debian 9 Stretch machines only.
da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 d62b3adec462 da27c590e954 da27c590e954 4ee589937d60 da27c590e954 da27c590e954 da27c590e954 da27c590e954 4ee589937d60 da27c590e954 d44e023cf7bb da27c590e954 da27c590e954 4ee589937d60 da27c590e954 4ee589937d60 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 4ee589937d60 da27c590e954 da27c590e954 da27c590e954 da27c590e954 df804f3e9b89 4ee589937d60 4ee589937d60 d44e023cf7bb b7ca7da98606 d20f150f3cca bb8003ddf790 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 | import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('parameters-mandatory')
def test_preseed_configuration_files(host):
"""
Tests presence and permissions on created preseed configuration files.
"""
with host.sudo():
preseed_directory_path = "/tmp/preseed_files"
# Verify that preseed configuration files are created for all hosts.
for testinfra_host in testinfra_hosts:
preseed_file = host.file(os.path.join(preseed_directory_path, "%s.cfg" % testinfra_host))
assert preseed_file.is_file
assert preseed_file.mode == 0o640
def test_preseed_configuration_file_content(host):
"""
Tests content of generated preseed configuration file.
"""
hostname = host.run('hostname').stdout.strip()
with host.sudo():
preseed_directory_path = "/tmp/preseed_files"
preseed_file = host.file(os.path.join(preseed_directory_path, "%s.cfg" % hostname))
preseed_file_content = preseed_file.content_string
ssh_public_key = "MY_ANSIBLE_KEY"
assert "d-i debian-installer/language string en" in preseed_file_content
assert "d-i debian-installer/country string SE" in preseed_file_content
assert "d-i debian-installer/locale string en_US.UTF-8" in preseed_file_content
assert "d-i keyboard-configuration/xkb-keymap select us" in preseed_file_content
assert "d-i netcfg/choose_interface select eth0" in preseed_file_content
assert """# DHCP network configuration.
d-i netcfg/disable_autoconfig boolean false
d-i netcfg/get_hostname string ignored-value
d-i netcfg/get_domain string ignored-value""" in preseed_file_content
assert "d-i mirror/http/hostname string ftp.se.debian.org" in preseed_file_content
assert "d-i mirror/http/directory string /debian" in preseed_file_content
assert "d-i mirror/http/proxy string " in preseed_file_content
assert "d-i passwd/root-password password root" in preseed_file_content
assert "d-i passwd/root-password-again password root" in preseed_file_content
assert "d-i time/zone string Europe/Stockholm" in preseed_file_content
assert ssh_public_key in preseed_file_content
|