diff --git a/test/helpers.bash b/test/helpers.bash index b4f44d28..14547b13 100644 --- a/test/helpers.bash +++ b/test/helpers.bash @@ -4,7 +4,7 @@ INTEGRATION_ROOT=$(dirname "$(readlink -f "$BASH_SOURCE")") # Test data path. -TESTDATA="${INTEGRATION_ROOT}/../testdata" +TESTDATA="${INTEGRATION_ROOT}/testdata" # Root directory of the repository. OCID_ROOT=${OCID_ROOT:-$(cd "$INTEGRATION_ROOT/../.."; pwd -P)} @@ -70,7 +70,7 @@ function wait_until_reachable() { # Start ocid. function start_ocid() { - "$OCID_BINARY" --debug --socket "$TESTDIR/ocid.sock" --runtime "$RUNC_BINARY" --root "$TESTDIR/ocid" & OCID_PID=$! + "$OCID_BINARY" --debug --socket "$TESTDIR/ocid.sock" --runtime "$RUNC_BINARY" --root "$TESTDIR/ocid" --sandboxdir "$TESTDIR/sandboxes" --containerdir "$TESTDIR/ocid/containers" & OCID_PID=$! wait_until_reachable } diff --git a/test/pod.bats b/test/pod.bats new file mode 100644 index 00000000..5217f5af --- /dev/null +++ b/test/pod.bats @@ -0,0 +1,28 @@ +#!/usr/bin/env bats + +load helpers + +function teardown() { + stop_ocid + cleanup_test +} + +# PR#59 +@test "pod release name on remove" { + skip "cannot be run in a container yet" + + start_ocid + run ocic pod create --config "$TESTDATA"/sandbox_config.json + [ "$status" -eq 0 ] + id="$output" + run ocic pod stop --id "$id" + [ "$status" -eq 0 ] + sleep 5 # FIXME: there's a race between container kill and delete below + run ocic pod remove --id "$id" + [ "$status" -eq 0 ] + run ocic pod create --config "$TESTDATA"/sandbox_config.json + [ "$status" -eq 0 ] + + # TODO: cleanup all the stuff from runc, meaning list pods and stop remove them + # pod list + pod stop + pod remove in cleanup +} diff --git a/testdata/README.md b/test/testdata/README.md similarity index 100% rename from testdata/README.md rename to test/testdata/README.md diff --git a/testdata/container_config.json b/test/testdata/container_config.json similarity index 100% rename from testdata/container_config.json rename to test/testdata/container_config.json diff --git a/testdata/container_exit_test.json b/test/testdata/container_exit_test.json similarity index 100% rename from testdata/container_exit_test.json rename to test/testdata/container_exit_test.json diff --git a/testdata/container_redis.json b/test/testdata/container_redis.json similarity index 100% rename from testdata/container_redis.json rename to test/testdata/container_redis.json diff --git a/testdata/sandbox_config.json b/test/testdata/sandbox_config.json similarity index 100% rename from testdata/sandbox_config.json rename to test/testdata/sandbox_config.json