Skip to content

Commit cb4349d

Browse files
committed
fix(test): split post-snapshot checks for steal time test
test_pvmtime_snapshot checks that steal time reporting mechanism works on snapshotted microVMs. This includes two checks; first that the old steal time values are saved and restored correctly through snapshots and second that steal time keeps increasing in microVMs resumed from a snapshot. The test fails intermittently, but we are not sure which of the two invariants causes it to fail because we are checking both in the same assertion. Split this assertion in two so that we understand better the culprit. Signed-off-by: Babis Chalios <[email protected]>
1 parent 4ed5ccc commit cb4349d

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

tests/integration_tests/functional/test_steal_time.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,17 @@ def test_pvtime_snapshot(uvm_plain, microvm_factory):
104104
# Steal time just after restoring
105105
steal_after_snap = get_steal_time_ms(restored_vm)
106106

107-
time.sleep(2)
108-
109-
# Steal time after running resumed VM
110-
steal_after_resume = get_steal_time_ms(restored_vm)
111-
112-
# Ensure steal time persisted and continued increasing
107+
# Ensure steal time persisted
113108
tolerance = 10000 # 10.0 seconds tolerance for persistence check
114109
persisted = (
115110
steal_before < steal_after_snap and steal_after_snap - steal_before < tolerance
116111
)
117-
increased = steal_after_resume > steal_after_snap
112+
assert persisted, "Steal time did not persist through snapshot"
118113

119-
assert (
120-
persisted and increased
121-
), "Steal time did not persist through snapshot or failed to increase after resume"
114+
time.sleep(2)
115+
116+
# Steal time after running resumed VM
117+
steal_after_resume = get_steal_time_ms(restored_vm)
118+
119+
# Ensure steal time continued increasing
120+
assert steal_after_resume > steal_after_snap, "Steal time failed to increase after resume"

0 commit comments

Comments
 (0)