Skip to content

Commit 2ce3357

Browse files
committed
integration: added root requires
This is in preperation of allowing us to run the integration test suite on rootless containers. Signed-off-by: Aleksa Sarai <[email protected]>
1 parent d04cbc4 commit 2ce3357

File tree

6 files changed

+28
-6
lines changed

6 files changed

+28
-6
lines changed

tests/integration/cgroups.bats

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ function check_cgroup_value() {
2828
}
2929

3030
@test "runc update --kernel-memory (initialized)" {
31-
requires cgroups_kmem
31+
# XXX: currently cgroups require root containers.
32+
requires cgroups_kmem root
33+
3234
# Add cgroup path
3335
sed -i 's/\("linux": {\)/\1\n "cgroupsPath": "\/runc-cgroups-integration-test",/' ${BUSYBOX_BUNDLE}/config.json
3436

@@ -56,7 +58,9 @@ EOF
5658
}
5759

5860
@test "runc update --kernel-memory (uninitialized)" {
59-
requires cgroups_kmem
61+
# XXX: currently cgroups require root containers.
62+
requires cgroups_kmem root
63+
6064
# Add cgroup path
6165
sed -i 's/\("linux": {\)/\1\n "cgroupsPath": "\/runc-cgroups-integration-test",/' ${BUSYBOX_BUNDLE}/config.json
6266

tests/integration/checkpoint.bats

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ function teardown() {
1212
}
1313

1414
@test "checkpoint and restore" {
15-
requires criu
15+
# XXX: currently criu require root containers.
16+
requires criu root
1617

1718
# criu does not work with external terminals so..
1819
# setting terminal and root:readonly: to false

tests/integration/helpers.bash

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ CGROUP_CPU_BASE_PATH=$(grep "cgroup" /proc/self/mountinfo | gawk 'toupper($NF) ~
4040
KMEM="${CGROUP_MEMORY_BASE_PATH}/memory.kmem.limit_in_bytes"
4141
RT_PERIOD="${CGROUP_CPU_BASE_PATH}/cpu.rt_period_us"
4242

43+
# Check if we're in rootless mode.
44+
ROOTLESS=$(id -u)
45+
4346
# Wrapper for runc.
4447
function runc() {
4548
run __runc "$@"
@@ -68,7 +71,12 @@ function requires() {
6871
case $var in
6972
criu)
7073
if [ ! -e "$CRIU" ]; then
71-
skip "Test requires ${var}."
74+
skip "test requires ${var}"
75+
fi
76+
;;
77+
root)
78+
if [ "$ROOTLESS" -ne 0 ]; then
79+
skip "test requires ${var}"
7280
fi
7381
;;
7482
cgroups_kmem)

tests/integration/kill.bats

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ function teardown() {
1313

1414

1515
@test "kill detached busybox" {
16-
1716
# run busybox detached
1817
runc run -d --console-socket $CONSOLE_SOCKET test_busybox
1918
[ "$status" -eq 0 ]

tests/integration/pause.bats

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ function teardown() {
1212
}
1313

1414
@test "runc pause and resume" {
15+
# XXX: currently cgroups require root containers.
16+
requires root
17+
1518
# run busybox detached
1619
runc run -d --console-socket $CONSOLE_SOCKET test_busybox
1720
[ "$status" -eq 0 ]
@@ -34,6 +37,9 @@ function teardown() {
3437
}
3538

3639
@test "runc pause and resume with nonexist container" {
40+
# XXX: currently cgroups require root containers.
41+
requires root
42+
3743
# run test_busybox detached
3844
runc run -d --console-socket $CONSOLE_SOCKET test_busybox
3945
[ "$status" -eq 0 ]

tests/integration/update.bats

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ function check_cgroup_value() {
5050

5151
# TODO: test rt cgroup updating
5252
@test "update" {
53-
requires cgroups_kmem
53+
# XXX: currently cgroups require root containers.
54+
# XXX: Also, this test should be split into separate sections so that we
55+
# can skip kmem without skipping update tests overall.
56+
requires cgroups_kmem root
57+
5458
# run a few busyboxes detached
5559
runc run -d --console-socket $CONSOLE_SOCKET test_update
5660
[ "$status" -eq 0 ]

0 commit comments

Comments
 (0)