Skip to content

Commit d1badbb

Browse files
roypatzulinx86
authored andcommitted
do not fail balloon test if deflate_oom is false and guest crashes
If we set deflate_on_oom to False, and then induce an out of memory condition, then we're really only testing how well the guest can handle oom conditions. Do not fail the test if the guest responds to OOM by shutting down though. Signed-off-by: Patrick Roy <[email protected]>
1 parent 561068a commit d1badbb

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

tests/integration_tests/functional/test_balloon.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,20 @@ def test_deflate_on_oom(uvm_plain_any, deflate_on_oom):
207207
balloon_size_before = test_microvm.api.balloon_stats.get().json()["actual_mib"]
208208
make_guest_dirty_memory(test_microvm.ssh, 128)
209209

210-
balloon_size_after = test_microvm.api.balloon_stats.get().json()["actual_mib"]
211-
print(f"size before: {balloon_size_before} size after: {balloon_size_after}")
212-
if deflate_on_oom:
213-
assert balloon_size_after < balloon_size_before, "Balloon did not deflate"
210+
try:
211+
balloon_size_after = test_microvm.api.balloon_stats.get().json()["actual_mib"]
212+
except ConnectionError:
213+
assert (
214+
not deflate_on_oom
215+
), "Guest died even though it should have deflated balloon to alleviate memory pressure"
216+
217+
test_microvm.mark_killed()
214218
else:
215-
assert balloon_size_after >= balloon_size_before, "Balloon deflated"
219+
print(f"size before: {balloon_size_before} size after: {balloon_size_after}")
220+
if deflate_on_oom:
221+
assert balloon_size_after < balloon_size_before, "Balloon did not deflate"
222+
else:
223+
assert balloon_size_after >= balloon_size_before, "Balloon deflated"
216224

217225

218226
# pylint: disable=C0103

0 commit comments

Comments
 (0)