Skip to content

Commit 6be6cae

Browse files
bchaliosroypat
authored andcommitted
test: mark killed microvm not spawned
Mark killed microVMs as not spawned, so that we don't try to kill them twice. This avoids the spam we get in the CI that we are trying to kill a non-existing PID. Also, clear the list of microVMs stored by MicroVMFactory once we call kill() on it. Signed-off-by: Babis Chalios <[email protected]>
1 parent c47627b commit 6be6cae

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests/framework/microvm.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,9 @@ def kill(self):
252252
self.expect_kill_by_signal = True
253253
utils.run_cmd("kill -9 {} || true".format(self.screen_pid))
254254

255+
# Mark the microVM as not spawned, so we avoid trying to kill twice.
256+
self._spawned = False
257+
255258
if self.time_api_requests:
256259
self._validate_api_response_times()
257260

@@ -911,6 +914,8 @@ def kill(self):
911914
shutil.rmtree(vm.jailer.chroot_base_with_id())
912915
vm.netns.cleanup()
913916

917+
self.vms.clear()
918+
914919

915920
class Serial:
916921
"""Class for serial console communication with a Microvm."""

0 commit comments

Comments
 (0)