Skip to content

Commit 8d59ab2

Browse files
pb8oJonathanWoollett-Light
authored andcommitted
fix(test/balloon): remove racy checks
Those negative checks depend on how slow the balloon device activates. If it activates fast, the checks fail. One of the checks is already done in unit tests. The other check we don't have an equivalent for, but the use case should be rare enough to not matter (configuring a balloon, starting the VM and checking that replacing it fails). We continute testing that the balloon can be replaced after it is activated. Signed-off-by: Pablo Barbáchano <[email protected]>
1 parent 0c3ca2c commit 8d59ab2

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

src/vmm/src/devices/virtio/balloon/device.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1132,10 +1132,15 @@ pub(crate) mod tests {
11321132
}
11331133

11341134
#[test]
1135-
fn test_num_pages() {
1135+
fn test_cannot_update_inactive_device() {
11361136
let mut balloon = Balloon::new(0, true, 0, false).unwrap();
11371137
// Assert that we can't update an inactive device.
11381138
balloon.update_size(1).unwrap_err();
1139+
}
1140+
1141+
#[test]
1142+
fn test_num_pages() {
1143+
let mut balloon = Balloon::new(0, true, 0, false).unwrap();
11391144
// Switch the state to active.
11401145
balloon.device_state = DeviceState::Activated(single_region_mem(0x1));
11411146

tests/integration_tests/functional/test_api.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,16 +1056,6 @@ def test_api_balloon(uvm_nano):
10561056
# Start the microvm.
10571057
test_microvm.start()
10581058

1059-
# Updating should fail as driver didn't have time to initialize.
1060-
with pytest.raises(RuntimeError):
1061-
test_microvm.api.balloon.patch(amount_mib=4)
1062-
1063-
# Overwriting the existing device should give an error now.
1064-
with pytest.raises(RuntimeError):
1065-
test_microvm.api.balloon.put(
1066-
amount_mib=3, deflate_on_oom=False, stats_polling_interval_s=3
1067-
)
1068-
10691059
# Give the balloon driver time to initialize.
10701060
# 500 ms is the maximum acceptable boot time.
10711061
time.sleep(0.5)

0 commit comments

Comments
 (0)