Skip to content

Commit 1176faf

Browse files
committed
chore: drop uses of test_microvm_with_initrd
Use the more common test_microvm_with_api Signed-off-by: Pablo Barbáchano <[email protected]>
1 parent 734696f commit 1176faf

File tree

1 file changed

+21
-23
lines changed

1 file changed

+21
-23
lines changed

tests/integration_tests/security/test_jail.py

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
# SPDX-License-Identifier: Apache-2.0
33
"""Tests that verify the jailer's behavior."""
4+
5+
# pylint: disable=redefined-outer-name
6+
47
import functools
58
import http.client as http_client
69
import os
@@ -139,11 +142,11 @@ def test_exec_file_not_exist(test_microvm_with_api, tmp_path):
139142
test_microvm.spawn()
140143

141144

142-
def test_default_chroot_hierarchy(test_microvm_with_initrd):
145+
def test_default_chroot_hierarchy(test_microvm_with_api):
143146
"""
144147
Test the folder hierarchy created by default by the jailer.
145148
"""
146-
test_microvm = test_microvm_with_initrd
149+
test_microvm = test_microvm_with_api
147150

148151
test_microvm.spawn()
149152

@@ -190,11 +193,11 @@ def test_default_chroot_hierarchy(test_microvm_with_initrd):
190193
)
191194

192195

193-
def test_arbitrary_usocket_location(test_microvm_with_initrd):
196+
def test_arbitrary_usocket_location(test_microvm_with_api):
194197
"""
195198
Test arbitrary location scenario for the api socket.
196199
"""
197-
test_microvm = test_microvm_with_initrd
200+
test_microvm = test_microvm_with_api
198201
test_microvm.jailer.extra_args = {"api-sock": "api.socket"}
199202

200203
test_microvm.spawn()
@@ -352,12 +355,11 @@ def check_limits(pid, no_file, fsize):
352355
assert hard == fsize
353356

354357

355-
def test_cgroups(test_microvm_with_initrd, sys_setup_cgroups):
358+
def test_cgroups(test_microvm_with_api, sys_setup_cgroups):
356359
"""
357360
Test the cgroups are correctly set by the jailer.
358361
"""
359-
# pylint: disable=redefined-outer-name
360-
test_microvm = test_microvm_with_initrd
362+
test_microvm = test_microvm_with_api
361363
test_microvm.jailer.cgroup_ver = sys_setup_cgroups
362364
if test_microvm.jailer.cgroup_ver == 2:
363365
test_microvm.jailer.cgroups = ["cpu.weight.nice=10"]
@@ -389,12 +391,11 @@ def test_cgroups(test_microvm_with_initrd, sys_setup_cgroups):
389391
)
390392

391393

392-
def test_cgroups_custom_parent(test_microvm_with_initrd, sys_setup_cgroups):
394+
def test_cgroups_custom_parent(test_microvm_with_api, sys_setup_cgroups):
393395
"""
394396
Test cgroups when a custom parent cgroup is used.
395397
"""
396-
# pylint: disable=redefined-outer-name
397-
test_microvm = test_microvm_with_initrd
398+
test_microvm = test_microvm_with_api
398399
test_microvm.jailer.cgroup_ver = sys_setup_cgroups
399400
test_microvm.jailer.parent_cgroup = "custom_cgroup/group2"
400401
if test_microvm.jailer.cgroup_ver == 2:
@@ -432,12 +433,11 @@ def test_cgroups_custom_parent(test_microvm_with_initrd, sys_setup_cgroups):
432433
)
433434

434435

435-
def test_node_cgroups(test_microvm_with_initrd, sys_setup_cgroups):
436+
def test_node_cgroups(test_microvm_with_api, sys_setup_cgroups):
436437
"""
437438
Test the numa node cgroups are correctly set by the jailer.
438439
"""
439-
# pylint: disable=redefined-outer-name
440-
test_microvm = test_microvm_with_initrd
440+
test_microvm = test_microvm_with_api
441441
test_microvm.jailer.cgroup_ver = sys_setup_cgroups
442442

443443
# Retrieve CPUs from NUMA node 0.
@@ -462,12 +462,11 @@ def test_node_cgroups(test_microvm_with_initrd, sys_setup_cgroups):
462462
)
463463

464464

465-
def test_cgroups_without_numa(test_microvm_with_initrd, sys_setup_cgroups):
465+
def test_cgroups_without_numa(test_microvm_with_api, sys_setup_cgroups):
466466
"""
467467
Test the cgroups are correctly set by the jailer, without numa assignment.
468468
"""
469-
# pylint: disable=redefined-outer-name
470-
test_microvm = test_microvm_with_initrd
469+
test_microvm = test_microvm_with_api
471470
test_microvm.jailer.cgroup_ver = sys_setup_cgroups
472471
if test_microvm.jailer.cgroup_ver == 2:
473472
test_microvm.jailer.cgroups = ["cpu.weight=2"]
@@ -494,12 +493,11 @@ def test_cgroups_without_numa(test_microvm_with_initrd, sys_setup_cgroups):
494493
cgroup_v2_available() is True, reason="Requires system with cgroup-v1 enabled."
495494
)
496495
@pytest.mark.usefixtures("sys_setup_cgroups")
497-
def test_v1_default_cgroups(test_microvm_with_initrd):
496+
def test_v1_default_cgroups(test_microvm_with_api):
498497
"""
499498
Test if the jailer is using cgroup-v1 by default.
500499
"""
501-
# pylint: disable=redefined-outer-name
502-
test_microvm = test_microvm_with_initrd
500+
test_microvm = test_microvm_with_api
503501
test_microvm.jailer.cgroups = ["cpu.shares=2"]
504502

505503
test_microvm.spawn()
@@ -513,11 +511,11 @@ def test_v1_default_cgroups(test_microvm_with_initrd):
513511
)
514512

515513

516-
def test_args_default_resource_limits(test_microvm_with_initrd):
514+
def test_args_default_resource_limits(test_microvm_with_api):
517515
"""
518516
Test the default resource limits are correctly set by the jailer.
519517
"""
520-
test_microvm = test_microvm_with_initrd
518+
test_microvm = test_microvm_with_api
521519

522520
test_microvm.spawn()
523521

@@ -538,11 +536,11 @@ def test_args_default_resource_limits(test_microvm_with_initrd):
538536
assert hard == -1
539537

540538

541-
def test_args_resource_limits(test_microvm_with_initrd):
539+
def test_args_resource_limits(test_microvm_with_api):
542540
"""
543541
Test the resource limits are correctly set by the jailer.
544542
"""
545-
test_microvm = test_microvm_with_initrd
543+
test_microvm = test_microvm_with_api
546544
test_microvm.jailer.resource_limits = RESOURCE_LIMITS
547545

548546
test_microvm.spawn()

0 commit comments

Comments
 (0)