Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion tests/integration_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,11 @@ def _collect_logs(
os.symlink(log_dir.parent, last_symlink)

tarball_path = log_dir / "cloud-init.tar.gz"
instance.pull_file("/var/tmp/cloud-init.tar.gz", tarball_path)
try:
instance.pull_file("/var/tmp/cloud-init.tar.gz", tarball_path)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops my recent changes to pull_file broke us thanks.

except Exception as e:
log.error("Failed to pull logs: %s", e)
return

tarball = TarFile.open(str(tarball_path))
tarball.extractall(path=str(log_dir))
Expand Down
34 changes: 16 additions & 18 deletions tests/integration_tests/modules/test_combined.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,24 +205,22 @@ def test_correct_datasource_detected(
"""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"] == []
Expand Down