diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/kpod_create.bats | 6 | ||||
-rw-r--r-- | test/kpod_exec.bats | 30 | ||||
-rw-r--r-- | test/kpod_history.bats | 6 | ||||
-rw-r--r-- | test/kpod_images.bats | 6 | ||||
-rw-r--r-- | test/kpod_ps.bats | 9 | ||||
-rw-r--r-- | test/kpod_rename.bats | 38 | ||||
-rw-r--r-- | test/kpod_rm.bats | 4 | ||||
-rw-r--r-- | test/kpod_rmi.bats | 4 | ||||
-rw-r--r-- | test/kpod_run.bats | 30 |
9 files changed, 76 insertions, 57 deletions
diff --git a/test/kpod_create.bats b/test/kpod_create.bats index 3d3efcff3..e1a187332 100644 --- a/test/kpod_create.bats +++ b/test/kpod_create.bats @@ -21,3 +21,9 @@ function teardown() { echo "$output" [ "$status" -eq 0 ] } + +@test "ensure short options" { + run ${KPOD_BINARY} ${KPOD_OPTIONS} create -dt ${BB_GLIBC} ls + echo "$output" + [ "$status" -eq 0 ] +} diff --git a/test/kpod_exec.bats b/test/kpod_exec.bats new file mode 100644 index 000000000..d495b1687 --- /dev/null +++ b/test/kpod_exec.bats @@ -0,0 +1,30 @@ +#!/usr/bin/env bats + +load helpers + +function teardown() { + cleanup_test +} + +function setup() { + copy_images +} + +@test "exec into a bogus container" { + run ${KPOD_BINARY} ${KPOD_OPTIONS} exec foobar ls + echo "$output" + [ "$status" -eq 1 ] +} + +@test "exec without command should fail" { + run ${KPOD_BINARY} ${KPOD_OPTIONS} exec foobar + echo "$output" + [ "$status" -eq 1 ] +} + +@test "exec simple command" { + ${KPOD_BINARY} ${KPOD_OPTIONS} run -d -t --name foobar1 ${ALPINE} sleep 60 + run ${KPOD_BINARY} ${KPOD_OPTIONS} exec foobar1 ls + echo "$output" + [ "$status" -eq 0 ] +} diff --git a/test/kpod_history.bats b/test/kpod_history.bats index 9ce2be079..5e99696b2 100644 --- a/test/kpod_history.bats +++ b/test/kpod_history.bats @@ -45,3 +45,9 @@ function setup() { echo "$output" [ "$status" -eq 0 ] } + +@test "kpod history short options" { + run ${KPOD_BINARY} ${KPOD_OPTIONS} history -qH $ALPINE + echo "$output" + [ "$status" -eq 0 ] +} diff --git a/test/kpod_images.bats b/test/kpod_images.bats index 6f0c53670..9812a33c5 100644 --- a/test/kpod_images.bats +++ b/test/kpod_images.bats @@ -40,3 +40,9 @@ function teardown() { echo "$output" [ "$status" -eq 0 ] } + +@test "kpod images short options" { + run ${KPOD_BINARY} ${KPOD_OPTIONS} images -qn + echo "$output" + [ "$status" -eq 0 ] +} diff --git a/test/kpod_ps.bats b/test/kpod_ps.bats index 859cbaa99..3a5d94f59 100644 --- a/test/kpod_ps.bats +++ b/test/kpod_ps.bats @@ -120,3 +120,12 @@ function teardown() { [ "$status" -eq 0 ] run ${KPOD_BINARY} ${KPOD_OPTIONS} stop $ctr_id } + +@test "kpod ps short options" { + run ${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} sleep 99 + ctr_id="$output" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -aqs + echo "$output" + [ "$status" -eq 0 ] + run ${KPOD_BINARY} ${KPOD_OPTIONS} stop $ctr_id +} diff --git a/test/kpod_rename.bats b/test/kpod_rename.bats deleted file mode 100644 index eb4e704fd..000000000 --- a/test/kpod_rename.bats +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env bats - -load helpers - -IMAGE="redis:alpine" - -function teardown() { - cleanup_test -} - -function setup() { - copy_images -} - -@test "kpod rename successful" { - skip "Test needs to be converted to kpod run" - start_crio - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE - echo "$output" - [ "$status" -eq 0 ] - run crioctl pod run --config "$TESTDATA"/sandbox_config.json - echo "$output" - pod_id="$output" - [ "$status" -eq 0 ] - run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id" - ctr_id="$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rename "$ctr_id" "$NEW_NAME" - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} $KPOD_OPTIONS inspect "$ctr_id" --format {{.Name}} - echo "$output" - [ "$status" -eq 0 ] - [ "$output" == "$NEW_NAME" ] - cleanup_ctrs - cleanup_pods - stop_crio -} diff --git a/test/kpod_rm.bats b/test/kpod_rm.bats index e9843659a..3a7821b56 100644 --- a/test/kpod_rm.bats +++ b/test/kpod_rm.bats @@ -60,12 +60,12 @@ function teardown() { [ "$status" -eq 0 ] } -@test "remove all containers with one running" { +@test "remove all containers with one running with short options" { ${KPOD_BINARY} ${KPOD_OPTIONS} create $BB ls ${KPOD_BINARY} ${KPOD_OPTIONS} create $BB ls -l ${KPOD_BINARY} ${KPOD_OPTIONS} create $BB whoami ${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} sleep 30 - run ${KPOD_BINARY} $KPOD_OPTIONS rm -a -f + run ${KPOD_BINARY} $KPOD_OPTIONS rm -af echo "$output" [ "$status" -eq 0 ] } diff --git a/test/kpod_rmi.bats b/test/kpod_rmi.bats index 77990d500..034fd9ab7 100644 --- a/test/kpod_rmi.bats +++ b/test/kpod_rmi.bats @@ -43,10 +43,10 @@ function pullImages() { [ "$status" -eq 0 ] } -@test "kpod rmi all images forceably" { +@test "kpod rmi all images forceably with short options" { pullImages ${KPOD_BINARY} $KPOD_OPTIONS create ${IMAGE1} ls - run ${KPOD_BINARY} $KPOD_OPTIONS rmi -a -f + run ${KPOD_BINARY} $KPOD_OPTIONS rmi -af echo "$output" [ "$status" -eq 0 ] } diff --git a/test/kpod_run.bats b/test/kpod_run.bats index 5f5377a5e..ccbeaac6c 100644 --- a/test/kpod_run.bats +++ b/test/kpod_run.bats @@ -16,6 +16,12 @@ function setup() { [ "$status" -eq 0 ] } +@test "run a container based on local image with short options" { + run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -dt $BB ls" + echo "$output" + [ "$status" -eq 0 ] +} + @test "run a container based on a remote image" { run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run ${BB_GLIBC} ls" echo "$output" @@ -65,25 +71,22 @@ function setup() { } @test "run environment test" { - - ${KPOD_BINARY} ${KPOD_OPTIONS} pull ${ALPINE} - - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -env FOO=BAR ${ALPINE} printenv FOO | tr -d '\r'" + run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run --env FOO=BAR ${ALPINE} printenv FOO | tr -d '\r'" echo "$output" [ "$status" -eq 0 ] [ $output = "BAR" ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -env PATH="/bin" ${ALPINE} printenv PATH | tr -d '\r'" + run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run --env PATH="/bin" ${ALPINE} printenv PATH | tr -d '\r'" echo "$output" [ "$status" -eq 0 ] [ $output = "/bin" ] - run bash -c "export FOO=BAR; ${KPOD_BINARY} ${KPOD_OPTIONS} run -env FOO ${ALPINE} printenv FOO | tr -d '\r'" + run bash -c "export FOO=BAR; ${KPOD_BINARY} ${KPOD_OPTIONS} run --env FOO ${ALPINE} printenv FOO | tr -d '\r'" echo "$output" [ "$status" -eq 0 ] [ "$output" = "BAR" ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -env FOO ${ALPINE} printenv" + run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run --env FOO ${ALPINE} printenv" echo "$output" [ "$status" -ne 0 ] @@ -122,16 +125,13 @@ IMAGE="docker.io/library/fedora:latest" } @test "kpod run with volume flag" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -v ${MOUNT_PATH}:/run/test ${FEDORA_MINIMAL} cat /proc/self/mountinfo | grep '${MOUNT_PATH} /run/test rw,relatime'" + run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -v ${MOUNT_PATH}:/run/test ${BB} cat /proc/self/mountinfo | grep '${MOUNT_PATH} /run/test rw,relatime'" + echo $output + [ "$status" -eq 0 ] + run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -v ${MOUNT_PATH}:/run/test:ro ${BB} cat /proc/self/mountinfo | grep '${MOUNT_PATH} /run/test ro,relatime'" echo $output [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -v ${MOUNT_PATH}:/run/test:ro ${FEDORA_MINIMAL} cat /proc/self/mountinfo | grep '${MOUNT_PATH} /run/test ro,relatime'" + run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -v ${MOUNT_PATH}:/run/test:shared ${BB} cat /proc/self/mountinfo | grep '${MOUNT_PATH} /run/test rw,relatime shared:'" echo $output [ "$status" -eq 0 ] - #run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -v ${MOUNT_PATH}:/run/test:shared ${FEDORA_MINIMAL} cat /proc/self/mountinfo | grep '${MOUNT_PATH} /run/test rw,relatime shared:'" - #echo $output - #[ "$status" -eq 0 ] - #run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -v ${MOUNT_PATH}:/run/test:rslave ${FEDORA_MINIMAL} cat /proc/self/mountinfo | grep '${MOUNT_PATH} /run/test rw,relatime master:'" - #echo $output - #[ "$status" -eq 0 ] } |