Skip to content

Commit 55a84be

Browse files
committed
fix(test): split post-snapshot checks for steal time test
test_pvtime_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 9fb5a46 commit 55a84be

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

tests/integration_tests/functional/test_steal_time.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,19 @@ 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"
113+
114+
time.sleep(2)
115+
116+
# Steal time after running resumed VM
117+
steal_after_resume = get_steal_time_ms(restored_vm)
118118

119+
# Ensure steal time continued increasing
119120
assert (
120-
persisted and increased
121-
), "Steal time did not persist through snapshot or failed to increase after resume"
121+
steal_after_resume > steal_after_snap
122+
), "Steal time failed to increase after resume"

0 commit comments

Comments
 (0)