diff options
Diffstat (limited to 'tests/integration_tests/bugs')
-rw-r--r-- | tests/integration_tests/bugs/test_gh570.py | 13 | ||||
-rw-r--r-- | tests/integration_tests/bugs/test_gh626.py | 25 | ||||
-rw-r--r-- | tests/integration_tests/bugs/test_gh632.py | 20 | ||||
-rw-r--r-- | tests/integration_tests/bugs/test_gh668.py | 15 | ||||
-rw-r--r-- | tests/integration_tests/bugs/test_gh671.py | 35 | ||||
-rw-r--r-- | tests/integration_tests/bugs/test_gh868.py | 3 | ||||
-rw-r--r-- | tests/integration_tests/bugs/test_lp1813396.py | 3 | ||||
-rw-r--r-- | tests/integration_tests/bugs/test_lp1835584.py | 19 | ||||
-rw-r--r-- | tests/integration_tests/bugs/test_lp1886531.py | 2 | ||||
-rw-r--r-- | tests/integration_tests/bugs/test_lp1897099.py | 13 | ||||
-rw-r--r-- | tests/integration_tests/bugs/test_lp1898997.py | 14 | ||||
-rw-r--r-- | tests/integration_tests/bugs/test_lp1900837.py | 2 | ||||
-rw-r--r-- | tests/integration_tests/bugs/test_lp1901011.py | 49 | ||||
-rw-r--r-- | tests/integration_tests/bugs/test_lp1910835.py | 1 | ||||
-rw-r--r-- | tests/integration_tests/bugs/test_lp1912844.py | 4 |
15 files changed, 115 insertions, 103 deletions
diff --git a/tests/integration_tests/bugs/test_gh570.py b/tests/integration_tests/bugs/test_gh570.py index 534cfb9a..ddc74503 100644 --- a/tests/integration_tests/bugs/test_gh570.py +++ b/tests/integration_tests/bugs/test_gh570.py @@ -4,9 +4,10 @@ Test that we can add optional vendor-data to the seedfrom file in a NoCloud environment """ -from tests.integration_tests.instances import IntegrationInstance import pytest +from tests.integration_tests.instances import IntegrationInstance + VENDOR_DATA = """\ #cloud-config runcmd: @@ -19,7 +20,7 @@ runcmd: @pytest.mark.lxd_container @pytest.mark.lxd_vm def test_nocloud_seedfrom_vendordata(client: IntegrationInstance): - seed_dir = '/var/tmp/test_seed_dir' + seed_dir = "/var/tmp/test_seed_dir" result = client.execute( "mkdir {seed_dir} && " "touch {seed_dir}/user-data && " @@ -30,10 +31,10 @@ def test_nocloud_seedfrom_vendordata(client: IntegrationInstance): assert result.return_code == 0 client.write_to_file( - '{}/vendor-data'.format(seed_dir), + "{}/vendor-data".format(seed_dir), VENDOR_DATA, ) - client.execute('cloud-init clean --logs') + client.execute("cloud-init clean --logs") client.restart() - assert client.execute('cloud-init status').ok - assert 'seeded_vendordata_test_file' in client.execute('ls /var/tmp') + assert client.execute("cloud-init status").ok + assert "seeded_vendordata_test_file" in client.execute("ls /var/tmp") diff --git a/tests/integration_tests/bugs/test_gh626.py b/tests/integration_tests/bugs/test_gh626.py index dba01b34..7c720143 100644 --- a/tests/integration_tests/bugs/test_gh626.py +++ b/tests/integration_tests/bugs/test_gh626.py @@ -11,7 +11,6 @@ from tests.integration_tests import random_mac_address from tests.integration_tests.clouds import ImageSpecification from tests.integration_tests.instances import IntegrationInstance - MAC_ADDRESS = random_mac_address() NETWORK_CONFIG = """\ version: 2 @@ -21,7 +20,9 @@ ethernets: wakeonlan: true match: macaddress: {} -""".format(MAC_ADDRESS) +""".format( + MAC_ADDRESS +) EXPECTED_ENI_END = """\ iface eth0 inet dhcp @@ -31,17 +32,19 @@ iface eth0 inet dhcp @pytest.mark.sru_2020_11 @pytest.mark.lxd_container @pytest.mark.lxd_vm -@pytest.mark.lxd_config_dict({ - 'user.network-config': NETWORK_CONFIG, - "volatile.eth0.hwaddr": MAC_ADDRESS, -}) +@pytest.mark.lxd_config_dict( + { + "user.network-config": NETWORK_CONFIG, + "volatile.eth0.hwaddr": MAC_ADDRESS, + } +) def test_wakeonlan(client: IntegrationInstance): - if ImageSpecification.from_os_image().release == 'xenial': - eni = client.execute('cat /etc/network/interfaces.d/50-cloud-init.cfg') + if ImageSpecification.from_os_image().release == "xenial": + eni = client.execute("cat /etc/network/interfaces.d/50-cloud-init.cfg") assert eni.endswith(EXPECTED_ENI_END) return - netplan_cfg = client.execute('cat /etc/netplan/50-cloud-init.yaml') + netplan_cfg = client.execute("cat /etc/netplan/50-cloud-init.yaml") netplan_yaml = yaml.safe_load(netplan_cfg) - assert 'wakeonlan' in netplan_yaml['network']['ethernets']['eth0'] - assert netplan_yaml['network']['ethernets']['eth0']['wakeonlan'] is True + assert "wakeonlan" in netplan_yaml["network"]["ethernets"]["eth0"] + assert netplan_yaml["network"]["ethernets"]["eth0"]["wakeonlan"] is True diff --git a/tests/integration_tests/bugs/test_gh632.py b/tests/integration_tests/bugs/test_gh632.py index f3702a2e..c7a897c6 100644 --- a/tests/integration_tests/bugs/test_gh632.py +++ b/tests/integration_tests/bugs/test_gh632.py @@ -14,18 +14,20 @@ from tests.integration_tests.util import verify_clean_log @pytest.mark.lxd_vm def test_datasource_rbx_no_stacktrace(client: IntegrationInstance): client.write_to_file( - '/etc/cloud/cloud.cfg.d/90_dpkg.cfg', - 'datasource_list: [ RbxCloud, NoCloud ]\n', + "/etc/cloud/cloud.cfg.d/90_dpkg.cfg", + "datasource_list: [ RbxCloud, NoCloud ]\n", ) client.write_to_file( - '/etc/cloud/ds-identify.cfg', - 'policy: enabled\n', + "/etc/cloud/ds-identify.cfg", + "policy: enabled\n", ) - client.execute('cloud-init clean --logs') + client.execute("cloud-init clean --logs") client.restart() - log = client.read_from_file('/var/log/cloud-init.log') + log = client.read_from_file("/var/log/cloud-init.log") verify_clean_log(log) - assert 'Failed to load metadata and userdata' not in log - assert ("Getting data from <class 'cloudinit.sources.DataSourceRbxCloud." - "DataSourceRbxCloud'> failed") not in log + assert "Failed to load metadata and userdata" not in log + assert ( + "Getting data from <class 'cloudinit.sources.DataSourceRbxCloud." + "DataSourceRbxCloud'> failed" not in log + ) diff --git a/tests/integration_tests/bugs/test_gh668.py b/tests/integration_tests/bugs/test_gh668.py index ce57052e..95edb48d 100644 --- a/tests/integration_tests/bugs/test_gh668.py +++ b/tests/integration_tests/bugs/test_gh668.py @@ -10,7 +10,6 @@ import pytest from tests.integration_tests import random_mac_address from tests.integration_tests.instances import IntegrationInstance - DESTINATION_IP = "172.16.0.10" GATEWAY_IP = "10.0.0.100" MAC_ADDRESS = random_mac_address() @@ -26,17 +25,21 @@ ethernets: via: {} match: macaddress: {} -""".format(DESTINATION_IP, GATEWAY_IP, MAC_ADDRESS) +""".format( + DESTINATION_IP, GATEWAY_IP, MAC_ADDRESS +) EXPECTED_ROUTE = "{} via {}".format(DESTINATION_IP, GATEWAY_IP) @pytest.mark.lxd_container @pytest.mark.lxd_vm -@pytest.mark.lxd_config_dict({ - "user.network-config": NETWORK_CONFIG, - "volatile.eth0.hwaddr": MAC_ADDRESS, -}) +@pytest.mark.lxd_config_dict( + { + "user.network-config": NETWORK_CONFIG, + "volatile.eth0.hwaddr": MAC_ADDRESS, + } +) @pytest.mark.lxd_use_exec def test_static_route_to_host(client: IntegrationInstance): route = client.execute("ip route | grep {}".format(DESTINATION_IP)) diff --git a/tests/integration_tests/bugs/test_gh671.py b/tests/integration_tests/bugs/test_gh671.py index 5e90cdda..15f204ee 100644 --- a/tests/integration_tests/bugs/test_gh671.py +++ b/tests/integration_tests/bugs/test_gh671.py @@ -11,13 +11,13 @@ import pytest from tests.integration_tests.clouds import IntegrationCloud -OLD_PASSWORD = 'DoIM33tTheComplexityRequirements!??' -NEW_PASSWORD = 'DoIM33tTheComplexityRequirementsNow!??' +OLD_PASSWORD = "DoIM33tTheComplexityRequirements!??" +NEW_PASSWORD = "DoIM33tTheComplexityRequirementsNow!??" def _check_password(instance, unhashed_password): - shadow_password = instance.execute('getent shadow ubuntu').split(':')[1] - salt = shadow_password.rsplit('$', 1)[0] + shadow_password = instance.execute("getent shadow ubuntu").split(":")[1] + salt = shadow_password.rsplit("$", 1)[0] hashed_password = crypt.crypt(unhashed_password, salt) assert shadow_password == hashed_password @@ -26,29 +26,28 @@ def _check_password(instance, unhashed_password): @pytest.mark.sru_2020_11 def test_update_default_password(setup_image, session_cloud: IntegrationCloud): os_profile = { - 'os_profile': { - 'admin_password': '', - 'linux_configuration': { - 'disable_password_authentication': False - } + "os_profile": { + "admin_password": "", + "linux_configuration": {"disable_password_authentication": False}, } } - os_profile['os_profile']['admin_password'] = OLD_PASSWORD - instance1 = session_cloud.launch(launch_kwargs={'vm_params': os_profile}) + os_profile["os_profile"]["admin_password"] = OLD_PASSWORD + instance1 = session_cloud.launch(launch_kwargs={"vm_params": os_profile}) _check_password(instance1, OLD_PASSWORD) snapshot_id = instance1.cloud.cloud_instance.snapshot( - instance1.instance, - delete_provisioned_user=False + instance1.instance, delete_provisioned_user=False ) - os_profile['os_profile']['admin_password'] = NEW_PASSWORD + os_profile["os_profile"]["admin_password"] = NEW_PASSWORD try: - with session_cloud.launch(launch_kwargs={ - 'image_id': snapshot_id, - 'vm_params': os_profile, - }) as instance2: + with session_cloud.launch( + launch_kwargs={ + "image_id": snapshot_id, + "vm_params": os_profile, + } + ) as instance2: _check_password(instance2, NEW_PASSWORD) finally: session_cloud.cloud_instance.delete_image(snapshot_id) diff --git a/tests/integration_tests/bugs/test_gh868.py b/tests/integration_tests/bugs/test_gh868.py index 1119d461..a62e8b36 100644 --- a/tests/integration_tests/bugs/test_gh868.py +++ b/tests/integration_tests/bugs/test_gh868.py @@ -4,7 +4,6 @@ import pytest from tests.integration_tests.instances import IntegrationInstance from tests.integration_tests.util import verify_clean_log - USERDATA = """\ #cloud-config chef: @@ -24,5 +23,5 @@ chef: @pytest.mark.lxd_vm @pytest.mark.user_data(USERDATA) def test_chef_license(client: IntegrationInstance): - log = client.read_from_file('/var/log/cloud-init.log') + log = client.read_from_file("/var/log/cloud-init.log") verify_clean_log(log) diff --git a/tests/integration_tests/bugs/test_lp1813396.py b/tests/integration_tests/bugs/test_lp1813396.py index 27d41c2b..451a9972 100644 --- a/tests/integration_tests/bugs/test_lp1813396.py +++ b/tests/integration_tests/bugs/test_lp1813396.py @@ -8,7 +8,6 @@ import pytest from tests.integration_tests.instances import IntegrationInstance from tests.integration_tests.util import verify_ordered_items_in_text - USER_DATA = """\ #cloud-config apt: @@ -23,7 +22,7 @@ apt: @pytest.mark.sru_2020_11 @pytest.mark.user_data(USER_DATA) def test_gpg_no_tty(client: IntegrationInstance): - log = client.read_from_file('/var/log/cloud-init.log') + log = client.read_from_file("/var/log/cloud-init.log") to_verify = [ "Running command ['gpg', '--no-tty', " "'--keyserver=keyserver.ubuntu.com', '--recv-keys', 'E4D304DF'] " diff --git a/tests/integration_tests/bugs/test_lp1835584.py b/tests/integration_tests/bugs/test_lp1835584.py index 732f2179..a800eab4 100644 --- a/tests/integration_tests/bugs/test_lp1835584.py +++ b/tests/integration_tests/bugs/test_lp1835584.py @@ -31,12 +31,9 @@ import re import pytest -from tests.integration_tests.instances import IntegrationAzureInstance -from tests.integration_tests.clouds import ( - ImageSpecification, IntegrationCloud -) +from tests.integration_tests.clouds import ImageSpecification, IntegrationCloud from tests.integration_tests.conftest import get_validated_source - +from tests.integration_tests.instances import IntegrationAzureInstance IMG_AZURE_UBUNTU_PRO_FIPS_BIONIC = ( "Canonical:0001-com-ubuntu-pro-bionic-fips:pro-fips-18_04:18.04.202010201" @@ -44,14 +41,12 @@ IMG_AZURE_UBUNTU_PRO_FIPS_BIONIC = ( def _check_iid_insensitive_across_kernel_upgrade( - instance: IntegrationAzureInstance + instance: IntegrationAzureInstance, ): uuid = instance.read_from_file("/sys/class/dmi/id/product_uuid") - assert uuid.isupper(), ( - "Expected uppercase UUID on Ubuntu FIPS image {}".format( - uuid - ) - ) + assert ( + uuid.isupper() + ), "Expected uppercase UUID on Ubuntu FIPS image {}".format(uuid) orig_kernel = instance.execute("uname -r").strip() assert "azure-fips" in orig_kernel result = instance.execute("apt-get update") @@ -80,7 +75,7 @@ def _check_iid_insensitive_across_kernel_upgrade( @pytest.mark.azure @pytest.mark.sru_next def test_azure_kernel_upgrade_case_insensitive_uuid( - session_cloud: IntegrationCloud + session_cloud: IntegrationCloud, ): cfg_image_spec = ImageSpecification.from_os_image() if (cfg_image_spec.os, cfg_image_spec.release) != ("ubuntu", "bionic"): diff --git a/tests/integration_tests/bugs/test_lp1886531.py b/tests/integration_tests/bugs/test_lp1886531.py index 6dd61222..d56ca320 100644 --- a/tests/integration_tests/bugs/test_lp1886531.py +++ b/tests/integration_tests/bugs/test_lp1886531.py @@ -13,7 +13,6 @@ import pytest from tests.integration_tests.util import verify_clean_log - USER_DATA = """\ #cloud-config bootcmd: @@ -22,7 +21,6 @@ bootcmd: class TestLp1886531: - @pytest.mark.user_data(USER_DATA) def test_lp1886531(self, client): log_content = client.read_from_file("/var/log/cloud-init.log") diff --git a/tests/integration_tests/bugs/test_lp1897099.py b/tests/integration_tests/bugs/test_lp1897099.py index 27c8927f..876a2887 100644 --- a/tests/integration_tests/bugs/test_lp1897099.py +++ b/tests/integration_tests/bugs/test_lp1897099.py @@ -7,7 +7,6 @@ https://bugs.launchpad.net/cloud-init/+bug/1897099 import pytest - USER_DATA = """\ #cloud-config bootcmd: @@ -21,11 +20,11 @@ swap: @pytest.mark.sru_2020_11 @pytest.mark.user_data(USER_DATA) -@pytest.mark.no_container('Containers cannot configure swap') +@pytest.mark.no_container("Containers cannot configure swap") def test_fallocate_fallback(client): - log = client.read_from_file('/var/log/cloud-init.log') - assert '/swap.img' in client.execute('cat /proc/swaps') - assert '/swap.img' in client.execute('cat /etc/fstab') - assert 'fallocate swap creation failed, will attempt with dd' in log + log = client.read_from_file("/var/log/cloud-init.log") + assert "/swap.img" in client.execute("cat /proc/swaps") + assert "/swap.img" in client.execute("cat /etc/fstab") + assert "fallocate swap creation failed, will attempt with dd" in log assert "Running command ['dd', 'if=/dev/zero', 'of=/swap.img'" in log - assert 'SUCCESS: config-mounts ran successfully' in log + assert "SUCCESS: config-mounts ran successfully" in log diff --git a/tests/integration_tests/bugs/test_lp1898997.py b/tests/integration_tests/bugs/test_lp1898997.py index 909bc690..115bd34f 100644 --- a/tests/integration_tests/bugs/test_lp1898997.py +++ b/tests/integration_tests/bugs/test_lp1898997.py @@ -33,13 +33,17 @@ ethernets: match: macaddress: {} version: 2 -""".format(MAC_ADDRESS) +""".format( + MAC_ADDRESS +) -@pytest.mark.lxd_config_dict({ - "user.network-config": NETWORK_CONFIG, - "volatile.eth0.hwaddr": MAC_ADDRESS, -}) +@pytest.mark.lxd_config_dict( + { + "user.network-config": NETWORK_CONFIG, + "volatile.eth0.hwaddr": MAC_ADDRESS, + } +) @pytest.mark.lxd_vm @pytest.mark.lxd_use_exec @pytest.mark.not_bionic diff --git a/tests/integration_tests/bugs/test_lp1900837.py b/tests/integration_tests/bugs/test_lp1900837.py index fcc2b751..3df10883 100644 --- a/tests/integration_tests/bugs/test_lp1900837.py +++ b/tests/integration_tests/bugs/test_lp1900837.py @@ -23,7 +23,7 @@ class TestLogPermissionsNotResetOnReboot: # Reboot client.restart() - assert client.execute('cloud-init status').ok + assert client.execute("cloud-init status").ok # Check that permissions are not reset on reboot assert "600" == _get_log_perms(client) diff --git a/tests/integration_tests/bugs/test_lp1901011.py b/tests/integration_tests/bugs/test_lp1901011.py index 2b47f0a8..7de8bd77 100644 --- a/tests/integration_tests/bugs/test_lp1901011.py +++ b/tests/integration_tests/bugs/test_lp1901011.py @@ -10,12 +10,16 @@ from tests.integration_tests.clouds import IntegrationCloud @pytest.mark.azure -@pytest.mark.parametrize('instance_type,is_ephemeral', [ - ('Standard_DS1_v2', True), - ('Standard_D2s_v4', False), -]) -def test_ephemeral(instance_type, is_ephemeral, - session_cloud: IntegrationCloud, setup_image): +@pytest.mark.parametrize( + "instance_type,is_ephemeral", + [ + ("Standard_DS1_v2", True), + ("Standard_D2s_v4", False), + ], +) +def test_ephemeral( + instance_type, is_ephemeral, session_cloud: IntegrationCloud, setup_image +): if is_ephemeral: expected_log = ( "Ephemeral resource disk '/dev/disk/cloud/azure_resource' exists. " @@ -29,30 +33,35 @@ def test_ephemeral(instance_type, is_ephemeral, ) with session_cloud.launch( - launch_kwargs={'instance_type': instance_type} + launch_kwargs={"instance_type": instance_type} ) as client: # Verify log file - log = client.read_from_file('/var/log/cloud-init.log') + log = client.read_from_file("/var/log/cloud-init.log") assert expected_log in log # Verify devices - dev_links = client.execute('ls /dev/disk/cloud') - assert 'azure_root' in dev_links - assert 'azure_root-part1' in dev_links + dev_links = client.execute("ls /dev/disk/cloud") + assert "azure_root" in dev_links + assert "azure_root-part1" in dev_links if is_ephemeral: - assert 'azure_resource' in dev_links - assert 'azure_resource-part1' in dev_links + assert "azure_resource" in dev_links + assert "azure_resource-part1" in dev_links # Verify mounts - blks = client.execute('lsblk -pPo NAME,TYPE,MOUNTPOINT') + blks = client.execute("lsblk -pPo NAME,TYPE,MOUNTPOINT") root_device = client.execute( - 'realpath /dev/disk/cloud/azure_root-part1' + "realpath /dev/disk/cloud/azure_root-part1" + ) + assert ( + 'NAME="{}" TYPE="part" MOUNTPOINT="/"'.format(root_device) in blks ) - assert 'NAME="{}" TYPE="part" MOUNTPOINT="/"'.format( - root_device) in blks if is_ephemeral: ephemeral_device = client.execute( - 'realpath /dev/disk/cloud/azure_resource-part1' + "realpath /dev/disk/cloud/azure_resource-part1" + ) + assert ( + 'NAME="{}" TYPE="part" MOUNTPOINT="/mnt"'.format( + ephemeral_device + ) + in blks ) - assert 'NAME="{}" TYPE="part" MOUNTPOINT="/mnt"'.format( - ephemeral_device) in blks diff --git a/tests/integration_tests/bugs/test_lp1910835.py b/tests/integration_tests/bugs/test_lp1910835.py index 87f92d5e..ddd996f9 100644 --- a/tests/integration_tests/bugs/test_lp1910835.py +++ b/tests/integration_tests/bugs/test_lp1910835.py @@ -19,7 +19,6 @@ will match. """ import pytest - USER_DATA_TMPL = """\ #cloud-config ssh_authorized_keys: diff --git a/tests/integration_tests/bugs/test_lp1912844.py b/tests/integration_tests/bugs/test_lp1912844.py index efafae50..55511ed2 100644 --- a/tests/integration_tests/bugs/test_lp1912844.py +++ b/tests/integration_tests/bugs/test_lp1912844.py @@ -51,7 +51,9 @@ vlans: id: 200 link: ovs-br mtu: 1500 -""".format(MAC_ADDRESS) +""".format( + MAC_ADDRESS +) SETUP_USER_DATA = """\ |