diff --git a/tests/integration/start_detached.bats b/tests/integration/start_detached.bats index e9df8e8b..52225007 100644 --- a/tests/integration/start_detached.bats +++ b/tests/integration/start_detached.bats @@ -22,6 +22,22 @@ function teardown() { testcontainer test_busybox running } +@test "runc run detached ({u,g}id != 0)" { + # replace "uid": 0 with "uid": 1000 + # and do a similar thing for gid. + sed -i 's;"uid": 0;"uid": 1000;g' config.json + sed -i 's;"gid": 0;"gid": 100;g' config.json + + # run busybox detached + runc run -d --console /dev/pts/ptmx test_busybox + [ "$status" -eq 0 ] + + # check state + wait_for_container 15 1 test_busybox + + testcontainer test_busybox running +} + @test "runc run detached --pid-file" { # run busybox detached runc run --pid-file pid.txt -d --console /dev/pts/ptmx test_busybox diff --git a/tests/integration/start_hello.bats b/tests/integration/start_hello.bats index cddc2be3..6de65e07 100644 --- a/tests/integration/start_hello.bats +++ b/tests/integration/start_hello.bats @@ -20,6 +20,20 @@ function teardown() { [[ "${output}" == *"Hello"* ]] } +@test "runc run ({u,g}id != 0)" { + # replace "uid": 0 with "uid": 1000 + # and do a similar thing for gid. + sed -i 's;"uid": 0;"uid": 1000;g' config.json + sed -i 's;"gid": 0;"gid": 100;g' config.json + + # run hello-world + runc run test_hello + [ "$status" -eq 0 ] + + # check expected output + [[ "${output}" == *"Hello"* ]] +} + @test "runc run with rootfs set to ." { cp config.json rootfs/. rm config.json