diff --git a/molecule/libvirt-staging-focal/molecule.yml b/molecule/libvirt-staging-focal/molecule.yml index e7f0844461..f9c012cf01 100644 --- a/molecule/libvirt-staging-focal/molecule.yml +++ b/molecule/libvirt-staging-focal/molecule.yml @@ -67,7 +67,7 @@ verifier: name: testinfra lint: name: flake8 - directory: ../testinfra/staging/ + directory: ../testinfra/ options: n: auto v: 2 diff --git a/molecule/testinfra/app-code/test_securedrop_app_code.py b/molecule/testinfra/app-code/test_securedrop_app_code.py index 8f33bed286..a6b0656d6d 100644 --- a/molecule/testinfra/app-code/test_securedrop_app_code.py +++ b/molecule/testinfra/app-code/test_securedrop_app_code.py @@ -3,6 +3,7 @@ securedrop_test_vars = pytest.securedrop_test_vars testinfra_hosts = [securedrop_test_vars.app_hostname] +python_version = securedrop_test_vars.python_version def test_apache_default_docroot_is_absent(host): @@ -21,7 +22,7 @@ def test_apache_default_docroot_is_absent(host): 'gnupg2', 'haveged', 'libapache2-mod-xsendfile', - 'libpython3.5', + 'libpython{}'.format(python_version), 'paxctld', 'python3', 'redis-server', diff --git a/molecule/testinfra/common/test_platform.py b/molecule/testinfra/common/test_platform.py index ec2fcaf1ac..35cc13a821 100644 --- a/molecule/testinfra/common/test_platform.py +++ b/molecule/testinfra/common/test_platform.py @@ -4,8 +4,8 @@ testinfra_hosts = [test_vars.app_hostname, test_vars.monitor_hostname] # We expect Ubuntu Xenial -SUPPORTED_CODENAMES = ('xenial') -SUPPORTED_RELEASES = ('16.04') +SUPPORTED_CODENAMES = ('xenial', 'focal') +SUPPORTED_RELEASES = ('16.04', '20.04') def test_ansible_version(host): @@ -23,7 +23,7 @@ def test_ansible_version(host): def test_platform(host): """ - SecureDrop requires Ubuntu Ubuntu 16.04 LTS. + SecureDrop requires Ubuntu Ubuntu 16.04 or 20.04 LTS """ assert host.system_info.type == "linux" assert host.system_info.distribution == "ubuntu" diff --git a/molecule/testinfra/common/test_release_upgrades.py b/molecule/testinfra/common/test_release_upgrades.py index d0b5e14664..d6134e3eea 100644 --- a/molecule/testinfra/common/test_release_upgrades.py +++ b/molecule/testinfra/common/test_release_upgrades.py @@ -13,6 +13,7 @@ def test_release_manager_upgrade_channel(host): """ expected_channels = { "xenial": "never", + "focal": "never", } config_path = "/etc/update-manager/release-upgrades" diff --git a/molecule/testinfra/conftest.py b/molecule/testinfra/conftest.py index e88a628405..8ed4322f4f 100644 --- a/molecule/testinfra/conftest.py +++ b/molecule/testinfra/conftest.py @@ -10,7 +10,6 @@ import os import yaml - # The config tests target staging by default. It's possible to override # for e.g. prod, but the associated vars files are not yet ported. target_host = os.environ.get('SECUREDROP_TESTINFRA_TARGET_HOST', 'staging') @@ -28,6 +27,13 @@ def securedrop_import_testinfra_vars(hostname, with_header=False): with io.open(filepath, 'r') as f: hostvars = yaml.safe_load(f) + if os.environ.get("MOLECULE_SCENARIO_NAME").endswith("focal"): + hostvars['securedrop_venv_site_packages'] = hostvars["securedrop_venv_site_packages"].format("3.8") # noqa: E501 + hostvars['python_version'] = "3.8" + else: + hostvars['securedrop_venv_site_packages'] = hostvars["securedrop_venv_site_packages"].format("3.5") # noqa: E501 + hostvars['python_version'] = "3.5" + if with_header: hostvars = dict(securedrop_test_vars=hostvars) diff --git a/molecule/testinfra/vars/app-staging.yml b/molecule/testinfra/vars/app-staging.yml index a8b44ce04c..cf8aa1d3a4 100644 --- a/molecule/testinfra/vars/app-staging.yml +++ b/molecule/testinfra/vars/app-staging.yml @@ -13,7 +13,7 @@ wanted_apache_headers: securedrop_venv: /opt/venvs/securedrop-app-code securedrop_venv_bin: /opt/venvs/securedrop-app-code/bin -securedrop_venv_site_packages: /opt/venvs/securedrop-app-code/lib/python3.5/site-packages +securedrop_venv_site_packages: /opt/venvs/securedrop-app-code/lib/python{}/site-packages securedrop_code: /var/www/securedrop securedrop_data: /var/lib/securedrop securedrop_user: www-data diff --git a/molecule/testinfra/vars/staging.yml b/molecule/testinfra/vars/staging.yml index 94c8b7dffb..2ce1382cac 100644 --- a/molecule/testinfra/vars/staging.yml +++ b/molecule/testinfra/vars/staging.yml @@ -13,7 +13,7 @@ wanted_apache_headers: securedrop_venv: /opt/venvs/securedrop-app-code securedrop_venv_bin: /opt/venvs/securedrop-app-code/bin -securedrop_venv_site_packages: /opt/venvs/securedrop-app-code/lib/python3.5/site-packages +securedrop_venv_site_packages: /opt/venvs/securedrop-app-code/lib/python{}/site-packages securedrop_code: /var/www/securedrop securedrop_data: /var/lib/securedrop securedrop_user: www-data