Files
@ eba5d5d69e4f
Branch filter:
Location: majic-ansible-roles/roles/preseed/tests/test_parameters_mandatory.py - annotation
eba5d5d69e4f
2.7 KiB
text/x-python
MAR-114: Moved set_fact for wsgi_website and php_website roles:
- Moved set_fact for setting application admin, user, and home directory into
defaults/main.yml.
- Updated test playbook for wsgi_website to fixate the ptpython and dnspython
versions (including their dependencies).
- Updated tests for wsgi_website to use new fixated versions for ptpython,
dnspython, and their dependencies.
- Moved set_fact for setting application admin, user, and home directory into
defaults/main.yml.
- Updated test playbook for wsgi_website to fixate the ptpython and dnspython
versions (including their dependencies).
- Updated tests for wsgi_website to use new fixated versions for ptpython,
dnspython, and their dependencies.
da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 0f349663e20c da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 0f349663e20c da27c590e954 da27c590e954 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(
'.molecule/ansible_inventory').get_hosts('parameters-mandatory')
def test_preseed_directory(File, Sudo):
"""
Tests presence and permissions on created preseed directory.
"""
with Sudo():
# Preseed directory created at same level as inventory.
preseed_directory = File(os.path.join(os.getcwd(), ".molecule", 'preseed_files'))
assert preseed_directory.is_directory
assert preseed_directory.mode == 0o750
def test_preseed_configuration_files(File, Sudo):
"""
Tests presence and permissions on created preseed configuration files.
"""
with Sudo():
# Preseed directory created at same level as inventory.
preseed_directory_path = os.path.join(os.getcwd(), ".molecule", 'preseed_files')
# Verify that preseed configuration files are created for all hosts.
for host in testinfra_hosts:
preseed_file = File(os.path.join(preseed_directory_path, "%s.cfg" % host))
assert preseed_file.is_file
assert preseed_file.mode == 0o640
def test_preseed_configuration_file_content(File, Sudo):
"""
Tests content of generated preseed configuration file.
"""
with Sudo():
preseed_file = File(os.path.join(os.getcwd(), ".molecule", "preseed_files", "parameters-mandatory.cfg"))
preseed_file_content = preseed_file.content_string
ssh_public_key = open(os.path.join(os.path.expanduser("~"), ".ssh", "id_rsa.pub")).read().strip()
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
|