Merge ~adam-collard/maas-ci/+git/system-tests:lxd-vm-bug into ~maas-committers/maas-ci/+git/system-tests:master

Proposed by Adam Collard
Status: Merged
Approved by: Adam Collard
Approved revision: ad35e0bff700625ef2d85b1d6812fbb8bed45215
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~adam-collard/maas-ci/+git/system-tests:lxd-vm-bug
Merge into: ~maas-committers/maas-ci/+git/system-tests:master
Diff against target: 83 lines (+19/-6)
4 files modified
systemtests/api.py (+1/-1)
systemtests/fixtures.py (+1/-1)
systemtests/lxd.py (+16/-3)
systemtests/utils.py (+1/-1)
Reviewer Review Type Date Requested Status
MAAS Lander Approve
Jack Lloyd-Walters Approve
Review via email: mp+426008@code.launchpad.net

Commit message

Several small fixes to get system-tests green

- No need to actually look at the results from grep

- Timeout on login

Avoid the multiple hour hang that we hit in http://maas-integration-ci.internal:8080/job/maas-system-tests/1355/

- Retry device removal

- Reverse the event logs so most recent is at the bottom

To post a comment you must log in.
Revision history for this message
Jack Lloyd-Walters (lloydwaltersj) :
review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b lxd-vm-bug lp:~adam-collard/maas-ci/+git/system-tests into -b master lp:~maas-committers/maas-ci/+git/system-tests

STATUS: SUCCESS
COMMIT: ad35e0bff700625ef2d85b1d6812fbb8bed45215

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/systemtests/api.py b/systemtests/api.py
index 46d9dad..8279739 100644
--- a/systemtests/api.py
+++ b/systemtests/api.py
@@ -108,7 +108,7 @@ class UnauthenticatedMAASAPIClient:
108 cmd = ["login", session, self.url, token]108 cmd = ["login", session, self.url, token]
109 if self.url.startswith("https://"):109 if self.url.startswith("https://"):
110 cmd += ["--cacerts", f"{MAAS_CONTAINER_CERTS_PATH}cacerts.pem"]110 cmd += ["--cacerts", f"{MAAS_CONTAINER_CERTS_PATH}cacerts.pem"]
111 output = self.execute(cmd)111 output = self.execute(cmd, base_cmd=["timeout", "5m", "maas"])
112 return output, AuthenticatedAPIClient(self, session)112 return output, AuthenticatedAPIClient(self, session)
113113
114114
diff --git a/systemtests/fixtures.py b/systemtests/fixtures.py
index 0bbfaf9..8a73fa3 100644
--- a/systemtests/fixtures.py
+++ b/systemtests/fixtures.py
@@ -590,7 +590,7 @@ def maas_client_container(
590 f"{MAAS_CONTAINER_CERTS_PATH}cacerts.pem",590 f"{MAAS_CONTAINER_CERTS_PATH}cacerts.pem",
591 )591 )
592 try:592 try:
593 lxd.execute(container, ["sh", "-c", "grep maas.under.test /etc/hosts"])593 lxd.execute(container, ["sh", "-c", "grep -q maas.under.test /etc/hosts"])
594 except subprocess.CalledProcessError:594 except subprocess.CalledProcessError:
595 lxd.execute(595 lxd.execute(
596 container,596 container,
diff --git a/systemtests/lxd.py b/systemtests/lxd.py
index c2c1540..a7fec6e 100644
--- a/systemtests/lxd.py
+++ b/systemtests/lxd.py
@@ -9,7 +9,7 @@ from itertools import chain
9from pathlib import Path9from pathlib import Path
10from typing import TYPE_CHECKING, Optional10from typing import TYPE_CHECKING, Optional
1111
12from retry.api import retry12from retry import retry
1313
14from .device_config import DeviceConfig, fmt_lxd_options14from .device_config import DeviceConfig, fmt_lxd_options
15from .subprocess import run_with_logging15from .subprocess import run_with_logging
@@ -82,7 +82,7 @@ class CLILXD:
82 self.logger.info(f"Container {name} created.")82 self.logger.info(f"Container {name} created.")
83 self.logger.info("Waiting for boot to finish...")83 self.logger.info("Waiting for boot to finish...")
8484
85 @retry(tries=120, delay=1, exceptions=CloudInitDisabled, logger=self.logger)85 @retry(exceptions=CloudInitDisabled, tries=120, delay=1, logger=self.logger)
86 def _cloud_init_wait() -> None:86 def _cloud_init_wait() -> None:
87 process = self.execute(87 process = self.execute(
88 name, ["timeout", "2000", "cloud-init", "status", "--wait", "--long"]88 name, ["timeout", "2000", "cloud-init", "status", "--wait", "--long"]
@@ -283,7 +283,20 @@ class CLILXD:
283 )283 )
284284
285 def remove_instance_device(self, instance_name: str, device_name: str) -> None:285 def remove_instance_device(self, instance_name: str, device_name: str) -> None:
286 self._run(["lxc", "config", "device", "remove", instance_name, device_name])286 """Remove a device from an instance."""
287
288 @retry(
289 exceptions=subprocess.CalledProcessError,
290 tries=5,
291 delay=0.5,
292 logger=self.logger,
293 )
294 def _remove_device() -> subprocess.CompletedProcess[str]:
295 return self._run(
296 ["lxc", "config", "device", "remove", instance_name, device_name]
297 )
298
299 _remove_device()
287300
288 def list_instances(self) -> dict[str, dict[str, Any]]:301 def list_instances(self) -> dict[str, dict[str, Any]]:
289 result = self._run(["lxc", "list", "-f", "json"])302 result = self._run(["lxc", "list", "-f", "json"])
diff --git a/systemtests/utils.py b/systemtests/utils.py
index 37b2906..bc389ce 100644
--- a/systemtests/utils.py
+++ b/systemtests/utils.py
@@ -174,7 +174,7 @@ def wait_for_machine(
174 debug_outputs.extend(174 debug_outputs.extend(
175 f"- {event['type']}"175 f"- {event['type']}"
176 + (f": {event['description']}" if event["description"] else "")176 + (f": {event['description']}" if event["description"] else "")
177 for event in events["events"]177 for event in reversed(events["events"])
178 )178 )
179 raise UnexpectedMachineStatus(179 raise UnexpectedMachineStatus(
180 machine["hostname"], status, retry_info.elapsed, debug_outputs180 machine["hostname"], status, retry_info.elapsed, debug_outputs

Subscribers

People subscribed via source and target branches

to all changes: