Skip to content

Commit 3f3190c

Browse files
committed
fix(test): wait for microVM to boot before snapshotting
In test_vulnerabilities.py we have various tests that check whether a condition holds after resuming from a snapshot. These checks seem to consistently fail if we take a snapshot before letting the guest kernel boot. Introduce an ssh command to ensure that the guest has booted before taking the snapshot so that we avoid the issue. Signed-off-by: Babis Chalios <[email protected]>
1 parent b1c2ef7 commit 3f3190c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/integration_tests/security/test_vulnerabilities.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def configure_microvm(
5959
else:
6060
microvm = factory.build(kernel, rootfs)
6161

62+
microvm.help.enable_console()
6263
microvm.spawn()
6364
microvm.basic_config(vcpu_count=2, mem_size_mib=256, cpu_template=cpu_template)
6465
if custom_cpu_template:
@@ -122,6 +123,9 @@ def with_restore(factory, microvm_factory):
122123

123124
def restore(firecracker=None, jailer=None):
124125
microvm = factory(firecracker, jailer)
126+
# Ensure that we have booted before getting the snapshot.
127+
rc, _, stderr = microvm.ssh.run("true")
128+
assert rc == 0, stderr
125129
snapshot = microvm.snapshot_full()
126130

127131
if firecracker:

0 commit comments

Comments
 (0)