1
0
mirror of https://github.com/opencontainers/runc.git synced 2025-08-07 01:22:38 +03:00

tests: fix all the things

This fixes all of the tests that were broken as part of the console
rewrite. This includes fixing the integration tests that used TTY
handling inside libcontainer, as well as the bats integration tests that
needed to be rewritten to use recvtty (as they rely on detached
containers that are running).

This patch is part of the console rewrite patchset.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
This commit is contained in:
Aleksa Sarai
2016-09-06 22:40:01 +10:00
parent bda3055055
commit 972c176ae4
20 changed files with 91 additions and 65 deletions

View File

@@ -1,4 +1,4 @@
.PHONY: all dbuild man \ .PHONY: all shell dbuild man \
localtest localunittest localintegration \ localtest localunittest localintegration \
test unittest integration test unittest integration
@@ -103,6 +103,9 @@ integration: runcimage
localintegration: all localintegration: all
bats -t tests/integration${TESTFLAGS} bats -t tests/integration${TESTFLAGS}
shell: all
docker run -e TESTFLAGS -ti --privileged --rm -v $(CURDIR):/go/src/$(PROJECT) $(RUNC_IMAGE) bash
install: install:
install -D -m0755 runc $(BINDIR)/runc install -D -m0755 runc $(BINDIR)/runc

View File

@@ -247,8 +247,6 @@ func TestExecInError(t *testing.T) {
} }
} }
// XXX: This test will fail.
/*
func TestExecInTTY(t *testing.T) { func TestExecInTTY(t *testing.T) {
if testing.Short() { if testing.Short() {
return return
@@ -281,15 +279,15 @@ func TestExecInTTY(t *testing.T) {
Args: []string{"ps"}, Args: []string{"ps"},
Env: standardEnvironment, Env: standardEnvironment,
} }
console, err := ps.NewConsole(0, 0) err = container.Run(ps)
ok(t, err)
console, err := ps.GetConsole()
copy := make(chan struct{}) copy := make(chan struct{})
go func() { go func() {
io.Copy(&stdout, console) io.Copy(&stdout, console)
close(copy) close(copy)
}() }()
ok(t, err) ok(t, err)
err = container.Run(ps)
ok(t, err)
select { select {
case <-time.After(5 * time.Second): case <-time.After(5 * time.Second):
t.Fatal("Waiting for copy timed out") t.Fatal("Waiting for copy timed out")
@@ -308,7 +306,6 @@ func TestExecInTTY(t *testing.T) {
t.Fatalf("unexpected carriage-return in output") t.Fatalf("unexpected carriage-return in output")
} }
} }
*/
func TestExecInEnvironment(t *testing.T) { func TestExecInEnvironment(t *testing.T) {
if testing.Short() { if testing.Short() {

View File

@@ -36,13 +36,13 @@ type Process struct {
Cwd string Cwd string
// Stdin is a pointer to a reader which provides the standard input stream. // Stdin is a pointer to a reader which provides the standard input stream.
Stdin *os.File Stdin io.Reader
// Stdout is a pointer to a writer which receives the standard output stream. // Stdout is a pointer to a writer which receives the standard output stream.
Stdout *os.File Stdout io.Writer
// Stderr is a pointer to a writer which receives the standard error stream. // Stderr is a pointer to a writer which receives the standard error stream.
Stderr *os.File Stderr io.Writer
// ExtraFiles specifies additional open files to be inherited by the container // ExtraFiles specifies additional open files to be inherited by the container
ExtraFiles []*os.File ExtraFiles []*os.File

View File

@@ -43,7 +43,7 @@ EOF
sed -i "s/\(\"resources\": {\)/\1\n${DATA}/" ${BUSYBOX_BUNDLE}/config.json sed -i "s/\(\"resources\": {\)/\1\n${DATA}/" ${BUSYBOX_BUNDLE}/config.json
# run a detached busybox to work with # run a detached busybox to work with
runc run -d --console /dev/pts/ptmx test_cgroups_kmem runc run -d --console-socket $CONSOLE_SOCKET test_cgroups_kmem
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
wait_for_container 15 1 test_cgroups_kmem wait_for_container 15 1 test_cgroups_kmem
@@ -61,7 +61,7 @@ EOF
sed -i 's/\("linux": {\)/\1\n "cgroupsPath": "\/runc-cgroups-integration-test",/' ${BUSYBOX_BUNDLE}/config.json sed -i 's/\("linux": {\)/\1\n "cgroupsPath": "\/runc-cgroups-integration-test",/' ${BUSYBOX_BUNDLE}/config.json
# run a detached busybox to work with # run a detached busybox to work with
runc run -d --console /dev/pts/ptmx test_cgroups_kmem runc run -d --console-socket $CONSOLE_SOCKET test_cgroups_kmem
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
wait_for_container 15 1 test_cgroups_kmem wait_for_container 15 1 test_cgroups_kmem

View File

@@ -12,7 +12,7 @@ function teardown() {
} }
@test "runc create" { @test "runc create" {
runc create --console /dev/pts/ptmx test_busybox runc create --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
testcontainer test_busybox created testcontainer test_busybox created
@@ -25,7 +25,7 @@ function teardown() {
} }
@test "runc create exec" { @test "runc create exec" {
runc create --console /dev/pts/ptmx test_busybox runc create --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
testcontainer test_busybox created testcontainer test_busybox created
@@ -33,6 +33,8 @@ function teardown() {
runc exec test_busybox true runc exec test_busybox true
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
testcontainer test_busybox created
# start the command # start the command
runc start test_busybox runc start test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
@@ -41,7 +43,7 @@ function teardown() {
} }
@test "runc create --pid-file" { @test "runc create --pid-file" {
runc create --pid-file pid.txt --console /dev/pts/ptmx test_busybox runc create --pid-file pid.txt --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
testcontainer test_busybox created testcontainer test_busybox created
@@ -67,7 +69,7 @@ function teardown() {
run cd pid_file run cd pid_file
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
runc create --pid-file pid.txt -b $BUSYBOX_BUNDLE --console /dev/pts/ptmx test_busybox runc create --pid-file pid.txt -b $BUSYBOX_BUNDLE --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
testcontainer test_busybox created testcontainer test_busybox created

View File

@@ -13,7 +13,7 @@ function teardown() {
@test "runc delete" { @test "runc delete" {
# run busybox detached # run busybox detached
runc run -d --console /dev/pts/ptmx test_busybox runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
# check state # check state
@@ -34,7 +34,7 @@ function teardown() {
@test "runc delete --force" { @test "runc delete --force" {
# run busybox detached # run busybox detached
runc run -d --console /dev/pts/ptmx test_busybox runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
# check state # check state
@@ -51,13 +51,13 @@ function teardown() {
@test "run delete with multi-containers" { @test "run delete with multi-containers" {
# create busybox1 detached # create busybox1 detached
runc create --console /dev/pts/ptmx test_busybox1 runc create --console-socket $CONSOLE_SOCKET test_busybox1
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
testcontainer test_busybox1 created testcontainer test_busybox1 created
# run busybox2 detached # run busybox2 detached
runc run -d --console /dev/pts/ptmx test_busybox2 runc run -d --console-socket $CONSOLE_SOCKET test_busybox2
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
wait_for_container 15 1 test_busybox2 wait_for_container 15 1 test_busybox2
@@ -86,20 +86,20 @@ function teardown() {
@test "run delete --force with multi-containers" { @test "run delete --force with multi-containers" {
# create busybox1 detached # create busybox1 detached
runc create --console /dev/pts/ptmx test_busybox1 runc create --console-socket $CONSOLE_SOCKET test_busybox1
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
testcontainer test_busybox1 created testcontainer test_busybox1 created
# run busybox2 detached # run busybox2 detached
runc run -d --console /dev/pts/ptmx test_busybox2 runc run -d --console-socket $CONSOLE_SOCKET test_busybox2
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
wait_for_container 15 1 test_busybox2 wait_for_container 15 1 test_busybox2
testcontainer test_busybox2 running testcontainer test_busybox2 running
# delete both test_busybox1 and test_busybox2 container # delete both test_busybox1 and test_busybox2 container
runc delete --force test_busybox1 test_busybox2 runc delete --force test_busybox1 test_busybox2
runc state test_busybox1 runc state test_busybox1
[ "$status" -ne 0 ] [ "$status" -ne 0 ]

View File

@@ -13,7 +13,7 @@ function teardown() {
@test "events --stats" { @test "events --stats" {
# run busybox detached # run busybox detached
runc run -d --console /dev/pts/ptmx test_busybox runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
# check state # check state
@@ -28,7 +28,7 @@ function teardown() {
@test "events --interval default " { @test "events --interval default " {
# run busybox detached # run busybox detached
runc run -d --console /dev/pts/ptmx test_busybox runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
# check state # check state
@@ -55,7 +55,7 @@ function teardown() {
@test "events --interval 1s " { @test "events --interval 1s " {
# run busybox detached # run busybox detached
runc run -d --console /dev/pts/ptmx test_busybox runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
# check state # check state
@@ -81,7 +81,7 @@ function teardown() {
@test "events --interval 100ms " { @test "events --interval 100ms " {
# run busybox detached # run busybox detached
runc run -d --console /dev/pts/ptmx test_busybox runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
# check state # check state

View File

@@ -13,7 +13,7 @@ function teardown() {
@test "runc exec" { @test "runc exec" {
# run busybox detached # run busybox detached
runc run -d --console /dev/pts/ptmx test_busybox runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
wait_for_container 15 1 test_busybox wait_for_container 15 1 test_busybox
@@ -26,7 +26,7 @@ function teardown() {
@test "runc exec --pid-file" { @test "runc exec --pid-file" {
# run busybox detached # run busybox detached
runc run -d --console /dev/pts/ptmx test_busybox runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
wait_for_container 15 1 test_busybox wait_for_container 15 1 test_busybox
@@ -53,7 +53,7 @@ function teardown() {
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
# run busybox detached # run busybox detached
runc run -d -b $BUSYBOX_BUNDLE --console /dev/pts/ptmx test_busybox runc run -d -b $BUSYBOX_BUNDLE --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
wait_for_container 15 1 test_busybox wait_for_container 15 1 test_busybox
@@ -74,7 +74,7 @@ function teardown() {
@test "runc exec ls -la" { @test "runc exec ls -la" {
# run busybox detached # run busybox detached
runc run -d --console /dev/pts/ptmx test_busybox runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
wait_for_container 15 1 test_busybox wait_for_container 15 1 test_busybox
@@ -88,7 +88,7 @@ function teardown() {
@test "runc exec ls -la with --cwd" { @test "runc exec ls -la with --cwd" {
# run busybox detached # run busybox detached
runc run -d --console /dev/pts/ptmx test_busybox runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
wait_for_container 15 1 test_busybox wait_for_container 15 1 test_busybox
@@ -100,7 +100,7 @@ function teardown() {
@test "runc exec --env" { @test "runc exec --env" {
# run busybox detached # run busybox detached
runc run -d --console /dev/pts/ptmx test_busybox runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
wait_for_container 15 1 test_busybox wait_for_container 15 1 test_busybox
@@ -113,7 +113,7 @@ function teardown() {
@test "runc exec --user" { @test "runc exec --user" {
# run busybox detached # run busybox detached
runc run -d --console /dev/pts/ptmx test_busybox runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
wait_for_container 15 1 test_busybox wait_for_container 15 1 test_busybox

View File

@@ -64,11 +64,11 @@ load helpers
runc start -h runc start -h
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
[[ ${lines[1]} =~ runc\ start+ ]] [[ ${lines[1]} =~ runc\ start+ ]]
runc run -h runc run -h
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
[[ ${lines[1]} =~ runc\ run+ ]] [[ ${lines[1]} =~ runc\ run+ ]]
runc state -h runc state -h
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
[[ ${lines[1]} =~ runc\ state+ ]] [[ ${lines[1]} =~ runc\ state+ ]]

View File

@@ -3,6 +3,7 @@
# Root directory of integration tests. # Root directory of integration tests.
INTEGRATION_ROOT=$(dirname "$(readlink -f "$BASH_SOURCE")") INTEGRATION_ROOT=$(dirname "$(readlink -f "$BASH_SOURCE")")
RUNC="${INTEGRATION_ROOT}/../../runc" RUNC="${INTEGRATION_ROOT}/../../runc"
RECVTTY="${INTEGRATION_ROOT}/../../contrib/cmd/recvtty/recvtty"
GOPATH="${INTEGRATION_ROOT}/../../../.." GOPATH="${INTEGRATION_ROOT}/../../../.."
# Test data path. # Test data path.
@@ -17,7 +18,7 @@ HELLO_IMAGE="$TESTDATA/hello-world.tar"
HELLO_BUNDLE="$BATS_TMPDIR/hello-world" HELLO_BUNDLE="$BATS_TMPDIR/hello-world"
# CRIU PATH # CRIU PATH
CRIU="/usr/local/sbin/criu" CRIU="$(which criu)"
# Kernel version # Kernel version
KERNEL_VERSION="$(uname -r)" KERNEL_VERSION="$(uname -r)"
@@ -28,6 +29,9 @@ KERNEL_MINOR="${KERNEL_MINOR%%.*}"
# Root state path. # Root state path.
ROOT="$BATS_TMPDIR/runc" ROOT="$BATS_TMPDIR/runc"
# Path to console socket.
CONSOLE_SOCKET="$BATS_TMPDIR/console.sock"
# Cgroup mount # Cgroup mount
CGROUP_BASE_PATH=$(grep "cgroup" /proc/self/mountinfo | gawk 'toupper($NF) ~ /\<MEMORY\>/ { print $5; exit }') CGROUP_BASE_PATH=$(grep "cgroup" /proc/self/mountinfo | gawk 'toupper($NF) ~ /\<MEMORY\>/ { print $5; exit }')
@@ -142,7 +146,24 @@ function testcontainer() {
[[ "${output}" == *"$2"* ]] [[ "${output}" == *"$2"* ]]
} }
function setup_recvtty() {
# We need to start recvtty in the background, so we double fork in the shell.
("$RECVTTY" --pid-file "$BATS_TMPDIR/recvtty.pid" --mode null "$CONSOLE_SOCKET" &) &
}
function teardown_recvtty() {
# When we kill recvtty, the container will also be killed.
if [ -f "$BATS_TMPDIR/recvtty.pid" ]; then
kill -9 $(cat "$BATS_TMPDIR/recvtty.pid")
fi
# Clean up the files that might be left over.
rm -f "$BATS_TMPDIR/recvtty.pid"
rm -f "$CONSOLE_SOCKET"
}
function setup_busybox() { function setup_busybox() {
setup_recvtty
run mkdir "$BUSYBOX_BUNDLE" run mkdir "$BUSYBOX_BUNDLE"
run mkdir "$BUSYBOX_BUNDLE"/rootfs run mkdir "$BUSYBOX_BUNDLE"/rootfs
if [ -e "/testdata/busybox.tar" ]; then if [ -e "/testdata/busybox.tar" ]; then
@@ -157,6 +178,7 @@ function setup_busybox() {
} }
function setup_hello() { function setup_hello() {
setup_recvtty
run mkdir "$HELLO_BUNDLE" run mkdir "$HELLO_BUNDLE"
run mkdir "$HELLO_BUNDLE"/rootfs run mkdir "$HELLO_BUNDLE"/rootfs
tar -C "$HELLO_BUNDLE"/rootfs -xf "$HELLO_IMAGE" tar -C "$HELLO_BUNDLE"/rootfs -xf "$HELLO_IMAGE"
@@ -185,12 +207,14 @@ function teardown_running_container_inroot() {
function teardown_busybox() { function teardown_busybox() {
cd "$INTEGRATION_ROOT" cd "$INTEGRATION_ROOT"
teardown_recvtty
teardown_running_container test_busybox teardown_running_container test_busybox
run rm -f -r "$BUSYBOX_BUNDLE" run rm -f -r "$BUSYBOX_BUNDLE"
} }
function teardown_hello() { function teardown_hello() {
cd "$INTEGRATION_ROOT" cd "$INTEGRATION_ROOT"
teardown_recvtty
teardown_running_container test_hello teardown_running_container test_hello
run rm -f -r "$HELLO_BUNDLE" run rm -f -r "$HELLO_BUNDLE"
} }

View File

@@ -15,7 +15,7 @@ function teardown() {
@test "kill detached busybox" { @test "kill detached busybox" {
# run busybox detached # run busybox detached
runc run -d --console /dev/pts/ptmx test_busybox runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
# check state # check state

View File

@@ -19,15 +19,15 @@ function teardown() {
@test "list" { @test "list" {
# run a few busyboxes detached # run a few busyboxes detached
ROOT=$HELLO_BUNDLE runc run -d --console /dev/pts/ptmx test_box1 ROOT=$HELLO_BUNDLE runc run -d --console-socket $CONSOLE_SOCKET test_box1
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
wait_for_container_inroot 15 1 test_box1 $HELLO_BUNDLE wait_for_container_inroot 15 1 test_box1 $HELLO_BUNDLE
ROOT=$HELLO_BUNDLE runc run -d --console /dev/pts/ptmx test_box2 ROOT=$HELLO_BUNDLE runc run -d --console-socket $CONSOLE_SOCKET test_box2
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
wait_for_container_inroot 15 1 test_box2 $HELLO_BUNDLE wait_for_container_inroot 15 1 test_box2 $HELLO_BUNDLE
ROOT=$HELLO_BUNDLE runc run -d --console /dev/pts/ptmx test_box3 ROOT=$HELLO_BUNDLE runc run -d --console-socket $CONSOLE_SOCKET test_box3
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
wait_for_container_inroot 15 1 test_box3 $HELLO_BUNDLE wait_for_container_inroot 15 1 test_box3 $HELLO_BUNDLE

View File

@@ -20,7 +20,7 @@ function teardown() {
@test "mask paths [file]" { @test "mask paths [file]" {
# run busybox detached # run busybox detached
runc run -d --console /dev/pts/ptmx test_busybox runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
wait_for_container 15 1 test_busybox wait_for_container 15 1 test_busybox
@@ -40,7 +40,7 @@ function teardown() {
@test "mask paths [directory]" { @test "mask paths [directory]" {
# run busybox detached # run busybox detached
runc run -d --console /dev/pts/ptmx test_busybox runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
wait_for_container 15 1 test_busybox wait_for_container 15 1 test_busybox

View File

@@ -13,7 +13,7 @@ function teardown() {
@test "runc pause and resume" { @test "runc pause and resume" {
# run busybox detached # run busybox detached
runc run -d --console /dev/pts/ptmx test_busybox runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
wait_for_container 15 1 test_busybox wait_for_container 15 1 test_busybox
@@ -35,13 +35,13 @@ function teardown() {
@test "runc pause and resume with multi-container" { @test "runc pause and resume with multi-container" {
# run test_busybox1 detached # run test_busybox1 detached
runc run -d --console /dev/pts/ptmx test_busybox1 runc run -d --console-socket $CONSOLE_SOCKET test_busybox1
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
wait_for_container 15 1 test_busybox1 wait_for_container 15 1 test_busybox1
# run test_busybox2 detached # run test_busybox2 detached
runc run -d --console /dev/pts/ptmx test_busybox2 runc run -d --console-socket $CONSOLE_SOCKET test_busybox2
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
wait_for_container 15 1 test_busybox2 wait_for_container 15 1 test_busybox2
@@ -74,27 +74,27 @@ function teardown() {
@test "runc pause and resume with nonexist container" { @test "runc pause and resume with nonexist container" {
# run test_busybox1 detached # run test_busybox1 detached
runc run -d --console /dev/pts/ptmx test_busybox1 runc run -d --console-socket $CONSOLE_SOCKET test_busybox1
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
wait_for_container 15 1 test_busybox1 wait_for_container 15 1 test_busybox1
# run test_busybox2 detached # run test_busybox2 detached
runc run -d --console /dev/pts/ptmx test_busybox2 runc run -d --console-socket $CONSOLE_SOCKET test_busybox2
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
wait_for_container 15 1 test_busybox2 wait_for_container 15 1 test_busybox2
# pause test_busybox1, test_busybox2 and nonexistant container # pause test_busybox1, test_busybox2 and nonexistent container
runc pause test_busybox1 test_busybox2 nonexistant runc pause test_busybox1 test_busybox2 nonexistent
[ "$status" -ne 0 ] [ "$status" -ne 0 ]
# test state of test_busybox1 and test_busybox2 is paused # test state of test_busybox1 and test_busybox2 is paused
testcontainer test_busybox1 paused testcontainer test_busybox1 paused
testcontainer test_busybox2 paused testcontainer test_busybox2 paused
# resume test_busybox1, test_busybox2 and nonexistant container # resume test_busybox1, test_busybox2 and nonexistent container
runc resume test_busybox1 test_busybox2 nonexistant runc resume test_busybox1 test_busybox2 nonexistent
[ "$status" -ne 0 ] [ "$status" -ne 0 ]
# test state of two containers is back to running # test state of two containers is back to running

View File

@@ -13,7 +13,7 @@ function teardown() {
@test "ps" { @test "ps" {
# start busybox detached # start busybox detached
runc run -d --console /dev/pts/ptmx test_busybox runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
# check state # check state
@@ -29,7 +29,7 @@ function teardown() {
@test "ps -f json" { @test "ps -f json" {
# start busybox detached # start busybox detached
runc run -d --console /dev/pts/ptmx test_busybox runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
# check state # check state
@@ -44,7 +44,7 @@ function teardown() {
@test "ps -e -x" { @test "ps -e -x" {
# start busybox detached # start busybox detached
runc run -d --console /dev/pts/ptmx test_busybox runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
# check state # check state

View File

@@ -15,11 +15,11 @@ function teardown() {
@test "global --root" { @test "global --root" {
# run busybox detached using $HELLO_BUNDLE for state # run busybox detached using $HELLO_BUNDLE for state
ROOT=$HELLO_BUNDLE runc run -d --console /dev/pts/ptmx test_dotbox ROOT=$HELLO_BUNDLE runc run -d --console-socket $CONSOLE_SOCKET test_dotbox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
# run busybox detached in default root # run busybox detached in default root
runc run -d --console /dev/pts/ptmx test_busybox runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
# check state of the busyboxes are only in their respective root path # check state of the busyboxes are only in their respective root path

View File

@@ -12,12 +12,12 @@ function teardown() {
} }
@test "runc start" { @test "runc start" {
runc create --console /dev/pts/ptmx test_busybox1 runc create --console-socket $CONSOLE_SOCKET test_busybox1
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
testcontainer test_busybox1 created testcontainer test_busybox1 created
runc create --console /dev/pts/ptmx test_busybox2 runc create --console-socket $CONSOLE_SOCKET test_busybox2
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
testcontainer test_busybox2 created testcontainer test_busybox2 created

View File

@@ -13,7 +13,7 @@ function teardown() {
@test "runc run detached" { @test "runc run detached" {
# run busybox detached # run busybox detached
runc run -d --console /dev/pts/ptmx test_busybox runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
# check state # check state
@@ -29,7 +29,7 @@ function teardown() {
sed -i 's;"gid": 0;"gid": 100;g' config.json sed -i 's;"gid": 0;"gid": 100;g' config.json
# run busybox detached # run busybox detached
runc run -d --console /dev/pts/ptmx test_busybox runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
# check state # check state
@@ -40,7 +40,7 @@ function teardown() {
@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-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
# check state # check state
@@ -64,7 +64,7 @@ function teardown() {
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
# run busybox detached # run busybox detached
runc run --pid-file pid.txt -d -b $BUSYBOX_BUNDLE --console /dev/pts/ptmx test_busybox runc run --pid-file pid.txt -d -b $BUSYBOX_BUNDLE --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
# check state # check state

View File

@@ -16,7 +16,7 @@ function teardown() {
[ "$status" -ne 0 ] [ "$status" -ne 0 ]
# run busybox detached # run busybox detached
runc run -d --console /dev/pts/ptmx test_busybox runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
# check state # check state

View File

@@ -51,7 +51,7 @@ function check_cgroup_value() {
@test "update" { @test "update" {
requires cgroups_kmem requires cgroups_kmem
# run a few busyboxes detached # run a few busyboxes detached
runc run -d --console /dev/pts/ptmx test_update runc run -d --console-socket $CONSOLE_SOCKET test_update
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
wait_for_container 15 1 test_update wait_for_container 15 1 test_update