Skip to content

Commit

Permalink
test(jailer): removed test_negative_file_size_limit
Browse files Browse the repository at this point in the history
Removed `test_negative_file_size_limit` because
now FC is creating files during its initialization
(memfd serves as a guest memory).

Signed-off-by: Egor Lazarchuk <[email protected]>
  • Loading branch information
ShadowCurse committed Oct 10, 2023
1 parent 9f5fc33 commit ff75106
Showing 1 changed file with 0 additions and 41 deletions.
41 changes: 0 additions & 41 deletions tests/integration_tests/security/test_jail.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,12 @@
# pylint: disable=redefined-outer-name

import functools
import http.client as http_client
import os
import resource
import stat
import subprocess
import time

import psutil
import pytest
import requests
import urllib3

import host_tools.cargo_build as build_tools
from framework.defs import FC_BINARY_NAME
Expand Down Expand Up @@ -514,42 +509,6 @@ def test_args_resource_limits(test_microvm_with_api):
check_limits(pid, NOFILE, FSIZE)


def test_negative_file_size_limit(uvm_plain):
"""
Test creating snapshot file fails when size exceeds `fsize` limit.
"""
test_microvm = uvm_plain
# limit to 1MB, to account for logs and metrics
test_microvm.jailer.resource_limits = [f"fsize={2**20}"]
test_microvm.spawn()
test_microvm.basic_config()
test_microvm.start()

test_microvm.pause()

# Attempt to create a snapshot.
try:
test_microvm.api.snapshot_create.put(
mem_file_path="/vm.mem",
snapshot_path="/vm.vmstate",
)
except (
http_client.RemoteDisconnected,
urllib3.exceptions.ProtocolError,
requests.exceptions.ConnectionError,
) as _error:
test_microvm.expect_kill_by_signal = True
# Check the microVM received signal `SIGXFSZ` (25),
# which corresponds to exceeding file size limit.
msg = "Shutting down VM after intercepting signal 25, code 0"
test_microvm.check_log_message(msg)
time.sleep(1)
# Check that the process was terminated.
assert not psutil.pid_exists(test_microvm.jailer_clone_pid)
else:
assert False, "Negative test failed"


def test_negative_no_file_limit(test_microvm_with_api):
"""
Test microVM is killed when exceeding `no-file` limit.
Expand Down

0 comments on commit ff75106

Please sign in to comment.