mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
Merge pull request #4945 from kolyshkin/int-cleanup-part1
tests/int: cleanup
This commit is contained in:
@@ -10,7 +10,9 @@ to end.
|
||||
|
||||
Integration tests are written in *bash* using the
|
||||
[bats (Bash Automated Testing System)](https://github.com/bats-core/bats-core)
|
||||
framework.
|
||||
framework. Please see
|
||||
[bats documentation](https://bats-core.readthedocs.io/en/stable/index.html)
|
||||
for more details.
|
||||
|
||||
## Running integration tests
|
||||
|
||||
@@ -43,38 +45,9 @@ cd bats-core
|
||||
./install.sh /usr/local
|
||||
```
|
||||
|
||||
> **Note**: There are known issues running the integration tests using
|
||||
> **devicemapper** as a storage driver, make sure that your docker daemon
|
||||
> is using **aufs** if you want to successfully run the integration tests.
|
||||
|
||||
## Writing integration tests
|
||||
|
||||
[helper functions](https://github.com/opencontainers/runc/blob/master/tests/integration/helpers.bash)
|
||||
[Helper functions](https://github.com/opencontainers/runc/blob/master/tests/integration/helpers.bash)
|
||||
are provided in order to facilitate writing tests.
|
||||
|
||||
```sh
|
||||
#!/usr/bin/env bats
|
||||
|
||||
# This will load the helpers.
|
||||
load helpers
|
||||
|
||||
# setup is called at the beginning of every test.
|
||||
function setup() {
|
||||
setup_busybox
|
||||
}
|
||||
|
||||
# teardown is called at the end of every test.
|
||||
function teardown() {
|
||||
teardown_bundle
|
||||
}
|
||||
|
||||
@test "this is a simple test" {
|
||||
runc run containerid
|
||||
# "The runc macro" automatically populates $status, $output and $lines.
|
||||
# Please refer to bats documentation to find out more.
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# check expected output
|
||||
[[ "${output}" == *"Hello"* ]]
|
||||
}
|
||||
```
|
||||
Please see existing tests for examples.
|
||||
|
||||
@@ -113,11 +113,15 @@ function setup() {
|
||||
[[ ${lines[0]} = "0::/foo" ]]
|
||||
|
||||
# teardown: remove "/foo"
|
||||
# shellcheck disable=SC2016
|
||||
runc exec test_cgroups_group sh -uxc 'echo -memory > /sys/fs/cgroup/cgroup.subtree_control; for f in $(cat /sys/fs/cgroup/foo/cgroup.procs); do echo $f > /sys/fs/cgroup/cgroup.procs; done; rmdir /sys/fs/cgroup/foo'
|
||||
cat <<'EOF' | runc exec test_cgroups_group sh -eux
|
||||
echo -memory > /sys/fs/cgroup/cgroup.subtree_control
|
||||
for pid in $(cat /sys/fs/cgroup/foo/cgroup.procs); do
|
||||
echo $pid > /sys/fs/cgroup/cgroup.procs || true
|
||||
done
|
||||
rmdir /sys/fs/cgroup/foo
|
||||
EOF
|
||||
runc exec test_cgroups_group test ! -d /sys/fs/cgroup/foo
|
||||
[ "$status" -eq 0 ]
|
||||
#
|
||||
}
|
||||
|
||||
@test "runc run (cgroup v1 + unified resources should fail)" {
|
||||
@@ -490,7 +494,7 @@ convert_hugetlb_size() {
|
||||
runc resume ct1
|
||||
) &
|
||||
|
||||
# Exec should not timeout or succeed.
|
||||
# Exec should succeed (once the container is resumed).
|
||||
runc exec --ignore-paused ct1 echo ok
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "ok" ]
|
||||
|
||||
@@ -126,18 +126,14 @@ function simple_cr() {
|
||||
testcontainer test_busybox running
|
||||
|
||||
for _ in $(seq 2); do
|
||||
# checkpoint the running container
|
||||
runc "$@" checkpoint --work-path ./work-dir test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# after checkpoint busybox is no longer running
|
||||
testcontainer test_busybox checkpointed
|
||||
|
||||
# restore from checkpoint
|
||||
runc "$@" restore -d --work-path ./work-dir --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# busybox should be back up and running
|
||||
testcontainer test_busybox running
|
||||
done
|
||||
}
|
||||
@@ -160,27 +156,23 @@ function simple_cr_with_netdevice() {
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
testcontainer test_busybox_netdevice running
|
||||
run runc exec test_busybox_netdevice ip address show dev dummy0
|
||||
runc exec test_busybox_netdevice ip address show dev dummy0
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *" $global_ip "* ]]
|
||||
[[ "$output" == *"ether $mac_address "* ]]
|
||||
[[ "$output" == *"mtu $mtu_value "* ]]
|
||||
|
||||
for _ in $(seq 2); do
|
||||
# checkpoint the running container
|
||||
runc "$@" checkpoint --work-path ./work-dir test_busybox_netdevice
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# after checkpoint busybox is no longer running
|
||||
testcontainer test_busybox_netdevice checkpointed
|
||||
|
||||
# restore from checkpoint
|
||||
runc "$@" restore -d --work-path ./work-dir --console-socket "$CONSOLE_SOCKET" test_busybox_netdevice
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# busybox should be back up and running
|
||||
testcontainer test_busybox_netdevice running
|
||||
run runc exec test_busybox_netdevice ip address show dev dummy0
|
||||
runc exec test_busybox_netdevice ip address show dev dummy0
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *" $global_ip "* ]]
|
||||
[[ "$output" == *"ether $mac_address "* ]]
|
||||
@@ -271,15 +263,12 @@ function simple_cr_with_netdevice() {
|
||||
setup_pipes
|
||||
runc_run_with_pipes test_busybox
|
||||
|
||||
#test checkpoint pre-dump
|
||||
mkdir parent-dir
|
||||
runc checkpoint --pre-dump --image-path ./parent-dir test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# busybox should still be running
|
||||
testcontainer test_busybox running
|
||||
|
||||
# checkpoint the running container
|
||||
mkdir image-dir
|
||||
mkdir work-dir
|
||||
runc checkpoint --parent-path ../parent-dir --work-path ./work-dir --image-path ./image-dir test_busybox
|
||||
@@ -288,7 +277,6 @@ function simple_cr_with_netdevice() {
|
||||
# check parent path is valid
|
||||
[ -e ./image-dir/parent ]
|
||||
|
||||
# after checkpoint busybox is no longer running
|
||||
testcontainer test_busybox checkpointed
|
||||
|
||||
runc_restore_with_pipes ./work-dir test_busybox
|
||||
@@ -302,7 +290,6 @@ function simple_cr_with_netdevice() {
|
||||
setup_pipes
|
||||
runc_run_with_pipes test_busybox
|
||||
|
||||
# checkpoint the running container
|
||||
mkdir image-dir
|
||||
mkdir work-dir
|
||||
|
||||
@@ -391,14 +378,12 @@ function simple_cr_with_netdevice() {
|
||||
runc checkpoint --work-path ./work-dir test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# after checkpoint busybox is no longer running
|
||||
testcontainer test_busybox checkpointed
|
||||
|
||||
# restore from checkpoint; this should restore the container into the existing network namespace
|
||||
runc restore -d --work-path ./work-dir --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# busybox should be back up and running
|
||||
testcontainer test_busybox running
|
||||
|
||||
# container should be running in same network namespace as before
|
||||
@@ -436,23 +421,20 @@ function simple_cr_with_netdevice() {
|
||||
|
||||
testcontainer test_busybox running
|
||||
|
||||
# checkpoint the running container
|
||||
runc checkpoint --work-path ./work-dir test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
run ! test -f ./work-dir/"$tmplog1"
|
||||
test -f ./work-dir/"$tmplog2"
|
||||
|
||||
# after checkpoint busybox is no longer running
|
||||
testcontainer test_busybox checkpointed
|
||||
|
||||
test -f ./work-dir/"$tmplog2" && unlink ./work-dir/"$tmplog2"
|
||||
# restore from checkpoint
|
||||
|
||||
runc restore -d --work-path ./work-dir --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
run ! test -f ./work-dir/"$tmplog1"
|
||||
test -f ./work-dir/"$tmplog2"
|
||||
|
||||
# busybox should be back up and running
|
||||
testcontainer test_busybox running
|
||||
unlink "$tmp"
|
||||
test -f ./work-dir/"$tmplog2" && unlink ./work-dir/"$tmplog2"
|
||||
@@ -479,22 +461,18 @@ function simple_cr_with_netdevice() {
|
||||
|
||||
testcontainer test_busybox running
|
||||
|
||||
# checkpoint the running container
|
||||
runc checkpoint --work-path ./work-dir test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# after checkpoint busybox is no longer running
|
||||
testcontainer test_busybox checkpointed
|
||||
|
||||
# cleanup mountpoints created by runc during creation
|
||||
# the mountpoints should be recreated during restore - that is the actual thing tested here
|
||||
rm -rf "${bind1:?}"/*
|
||||
|
||||
# restore from checkpoint
|
||||
runc restore -d --work-path ./work-dir --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# busybox should be back up and running
|
||||
testcontainer test_busybox running
|
||||
}
|
||||
|
||||
@@ -545,18 +523,14 @@ function simple_cr_with_netdevice() {
|
||||
|
||||
local execed_pid=""
|
||||
for _ in $(seq 2); do
|
||||
# checkpoint the running container
|
||||
runc checkpoint --work-path ./work-dir test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# after checkpoint busybox is no longer running
|
||||
testcontainer test_busybox checkpointed
|
||||
|
||||
# restore from checkpoint
|
||||
runc restore -d --work-path ./work-dir --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# busybox should be back up and running
|
||||
testcontainer test_busybox running
|
||||
|
||||
# verify that previously exec'd process is restored.
|
||||
|
||||
@@ -16,7 +16,6 @@ function teardown() {
|
||||
|
||||
testcontainer test_busybox created
|
||||
|
||||
# start the command
|
||||
runc start test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
@@ -34,7 +33,6 @@ function teardown() {
|
||||
|
||||
testcontainer test_busybox created
|
||||
|
||||
# start the command
|
||||
runc start test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
@@ -47,12 +45,9 @@ function teardown() {
|
||||
|
||||
testcontainer test_busybox created
|
||||
|
||||
# check pid.txt was generated
|
||||
[ -e pid.txt ]
|
||||
|
||||
[[ $(cat pid.txt) = $(__runc state test_busybox | jq '.pid') ]]
|
||||
|
||||
# start the command
|
||||
runc start test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
@@ -61,7 +56,6 @@ function teardown() {
|
||||
|
||||
@test "runc create --pid-file with new CWD" {
|
||||
bundle="$(pwd)"
|
||||
# create pid_file directory as the CWD
|
||||
mkdir pid_file
|
||||
cd pid_file
|
||||
|
||||
@@ -70,12 +64,9 @@ function teardown() {
|
||||
|
||||
testcontainer test_busybox created
|
||||
|
||||
# check pid.txt was generated
|
||||
[ -e pid.txt ]
|
||||
|
||||
[[ $(cat pid.txt) = $(__runc state test_busybox | jq '.pid') ]]
|
||||
|
||||
# start the command
|
||||
runc start test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ function check_debug() {
|
||||
}
|
||||
|
||||
@test "global --debug" {
|
||||
# run hello-world
|
||||
runc --debug run test_hello
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
@@ -28,7 +27,6 @@ function check_debug() {
|
||||
}
|
||||
|
||||
@test "global --debug to --log" {
|
||||
# run hello-world
|
||||
runc --log log.out --debug run test_hello
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
@@ -43,7 +41,6 @@ function check_debug() {
|
||||
}
|
||||
|
||||
@test "global --debug to --log --log-format 'text'" {
|
||||
# run hello-world
|
||||
runc --log log.out --log-format "text" --debug run test_hello
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
@@ -58,7 +55,6 @@ function check_debug() {
|
||||
}
|
||||
|
||||
@test "global --debug to --log --log-format 'json'" {
|
||||
# run hello-world
|
||||
runc --log log.out --log-format "json" --debug run test_hello
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
|
||||
@@ -115,14 +115,11 @@ function test_runc_delete_host_pidns() {
|
||||
}
|
||||
|
||||
@test "runc delete --force" {
|
||||
# run busybox detached
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# check state
|
||||
testcontainer test_busybox running
|
||||
|
||||
# force delete test_busybox
|
||||
runc delete --force test_busybox
|
||||
|
||||
runc state test_busybox
|
||||
@@ -145,11 +142,19 @@ function test_runc_delete_host_pidns() {
|
||||
}
|
||||
|
||||
@test "runc delete --force [paused container]" {
|
||||
requires cgroups_freezer
|
||||
if [ $EUID -ne 0 ]; then
|
||||
requires rootless_cgroup
|
||||
# Rootless containers have no default cgroup path.
|
||||
set_cgroups_path
|
||||
fi
|
||||
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" ct1
|
||||
[ "$status" -eq 0 ]
|
||||
testcontainer ct1 running
|
||||
|
||||
runc pause ct1
|
||||
[ "$status" -eq 0 ]
|
||||
runc delete --force ct1
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
@@ -209,11 +214,9 @@ EOF
|
||||
set_cgroups_path
|
||||
set_cgroup_mount_writable
|
||||
|
||||
# run busybox detached
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# check state
|
||||
testcontainer test_busybox running
|
||||
|
||||
# create a sub process
|
||||
|
||||
@@ -47,7 +47,6 @@ function test_events() {
|
||||
[ $EUID -ne 0 ] && requires rootless_cgroup
|
||||
init_cgroup_paths
|
||||
|
||||
# run busybox detached
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
@@ -121,7 +120,6 @@ function test_events() {
|
||||
# we need the container to hit OOM, so disable swap
|
||||
update_config '(.. | select(.resources? != null)) .resources.memory |= {"limit": 33554432, "swap": 33554432}'
|
||||
|
||||
# run busybox detached
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ function teardown() {
|
||||
}
|
||||
|
||||
@test "runc exec" {
|
||||
# run busybox detached
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
@@ -42,7 +41,6 @@ function teardown() {
|
||||
}
|
||||
|
||||
@test "runc exec --pid-file" {
|
||||
# run busybox detached
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
@@ -51,9 +49,7 @@ function teardown() {
|
||||
echo text echoed = "'""${output}""'"
|
||||
[[ "${output}" == *"Hello from exec"* ]]
|
||||
|
||||
# check pid.txt was generated
|
||||
[ -e pid.txt ]
|
||||
|
||||
output=$(cat pid.txt)
|
||||
[[ "$output" =~ [0-9]+ ]]
|
||||
[[ "$output" != $(__runc state test_busybox | jq '.pid') ]]
|
||||
@@ -61,11 +57,9 @@ function teardown() {
|
||||
|
||||
@test "runc exec --pid-file with new CWD" {
|
||||
bundle="$(pwd)"
|
||||
# create pid_file directory as the CWD
|
||||
mkdir pid_file
|
||||
cd pid_file
|
||||
|
||||
# run busybox detached
|
||||
runc run -d -b "$bundle" --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
@@ -74,16 +68,13 @@ function teardown() {
|
||||
echo text echoed = "'""${output}""'"
|
||||
[[ "${output}" == *"Hello from exec"* ]]
|
||||
|
||||
# check pid.txt was generated
|
||||
[ -e pid.txt ]
|
||||
|
||||
output=$(cat pid.txt)
|
||||
[[ "$output" =~ [0-9]+ ]]
|
||||
[[ "$output" != $(__runc state test_busybox | jq '.pid') ]]
|
||||
}
|
||||
|
||||
@test "runc exec ls -la" {
|
||||
# run busybox detached
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
@@ -95,7 +86,6 @@ function teardown() {
|
||||
}
|
||||
|
||||
@test "runc exec ls -la with --cwd" {
|
||||
# run busybox detached
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
@@ -105,7 +95,6 @@ function teardown() {
|
||||
}
|
||||
|
||||
@test "runc exec --env" {
|
||||
# run busybox detached
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
@@ -119,7 +108,6 @@ function teardown() {
|
||||
# --user can't work in rootless containers that don't have idmap.
|
||||
[ $EUID -ne 0 ] && requires rootless_idmap
|
||||
|
||||
# run busybox detached
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
@@ -159,7 +147,6 @@ function teardown() {
|
||||
@test "runc exec --additional-gids" {
|
||||
requires root
|
||||
|
||||
# run busybox detached
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
@@ -171,7 +158,6 @@ function teardown() {
|
||||
}
|
||||
|
||||
@test "runc exec --preserve-fds" {
|
||||
# run busybox detached
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
|
||||
@@ -76,11 +76,9 @@ test_host_pidns_kill() {
|
||||
}
|
||||
|
||||
@test "kill detached busybox" {
|
||||
# run busybox detached
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# check state
|
||||
testcontainer test_busybox running
|
||||
|
||||
runc kill test_busybox KILL
|
||||
|
||||
@@ -16,7 +16,6 @@ function teardown() {
|
||||
|
||||
@test "list" {
|
||||
bundle=$(pwd)
|
||||
# run a few busyboxes detached
|
||||
ROOT=$ALT_ROOT runc run -d --console-socket "$CONSOLE_SOCKET" test_box1
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ function teardown() {
|
||||
}
|
||||
|
||||
@test "mask paths [file]" {
|
||||
# run busybox detached
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
@@ -36,7 +35,6 @@ function teardown() {
|
||||
}
|
||||
|
||||
@test "mask paths [directory]" {
|
||||
# run busybox detached
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
load helpers
|
||||
|
||||
function create_netns() {
|
||||
function setup_netns() {
|
||||
local tmp
|
||||
|
||||
# Create a temporary name for the test network namespace.
|
||||
tmp=$(mktemp -u)
|
||||
ns_name=$(basename "$tmp")
|
||||
@@ -10,6 +12,9 @@ function create_netns() {
|
||||
# Create the network namespace.
|
||||
ip netns add "$ns_name"
|
||||
ns_path=$(ip netns add "$ns_name" 2>&1 | sed -e 's/.*"\(.*\)".*/\1/')
|
||||
|
||||
# Tell runc to use it.
|
||||
update_config '(.. | select(.type? == "network")) .path |= "'"$ns_path"'"'
|
||||
}
|
||||
|
||||
function delete_netns() {
|
||||
@@ -40,10 +45,7 @@ function teardown() {
|
||||
}
|
||||
|
||||
@test "move network device to container network namespace and restore it back" {
|
||||
# Tell runc which network namespace to use.
|
||||
create_netns
|
||||
update_config '(.. | select(.type? == "network")) .path |= "'"$ns_path"'"'
|
||||
|
||||
setup_netns
|
||||
update_config ' .linux.netDevices |= {"dummy0": {} }'
|
||||
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
@@ -61,13 +63,10 @@ function teardown() {
|
||||
}
|
||||
|
||||
@test "move network device to precreated container network namespace" {
|
||||
setup_netns
|
||||
update_config ' .linux.netDevices |= {"dummy0": {} }
|
||||
| .process.args |= ["ip", "address", "show", "dev", "dummy0"]'
|
||||
|
||||
# Tell runc which network namespace to use.
|
||||
create_netns
|
||||
update_config '(.. | select(.type? == "network")) .path |= "'"$ns_path"'"'
|
||||
|
||||
runc run test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
@@ -76,13 +75,10 @@ function teardown() {
|
||||
}
|
||||
|
||||
@test "move network device to precreated container network namespace and set ip address with global scope" {
|
||||
setup_netns
|
||||
update_config ' .linux.netDevices |= {"dummy0": {} }
|
||||
| .process.args |= ["ip", "address", "show", "dev", "dummy0"]'
|
||||
|
||||
# Tell runc which network namespace to use.
|
||||
create_netns
|
||||
update_config '(.. | select(.type? == "network")) .path |= "'"$ns_path"'"'
|
||||
|
||||
global_ip="169.254.169.77/32"
|
||||
|
||||
# Set the interface down to avoid possible network problems.
|
||||
@@ -95,19 +91,15 @@ function teardown() {
|
||||
[[ "$output" == *"$global_ip "* ]]
|
||||
|
||||
# Verify the interface is still present in the network namespace.
|
||||
run ip netns exec "$ns_name" ip address show dev dummy0
|
||||
[ "$status" -eq 0 ]
|
||||
run -0 ip netns exec "$ns_name" ip address show dev dummy0
|
||||
[[ "$output" == *"$global_ip "* ]]
|
||||
}
|
||||
|
||||
@test "move network device to precreated container network namespace and set ip address without global scope" {
|
||||
setup_netns
|
||||
update_config ' .linux.netDevices |= {"dummy0": {} }
|
||||
| .process.args |= ["ip", "address", "show", "dev", "dummy0"]'
|
||||
|
||||
# Tell runc which network namespace to use.
|
||||
create_netns
|
||||
update_config '(.. | select(.type? == "network")) .path |= "'"$ns_path"'"'
|
||||
|
||||
non_global_ip="127.0.0.33"
|
||||
|
||||
# Set the interface down to avoid possible network problems.
|
||||
@@ -124,15 +116,12 @@ function teardown() {
|
||||
}
|
||||
|
||||
@test "move network device to precreated container network namespace and set mtu" {
|
||||
setup_netns
|
||||
update_config ' .linux.netDevices |= {"dummy0": {} }
|
||||
| .process.args |= ["ip", "address", "show", "dev", "dummy0"]'
|
||||
|
||||
# Tell runc which network namespace to use.
|
||||
create_netns
|
||||
update_config '(.. | select(.type? == "network")) .path |= "'"$ns_path"'"'
|
||||
|
||||
mtu_value=1789
|
||||
# Cet a custom mtu to the interface.
|
||||
# Set a custom mtu to the interface.
|
||||
ip link set mtu "$mtu_value" dev dummy0
|
||||
|
||||
runc run test_busybox
|
||||
@@ -140,19 +129,15 @@ function teardown() {
|
||||
[[ "$output" == *"mtu $mtu_value "* ]]
|
||||
|
||||
# Verify the interface is still present in the network namespace.
|
||||
run ip netns exec "$ns_name" ip address show dev dummy0
|
||||
[ "$status" -eq 0 ]
|
||||
run -0 ip netns exec "$ns_name" ip address show dev dummy0
|
||||
[[ "$output" == *"mtu $mtu_value "* ]]
|
||||
}
|
||||
|
||||
@test "move network device to precreated container network namespace and set mac address" {
|
||||
setup_netns
|
||||
update_config ' .linux.netDevices |= {"dummy0": {} }
|
||||
| .process.args |= ["ip", "address", "show", "dev", "dummy0"]'
|
||||
|
||||
# Tell runc which network namespace to use.
|
||||
create_netns
|
||||
update_config '(.. | select(.type? == "network")) .path |= "'"$ns_path"'"'
|
||||
|
||||
mac_address="00:11:22:33:44:55"
|
||||
# set a custom mac address to the interface
|
||||
ip link set address "$mac_address" dev dummy0
|
||||
@@ -162,19 +147,15 @@ function teardown() {
|
||||
[[ "$output" == *"ether $mac_address "* ]]
|
||||
|
||||
# Verify the interface is still present in the network namespace.
|
||||
run ip netns exec "$ns_name" ip address show dev dummy0
|
||||
[ "$status" -eq 0 ]
|
||||
run -0 ip netns exec "$ns_name" ip address show dev dummy0
|
||||
[[ "$output" == *"ether $mac_address "* ]]
|
||||
}
|
||||
|
||||
@test "move network device to precreated container network namespace and rename" {
|
||||
setup_netns
|
||||
update_config ' .linux.netDevices |= { "dummy0": { "name" : "ctr_dummy0" } }
|
||||
| .process.args |= ["ip", "address", "show", "dev", "ctr_dummy0"]'
|
||||
|
||||
# Tell runc which network namespace to use.
|
||||
create_netns
|
||||
update_config '(.. | select(.type? == "network")) .path |= "'"$ns_path"'"'
|
||||
|
||||
runc run test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
@@ -183,13 +164,10 @@ function teardown() {
|
||||
}
|
||||
|
||||
@test "move network device to precreated container network namespace and rename and set mtu and mac and ip address" {
|
||||
setup_netns
|
||||
update_config ' .linux.netDevices |= { "dummy0": { "name" : "ctr_dummy0" } }
|
||||
| .process.args |= ["ip", "address", "show", "dev", "ctr_dummy0"]'
|
||||
|
||||
# Tell runc which network namespace to use.
|
||||
create_netns
|
||||
update_config '(.. | select(.type? == "network")) .path |= "'"$ns_path"'"'
|
||||
|
||||
mtu_value=1789
|
||||
mac_address="00:11:22:33:44:55"
|
||||
global_ip="169.254.169.77/32"
|
||||
@@ -208,8 +186,7 @@ function teardown() {
|
||||
[[ "$output" == *"mtu $mtu_value "* ]]
|
||||
|
||||
# Verify the interface is still present in the network namespace.
|
||||
run ip netns exec "$ns_name" ip address show dev ctr_dummy0
|
||||
[ "$status" -eq 0 ]
|
||||
run -0 ip netns exec "$ns_name" ip address show dev ctr_dummy0
|
||||
[[ "$output" == *" $global_ip "* ]]
|
||||
[[ "$output" == *"ether $mac_address "* ]]
|
||||
[[ "$output" == *"mtu $mtu_value "* ]]
|
||||
|
||||
@@ -17,24 +17,19 @@ function teardown() {
|
||||
set_cgroups_path
|
||||
fi
|
||||
|
||||
# run busybox detached
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
testcontainer test_busybox running
|
||||
|
||||
# pause busybox
|
||||
runc pause test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# test state of busybox is paused
|
||||
testcontainer test_busybox paused
|
||||
|
||||
# resume busybox
|
||||
runc resume test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# test state of busybox is back to running
|
||||
testcontainer test_busybox running
|
||||
}
|
||||
|
||||
@@ -45,31 +40,25 @@ function teardown() {
|
||||
set_cgroups_path
|
||||
fi
|
||||
|
||||
# run test_busybox detached
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
testcontainer test_busybox running
|
||||
|
||||
# pause test_busybox and nonexistent container
|
||||
runc pause test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
runc pause nonexistent
|
||||
[ "$status" -ne 0 ]
|
||||
|
||||
# test state of test_busybox is paused
|
||||
testcontainer test_busybox paused
|
||||
|
||||
# resume test_busybox and nonexistent container
|
||||
runc resume test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
runc resume nonexistent
|
||||
[ "$status" -ne 0 ]
|
||||
|
||||
# test state of test_busybox is back to running
|
||||
testcontainer test_busybox running
|
||||
|
||||
# delete test_busybox
|
||||
runc delete --force test_busybox
|
||||
|
||||
runc state test_busybox
|
||||
|
||||
@@ -48,12 +48,10 @@ function teardown() {
|
||||
# Use sub-cgroup to ensure that exec process has been killed
|
||||
test_pidfd_cgroup_path=$(get_cgroup_path "pids")
|
||||
mkdir "${test_pidfd_cgroup_path}/exec_pidfd"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
setup_pidfd_kill "SIGKILL"
|
||||
|
||||
__runc exec -d --cgroup "pids:exec_pidfd" --pid-file "exec_pid.txt" --pidfd-socket "${PIDFD_SOCKET}" test_pidfd sleep 1d
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
exec_pid=$(cat exec_pid.txt)
|
||||
exec_pid_in_cgroup=$(cat "${test_pidfd_cgroup_path}/exec_pidfd/cgroup.procs")
|
||||
@@ -79,12 +77,10 @@ function teardown() {
|
||||
# Use sub-cgroup to ensure that exec process has been killed
|
||||
test_pidfd_cgroup_path=$(get_cgroup_path "pids")
|
||||
mkdir "${test_pidfd_cgroup_path}/exec_pidfd"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
setup_pidfd_kill "SIGKILL"
|
||||
|
||||
__runc exec -d --cgroup "exec_pidfd" --pid-file "exec_pid.txt" --pidfd-socket "${PIDFD_SOCKET}" test_pidfd sleep 1d
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
exec_pid=$(cat exec_pid.txt)
|
||||
exec_pid_in_cgroup=$(cat "${test_pidfd_cgroup_path}/exec_pidfd/cgroup.procs")
|
||||
|
||||
@@ -51,7 +51,7 @@ function teardown() {
|
||||
}'
|
||||
__runc exec -d --pid-file pid.txt --process <(echo "$proc") test_scheduler
|
||||
|
||||
run chrt -p "$(cat pid.txt)"
|
||||
run -0 chrt -p "$(cat pid.txt)"
|
||||
[[ "${lines[0]}" == *"scheduling policy: SCHED_DEADLINE|SCHED_RESET_ON_FORK" ]]
|
||||
[[ "${lines[1]}" == *"priority: 0" ]]
|
||||
[[ "${lines[2]}" == *"runtime/deadline/period parameters: 42000/100000/1000000" ]]
|
||||
|
||||
@@ -16,13 +16,11 @@ function teardown() {
|
||||
|
||||
testcontainer test_busybox created
|
||||
|
||||
# start container test_busybox
|
||||
runc start test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
testcontainer test_busybox running
|
||||
|
||||
# delete test_busybox
|
||||
runc delete --force test_busybox
|
||||
|
||||
runc state test_busybox
|
||||
|
||||
@@ -11,11 +11,8 @@ function teardown() {
|
||||
}
|
||||
|
||||
@test "runc run detached" {
|
||||
# run busybox detached
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# check state
|
||||
testcontainer test_busybox running
|
||||
}
|
||||
|
||||
@@ -28,43 +25,32 @@ function teardown() {
|
||||
update_config ' (.. | select(.uid? == 0)) .uid |= 1000
|
||||
| (.. | select(.gid? == 0)) .gid |= 100'
|
||||
|
||||
# run busybox detached
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# check state
|
||||
testcontainer test_busybox running
|
||||
}
|
||||
|
||||
@test "runc run detached --pid-file" {
|
||||
# run busybox detached
|
||||
runc run --pid-file pid.txt -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# check state
|
||||
testcontainer test_busybox running
|
||||
|
||||
# check pid.txt was generated
|
||||
[ -e pid.txt ]
|
||||
|
||||
[[ "$(cat pid.txt)" == $(__runc state test_busybox | jq '.pid') ]]
|
||||
}
|
||||
|
||||
@test "runc run detached --pid-file with new CWD" {
|
||||
bundle="$(pwd)"
|
||||
# create pid_file directory as the CWD
|
||||
mkdir pid_file
|
||||
cd pid_file
|
||||
|
||||
# run busybox detached
|
||||
runc run --pid-file pid.txt -d -b "$bundle" --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# check state
|
||||
testcontainer test_busybox running
|
||||
|
||||
# check pid.txt was generated
|
||||
[ -e pid.txt ]
|
||||
|
||||
[[ "$(cat pid.txt)" == $(__runc state test_busybox | jq '.pid') ]]
|
||||
}
|
||||
|
||||
@@ -12,11 +12,8 @@ function teardown() {
|
||||
}
|
||||
|
||||
@test "runc run" {
|
||||
# run hello-world
|
||||
runc run test_hello
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# check expected output
|
||||
[[ "${output}" == *"Hello"* ]]
|
||||
}
|
||||
|
||||
@@ -29,11 +26,8 @@ function teardown() {
|
||||
update_config ' (.. | select(.uid? == 0)) .uid |= 1000
|
||||
| (.. | select(.gid? == 0)) .gid |= 100'
|
||||
|
||||
# run hello-world
|
||||
runc run test_hello
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# check expected output
|
||||
[[ "${output}" == *"Hello"* ]]
|
||||
}
|
||||
|
||||
@@ -72,21 +66,17 @@ function teardown() {
|
||||
cd rootfs
|
||||
update_config '(.. | select(. == "rootfs")) |= "."'
|
||||
|
||||
# run hello-world
|
||||
runc run test_hello
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "${output}" == *"Hello"* ]]
|
||||
}
|
||||
|
||||
@test "runc run --pid-file" {
|
||||
# run hello-world
|
||||
runc run --pid-file pid.txt test_hello
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "${output}" == *"Hello"* ]]
|
||||
|
||||
# check pid.txt was generated
|
||||
[ -e pid.txt ]
|
||||
|
||||
[[ "$(cat pid.txt)" =~ [0-9]+ ]]
|
||||
}
|
||||
|
||||
|
||||
@@ -14,18 +14,15 @@ function teardown() {
|
||||
runc state test_busybox
|
||||
[ "$status" -ne 0 ]
|
||||
|
||||
# run busybox detached
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# check state
|
||||
testcontainer test_busybox running
|
||||
|
||||
runc kill test_busybox KILL
|
||||
[ "$status" -eq 0 ]
|
||||
wait_for_container 10 1 test_busybox stopped
|
||||
|
||||
# delete test_busybox
|
||||
runc delete test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
@@ -40,24 +37,18 @@ function teardown() {
|
||||
runc state test_busybox
|
||||
[ "$status" -ne 0 ]
|
||||
|
||||
# run busybox detached
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# check state
|
||||
testcontainer test_busybox running
|
||||
|
||||
# pause busybox
|
||||
runc pause test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# test state of busybox is paused
|
||||
testcontainer test_busybox paused
|
||||
|
||||
# resume busybox
|
||||
runc resume test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# test state of busybox is back to running
|
||||
testcontainer test_busybox running
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ function teardown() {
|
||||
# shellcheck disable=SC2016
|
||||
update_config '(.. | select(.[]? == "sh")) += ["-c", "for file in /proc/self/fd/[012]; do readlink $file; done"]'
|
||||
|
||||
# run busybox
|
||||
runc run test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
[[ ${lines[0]} =~ /dev/pts/+ ]]
|
||||
@@ -40,7 +39,6 @@ function teardown() {
|
||||
# shellcheck disable=SC2016
|
||||
update_config '(.. | select(.[]? == "sh")) += ["-c", "stat -c %u:%g $(tty) | tr : \\\\n"]'
|
||||
|
||||
# run busybox
|
||||
runc run test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
[[ ${lines[0]} =~ 0 ]]
|
||||
@@ -60,7 +58,6 @@ function teardown() {
|
||||
| (.. | select(.gid? == 0)) .gid |= 100
|
||||
| (.. | select(.[]? == "sh")) += ["-c", "stat -c %u:%g $(tty) | tr : \\\\n"]'
|
||||
|
||||
# run busybox
|
||||
runc run test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
[[ ${lines[0]} =~ 1000 ]]
|
||||
@@ -72,7 +69,6 @@ function teardown() {
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# make sure we're running
|
||||
testcontainer test_busybox running
|
||||
|
||||
# note that stdout/stderr are already redirected by bats' run
|
||||
@@ -81,14 +77,11 @@ function teardown() {
|
||||
}
|
||||
|
||||
@test "runc exec [tty ptsname]" {
|
||||
# run busybox detached
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# make sure we're running
|
||||
testcontainer test_busybox running
|
||||
|
||||
# run the exec
|
||||
# shellcheck disable=SC2016
|
||||
runc exec -t test_busybox sh -c 'for file in /proc/self/fd/[012]; do readlink $file; done'
|
||||
[ "$status" -eq 0 ]
|
||||
@@ -102,14 +95,11 @@ function teardown() {
|
||||
# TODO: this can be made as a change to the gid test.
|
||||
[ $EUID -ne 0 ] && requires rootless_idmap
|
||||
|
||||
# run busybox detached
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# make sure we're running
|
||||
testcontainer test_busybox running
|
||||
|
||||
# run the exec
|
||||
# shellcheck disable=SC2016
|
||||
runc exec -t test_busybox sh -c 'stat -c %u:%g $(tty) | tr : \\n'
|
||||
[ "$status" -eq 0 ]
|
||||
@@ -126,14 +116,11 @@ function teardown() {
|
||||
update_config ' (.. | select(.uid? == 0)) .uid |= 1000
|
||||
| (.. | select(.gid? == 0)) .gid |= 100'
|
||||
|
||||
# run busybox detached
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# make sure we're running
|
||||
testcontainer test_busybox running
|
||||
|
||||
# run the exec
|
||||
# shellcheck disable=SC2016
|
||||
runc exec -t test_busybox sh -c 'stat -c %u:%g $(tty) | tr : \\n'
|
||||
[ "$status" -eq 0 ]
|
||||
@@ -145,11 +132,9 @@ function teardown() {
|
||||
# allow writing to filesystem
|
||||
update_config '(.. | select(.readonly? != null)) .readonly |= false'
|
||||
|
||||
# run busybox detached
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# make sure we're running
|
||||
testcontainer test_busybox running
|
||||
|
||||
tty_info_with_consize_size='
|
||||
@@ -184,7 +169,6 @@ function teardown() {
|
||||
"cwd": "/"
|
||||
}'
|
||||
|
||||
# run the exec
|
||||
runc exec -t -p <(echo "$tty_info") test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
@@ -202,13 +186,11 @@ function teardown() {
|
||||
# Make sure that the handling of detached IO is done properly. See #1354.
|
||||
__runc create test_busybox
|
||||
|
||||
# Start the command.
|
||||
runc start test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
testcontainer test_busybox running
|
||||
|
||||
# Kill the container.
|
||||
runc kill test_busybox KILL
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
@@ -216,7 +198,6 @@ function teardown() {
|
||||
@test "runc run [terminal=false]" {
|
||||
# Disable terminal creation.
|
||||
# Replace sh script with sleep.
|
||||
|
||||
update_config ' (.. | select(.terminal? != null)) .terminal |= false
|
||||
| (.. | select(.[]? == "sh")) += ["sleep", "1000s"]
|
||||
| del(.. | select(.? == "sh"))'
|
||||
@@ -229,7 +210,6 @@ function teardown() {
|
||||
wait_for_container 15 1 test_busybox running
|
||||
testcontainer test_busybox running
|
||||
|
||||
# Kill the container.
|
||||
runc kill test_busybox KILL
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
@@ -246,7 +226,6 @@ function teardown() {
|
||||
|
||||
testcontainer test_busybox running
|
||||
|
||||
# Kill the container.
|
||||
runc kill test_busybox KILL
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ function teardown() {
|
||||
@test "umask" {
|
||||
update_config '.process.user += {"umask":63}'
|
||||
|
||||
# run busybox detached
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ function setup() {
|
||||
requires cgroups_memory cgroups_pids cgroups_cpuset
|
||||
init_cgroup_paths
|
||||
|
||||
# run a few busyboxes detached
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_update
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
@@ -259,7 +258,6 @@ EOF
|
||||
@test "update cgroup cpu limits" {
|
||||
[ $EUID -ne 0 ] && requires rootless_cgroup
|
||||
|
||||
# run a few busyboxes detached
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_update
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
@@ -322,7 +320,6 @@ EOF
|
||||
}
|
||||
}
|
||||
EOF
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
runc update -r "$BATS_RUN_TMPDIR"/runc-cgroups-integration-test.json test_update
|
||||
[ "$status" -eq 0 ]
|
||||
@@ -426,9 +423,9 @@ EOF
|
||||
echo 50000 >"/sys/fs/cgroup/cpu/$REL_PARENT_PATH/cpu.cfs_quota_us"
|
||||
fi
|
||||
# Sanity checks.
|
||||
run cat "/sys/fs/cgroup/cpu$REL_PARENT_PATH/cpu.cfs_period_us"
|
||||
run -0 cat "/sys/fs/cgroup/cpu$REL_PARENT_PATH/cpu.cfs_period_us"
|
||||
[ "$output" -eq 100000 ]
|
||||
run cat "/sys/fs/cgroup/cpu$REL_PARENT_PATH/cpu.cfs_quota_us"
|
||||
run -0 cat "/sys/fs/cgroup/cpu$REL_PARENT_PATH/cpu.cfs_quota_us"
|
||||
[ "$output" -eq 50000 ]
|
||||
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_update
|
||||
@@ -732,7 +729,6 @@ EOF
|
||||
echo "$root_runtime" >"$target_runtime"
|
||||
done
|
||||
|
||||
# run a detached busybox
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_update_rt
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
|
||||
@@ -261,8 +261,7 @@ function teardown() {
|
||||
|
||||
# The interface is virtual and should not exist because
|
||||
# is deleted during the namespace cleanup.
|
||||
run ip link del dummy0
|
||||
[ "$status" -ne 0 ]
|
||||
run ! ip link del dummy0
|
||||
}
|
||||
|
||||
@test "userns with network interface renamed" {
|
||||
@@ -279,6 +278,5 @@ function teardown() {
|
||||
|
||||
# The interface is virtual and should not exist because
|
||||
# is deleted during the namespace cleanup.
|
||||
run ip link del dummy0
|
||||
[ "$status" -ne 0 ]
|
||||
run ! ip link del dummy0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user