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: 7c3389aa4295f4c391b555f4efefa576c9687bb8
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: 137 lines (+18/-21)
5 files modified
systemtests/env_builder/test_basic.py (+12/-10)
systemtests/lxd.py (+2/-2)
systemtests/tests_per_machine/test_hardware_sync.py (+1/-5)
systemtests/tests_per_machine/test_machine.py (+1/-2)
systemtests/utils.py (+2/-2)
Reviewer Review Type Date Requested Status
MAAS Lander Approve
Diego Mascialino (community) Approve
Review via email: mp+426185@code.launchpad.net

Commit message

Always start from scratch with VMs

Remove old-debug

To post a comment you must log in.
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: 5f69027dcb64c75850ff047122ad4f0df374f5cf

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: 96e7fa963cb34e90a751a012553da080a62ac00e

review: Approve
Revision history for this message
Diego Mascialino (dmascialino) :
review: Needs Information
7c3389a... by Adam Collard

Launch the VM with a fixed MAC address (diego's feedback)

Revision history for this message
Adam Collard (adam-collard) :
Revision history for this message
Diego Mascialino (dmascialino) :
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: 7c3389aa4295f4c391b555f4efefa576c9687bb8

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/systemtests/env_builder/test_basic.py b/systemtests/env_builder/test_basic.py
index 20da521..43ac2cf 100644
--- a/systemtests/env_builder/test_basic.py
+++ b/systemtests/env_builder/test_basic.py
@@ -10,7 +10,6 @@ import pytest
10from retry import retry10from retry import retry
1111
12from systemtests.lxd import get_lxd12from systemtests.lxd import get_lxd
13from systemtests.subprocess import run_with_logging
14from systemtests.utils import (13from systemtests.utils import (
15 randomstring,14 randomstring,
16 retries,15 retries,
@@ -120,9 +119,16 @@ class TestSetup:
120 lxd = get_lxd(logger=testlog)119 lxd = get_lxd(logger=testlog)
121 instances = lxd.list_instances()120 instances = lxd.list_instances()
122 vm_name = instance_config.name121 vm_name = instance_config.name
123 # VM doesn't exist, let's create it122 # Force delete the VM so we know we're starting clean
124 if vm_name not in instances:123 if vm_name in instances:
125 lxd.create_vm(vm_name, profile=instance_config.lxd_profile)124 lxd.delete(vm_name)
125
126 # Need to create a network device with a hwaddr
127 kwargs = {
128 "profile": instance_config.lxd_profile,
129 "volatile.eth0.hwaddr": instance_config.mac_address,
130 }
131 lxd.create_vm(vm_name, **kwargs)
126132
127 mac_address = instance_config.mac_address133 mac_address = instance_config.mac_address
128134
@@ -143,11 +149,6 @@ class TestSetup:
143 lxd.start(vm_name)149 lxd.start(vm_name)
144 except CalledProcessError:150 except CalledProcessError:
145 lxd._run(["lxc", "info", "--show-log", vm_name])151 lxd._run(["lxc", "info", "--show-log", vm_name])
146 process = run_with_logging(["ps", "aux"], logger=testlog)
147 for pid in process.stdout.splitlines():
148 run_with_logging(
149 ["cat", f"/proc/{pid}/cmdline"], logger=testlog
150 )
151 raise152 raise
152 else:153 else:
153 assert (154 assert (
@@ -169,10 +170,11 @@ class TestSetup:
169 if machine["status_name"] == "New":170 if machine["status_name"] == "New":
170 maas_api_client.commission_machine(machine)171 maas_api_client.commission_machine(machine)
171172
172 wait_for_machine(173 machine = wait_for_machine(
173 maas_api_client,174 maas_api_client,
174 machine,175 machine,
175 status="Ready",176 status="Ready",
176 abort_status="Failed commissioning",177 abort_status="Failed commissioning",
177 timeout=20 * 60,178 timeout=20 * 60,
178 )179 )
180 assert machine["status_name"] == "Ready"
diff --git a/systemtests/lxd.py b/systemtests/lxd.py
index 7fcdc78..b17ac0e 100644
--- a/systemtests/lxd.py
+++ b/systemtests/lxd.py
@@ -193,8 +193,8 @@ class CLILXD:
193193
194 return _retry_bad_handshake()194 return _retry_bad_handshake()
195195
196 def delete(self, container: str) -> None:196 def delete(self, instance: str) -> None:
197 self._run(["lxc", "delete", "--force", container])197 self._run(["lxc", "delete", "--force", instance])
198198
199 def get_ip_address(self, container: str) -> str:199 def get_ip_address(self, container: str) -> str:
200 @retry(200 @retry(
diff --git a/systemtests/tests_per_machine/test_hardware_sync.py b/systemtests/tests_per_machine/test_hardware_sync.py
index 6d71cf3..40d4346 100644
--- a/systemtests/tests_per_machine/test_hardware_sync.py
+++ b/systemtests/tests_per_machine/test_hardware_sync.py
@@ -111,7 +111,7 @@ def test_hardware_sync(
111 enable_hw_sync="true",111 enable_hw_sync="true",
112 )112 )
113113
114 wait_for_machine(114 hardware_sync_machine.machine = wait_for_machine(
115 maas_api_client,115 maas_api_client,
116 hardware_sync_machine.machine,116 hardware_sync_machine.machine,
117 status="Deployed",117 status="Deployed",
@@ -120,10 +120,6 @@ def test_hardware_sync(
120 timeout=40 * 60,120 timeout=40 * 60,
121 )121 )
122122
123 # if machine_config.osystem == "ubuntu":
124 hardware_sync_machine.machine = maas_api_client.read_machine(
125 hardware_sync_machine.machine
126 ) # IP could change after deploy
127 stdout = ssh_execute_command(123 stdout = ssh_execute_command(
128 hardware_sync_machine.machine, "ubuntu", ssh_key, "cat /etc/cloud/build.info"124 hardware_sync_machine.machine, "ubuntu", ssh_key, "cat /etc/cloud/build.info"
129 )125 )
diff --git a/systemtests/tests_per_machine/test_machine.py b/systemtests/tests_per_machine/test_machine.py
index 2eacf19..049a176 100644
--- a/systemtests/tests_per_machine/test_machine.py
+++ b/systemtests/tests_per_machine/test_machine.py
@@ -92,7 +92,7 @@ def test_full_circle(
92 machine, osystem=machine_config.osystem, distro_series=machine_config.osystem92 machine, osystem=machine_config.osystem, distro_series=machine_config.osystem
93 )93 )
9494
95 wait_for_machine(95 machine = wait_for_machine(
96 maas_api_client,96 maas_api_client,
97 machine,97 machine,
98 status="Deployed",98 status="Deployed",
@@ -101,7 +101,6 @@ def test_full_circle(
101 )101 )
102102
103 if machine_config.osystem == "ubuntu":103 if machine_config.osystem == "ubuntu":
104 machine = maas_api_client.read_machine(machine) # IP could change after deploy
105 stdout = ssh_execute_command(104 stdout = ssh_execute_command(
106 machine, "ubuntu", ssh_key, "cat /etc/cloud/build.info"105 machine, "ubuntu", ssh_key, "cat /etc/cloud/build.info"
107 )106 )
diff --git a/systemtests/utils.py b/systemtests/utils.py
index bc389ce..ad4c33b 100644
--- a/systemtests/utils.py
+++ b/systemtests/utils.py
@@ -157,13 +157,13 @@ def wait_for_machine(
157 abort_status: Optional[str] = None,157 abort_status: Optional[str] = None,
158 timeout: float = 10 * 60,158 timeout: float = 10 * 60,
159 delay: float = 30,159 delay: float = 30,
160) -> None:160) -> api.Machine:
161 """Blocks execution until machine reaches given status."""161 """Blocks execution until machine reaches given status."""
162 for retry_info in retries(timeout, delay):162 for retry_info in retries(timeout, delay):
163 tmp_machine = api_client.read_machine(machine)163 tmp_machine = api_client.read_machine(machine)
164 current_status = tmp_machine["status_name"]164 current_status = tmp_machine["status_name"]
165 if current_status == status:165 if current_status == status:
166 return166 return tmp_machine
167 else:167 else:
168 # Deliberately overwrite this variable so the last one is kept168 # Deliberately overwrite this variable so the last one is kept
169 events = debug_last_events(api_client, machine["system_id"])169 events = debug_last_events(api_client, machine["system_id"])

Subscribers

People subscribed via source and target branches

to all changes: