diff --git a/tests/integration_tests/datasources/test_lxd_discovery.py b/tests/integration_tests/datasources/test_lxd_discovery.py index f534f47f878..f72b1b4b487 100644 --- a/tests/integration_tests/datasources/test_lxd_discovery.py +++ b/tests/integration_tests/datasources/test_lxd_discovery.py @@ -9,7 +9,7 @@ def _customize_envionment(client: IntegrationInstance): - # Assert our platform can detect LXD during sytemd generator timeframe. + # Assert our platform can detect LXD during systemd generator timeframe. ds_id_log = client.execute("cat /run/cloud-init/ds-identify.log").stdout assert "check for 'LXD' returned found" in ds_id_log @@ -35,6 +35,7 @@ def _customize_envionment(client: IntegrationInstance): "/etc/cloud/cloud.cfg.d/99-detect-lxd-first.cfg", "datasource_list: [LXD, NoCloud]\n", ) + # This is also to ensure that NoCloud can be detected if ImageSpecification.from_os_image().release == "jammy": # Add nocloud-net seed files because Jammy no longer delivers NoCloud # (LP: #1958460). @@ -47,8 +48,6 @@ def _customize_envionment(client: IntegrationInstance): client.restart() -# This test should be able to work on any cloud whose datasource specifies -# a NETWORK dependency @pytest.mark.lxd_container @pytest.mark.lxd_vm @pytest.mark.ubuntu # Because netplan @@ -111,7 +110,11 @@ def test_lxd_datasource_discovery(client: IntegrationInstance): assert "#cloud-config\ninstance-id" in ds_cfg["meta-data"] # Jammy not longer provides nocloud-net seed files (LP: #1958460) - if ImageSpecification.from_os_image().release != "jammy": + if ImageSpecification.from_os_image().release in [ + "bionic", + "focal", + "impish", + ]: # Assert NoCloud seed files are still present in non-Jammy images # and that NoCloud seed files provide the same content as LXD socket. nocloud_metadata = yaml.safe_load( diff --git a/tests/integration_tests/modules/test_combined.py b/tests/integration_tests/modules/test_combined.py index d6a717c03a5..16cdcce9627 100644 --- a/tests/integration_tests/modules/test_combined.py +++ b/tests/integration_tests/modules/test_combined.py @@ -192,10 +192,14 @@ def test_correct_datasource_detected( parsed_datasource = json.loads(status_file)["v1"]["datasource"] if client.settings.PLATFORM in ["lxd_container", "lxd_vm"]: - if ImageSpecification.from_os_image().release == "jammy": - datasource = "DataSourceLXD" - else: + if ImageSpecification.from_os_image().release in [ + "bionic", + "focal", + "impish", + ]: datasource = "DataSourceNoCloud" + else: + datasource = "DataSourceLXD" assert parsed_datasource.startswith(datasource) else: platform_datasources = { @@ -246,7 +250,11 @@ def test_instance_json_lxd(self, class_client: IntegrationInstance): data = json.loads(instance_json_file) self._check_common_metadata(data) v1_data = data["v1"] - if ImageSpecification.from_os_image().release == "jammy": + if ImageSpecification.from_os_image().release not in [ + "bionic", + "focal", + "impish", + ]: cloud_name = "lxd" subplatform = "LXD socket API v. 1.0 (/dev/lxd/sock)" # instance-id should be a UUID @@ -282,7 +290,11 @@ def test_instance_json_lxd_vm(self, class_client: IntegrationInstance): data = json.loads(instance_json_file) self._check_common_metadata(data) v1_data = data["v1"] - if ImageSpecification.from_os_image().release == "jammy": + if ImageSpecification.from_os_image().release not in [ + "bionic", + "focal", + "impish", + ]: cloud_name = "lxd" subplatform = "LXD socket API v. 1.0 (/dev/lxd/sock)" # instance-id should be a UUID