Merge pull request #922 from cyphar/test-uid-gid

tests: add tests with {u,g}id != 0
This commit is contained in:
Mrunal Patel 2016-06-24 12:09:14 -07:00 committed by GitHub
commit 9123ce66ce
2 changed files with 30 additions and 0 deletions

View File

@ -22,6 +22,22 @@ function teardown() {
testcontainer test_busybox running 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" { @test "runc run detached --pid-file" {
# run busybox detached # run busybox detached
runc run --pid-file pid.txt -d --console /dev/pts/ptmx test_busybox runc run --pid-file pid.txt -d --console /dev/pts/ptmx test_busybox

View File

@ -20,6 +20,20 @@ function teardown() {
[[ "${output}" == *"Hello"* ]] [[ "${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 ." { @test "runc run with rootfs set to ." {
cp config.json rootfs/. cp config.json rootfs/.
rm config.json rm config.json