From 3f0918b57c6042de99da25bc6a9d120a074b8a8e Mon Sep 17 00:00:00 2001 From: James Falcon Date: Thu, 3 Feb 2022 15:37:14 -0600 Subject: Integration test changes (#1240) * Wrap the log fetching code in a try/except in case file is missing * Stop checking NoCloud seed dir when testing datasource detection --- tests/integration_tests/modules/test_combined.py | 34 +++++++++++------------- 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'tests/integration_tests/modules') diff --git a/tests/integration_tests/modules/test_combined.py b/tests/integration_tests/modules/test_combined.py index c88f40d3..43aa809e 100644 --- a/tests/integration_tests/modules/test_combined.py +++ b/tests/integration_tests/modules/test_combined.py @@ -205,24 +205,22 @@ class TestCombined: """Test datasource is detected at the proper boot stage.""" client = class_client status_file = client.read_from_file("/run/cloud-init/status.json") - - platform_datasources = { - "azure": "DataSourceAzure [seed=/dev/sr0]", - "ec2": "DataSourceEc2Local", - "gce": "DataSourceGCELocal", - "oci": "DataSourceOracle", - "openstack": "DataSourceOpenStackLocal [net,ver=2]", - "lxd_container": ( - "DataSourceNoCloud " - "[seed=/var/lib/cloud/seed/nocloud-net][dsmode=net]" - ), - "lxd_vm": "DataSourceNoCloud [seed=/dev/sr0][dsmode=net]", - } - - assert ( - platform_datasources[client.settings.PLATFORM] - == json.loads(status_file)["v1"]["datasource"] - ) + parsed_datasource = json.loads(status_file)["v1"]["datasource"] + + if client.settings.PLATFORM in ["lxd_container", "lxd_vm"]: + assert parsed_datasource.startswith("DataSourceNoCloud") + else: + platform_datasources = { + "azure": "DataSourceAzure [seed=/dev/sr0]", + "ec2": "DataSourceEc2Local", + "gce": "DataSourceGCELocal", + "oci": "DataSourceOracle", + "openstack": "DataSourceOpenStackLocal [net,ver=2]", + } + assert ( + platform_datasources[client.settings.PLATFORM] + == parsed_datasource + ) def _check_common_metadata(self, data): assert data["base64_encoded_keys"] == [] -- cgit v1.2.3