Skip to content

Commit f58420b

Browse files
committed
test: fix false positive in Microvm.kill check for correct pid
In Microvm.kill() we have a sanity check for ensuring the firecracker process wrote the correct pid to its pidfile: We ps | grep for the jailer id of the supposedly dead firecracker process and see if any process that has "fircracker" somewhere in its argv is using it (with the somewhat reasonable assumption that this would be exactly the firecracker process we just tried to kill). Howver, if the firecracker process isnt daemonized, then we spawn it under `screen`, and now we have two processes that contain both the jailer id and the name "firecracker" in its argv, because screen fork()s into firecracker in this case. Now if we kill firecracker, screen might stick around a bit longer (because we only explicitly wait for firecracker to terminate), and the sanity check might incorrectly pick up the screen process as a firecracker process and cause a spurious test failure. Fix this by having the check explicitly ignore all screen processes. Signed-off-by: Patrick Roy <[email protected]>
1 parent dc21c45 commit f58420b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tests/framework/microvm.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,8 @@ def kill(self):
339339

340340
offenders = []
341341
for proc in stdout.splitlines():
342-
if "firecracker" in proc:
342+
_, cmd = proc.lower().split(maxsplit=1)
343+
if "firecracker" in proc and not cmd.startswith("screen"):
343344
offenders.append(proc)
344345

345346
# make sure firecracker was killed

0 commit comments

Comments
 (0)