Skip to content

Commit 43c4ebc

Browse files
committed
test(jailer): adjust file size limit test for anon mapping
This brings the former negative file size limit test from before 60737eb , which is valid for anon private guest memory backing. Signed-off-by: Nikita Kalyazin <[email protected]>
1 parent 7ef5db9 commit 43c4ebc

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

tests/integration_tests/security/test_jail.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -489,21 +489,23 @@ def test_positive_file_size_limit(uvm_plain):
489489

490490
def test_negative_file_size_limit(uvm_plain):
491491
"""
492-
Test creating vm fails when memory size exceeds `fsize` limit.
493-
This is caused by the fact that we back guest memory by memfd.
492+
Test creating snapshot file fails when size exceeds `fsize` limit.
494493
"""
495-
496-
vm_mem_size = 128
497-
jail_limit = (vm_mem_size - 1) << 20
498-
499494
test_microvm = uvm_plain
500-
test_microvm.jailer.resource_limits = [f"fsize={jail_limit}"]
495+
# limit to 1MB, to account for logs and metrics
496+
test_microvm.jailer.resource_limits = [f"fsize={2**20}"]
501497
test_microvm.spawn()
502-
test_microvm.basic_config(mem_size_mib=vm_mem_size)
498+
test_microvm.basic_config()
499+
test_microvm.start()
503500

504-
# Attempt to start a vm.
501+
test_microvm.pause()
502+
503+
# Attempt to create a snapshot.
505504
try:
506-
test_microvm.start()
505+
test_microvm.api.snapshot_create.put(
506+
mem_file_path="/vm.mem",
507+
snapshot_path="/vm.vmstate",
508+
)
507509
except (
508510
http_client.RemoteDisconnected,
509511
urllib3.exceptions.ProtocolError,

0 commit comments

Comments
 (0)