diff options
author | baude <bbaude@redhat.com> | 2017-12-04 15:06:06 -0600 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2017-12-13 21:15:09 +0000 |
commit | 9cc0c8ae143070c4d4ee691cab6a0fd0ebcaa538 (patch) | |
tree | 9736c47af7246c93e2e2b6d6d246653ca57cc316 /test/kpod_stats.bats | |
parent | 61f606e192ad67b4819a909a6f1b18c41e33db2d (diff) | |
download | podman-9cc0c8ae143070c4d4ee691cab6a0fd0ebcaa538.tar.gz podman-9cc0c8ae143070c4d4ee691cab6a0fd0ebcaa538.tar.bz2 podman-9cc0c8ae143070c4d4ee691cab6a0fd0ebcaa538.zip |
kpod stats
Move kpod stats to the libpod backend.
Signed-off-by: baude <bbaude@redhat.com>
Closes: #113
Approved by: baude
Diffstat (limited to 'test/kpod_stats.bats')
-rw-r--r-- | test/kpod_stats.bats | 101 |
1 files changed, 24 insertions, 77 deletions
diff --git a/test/kpod_stats.bats b/test/kpod_stats.bats index b98c83c90..8eb112496 100644 --- a/test/kpod_stats.bats +++ b/test/kpod_stats.bats @@ -10,104 +10,51 @@ function setup() { copy_images } -@test "stats single output" { - skip "Test needs to be converted to kpod run" - start_crio - run crioctl pod run --config "$TESTDATA"/sandbox_config.json +@test "stats should run with no containers" { + run ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream echo "$output" [ "$status" -eq 0 ] - pod_id="$output" - run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id" +} + +@test "stats with bogus container id" { + run ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream 123 echo "$output" - [ "$status" -eq 0 ] + [ "$status" -eq 1 ] +} + +@test "stats on a running container" { + run ${KPOD_BINARY} ${KPOD_OPTIONS} run -d -t ${ALPINE} sleep 99 ctr_id="$output" - run crioctl ctr start --id "$ctr_id" echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream "$ctr_id" + run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream $ctr_id" echo "$output" [ "$status" -eq 0 ] - cleanup_ctrs - cleanup_pods - stop_crio } -@test "stats does not output stopped container" { - skip "Test needs to be converted to kpod run" - start_crio - run crioctl pod run --config "$TESTDATA"/sandbox_config.json - echo "$output" - [ "$status" -eq 0 ] - pod_id="$output" - run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id" - echo "$output" - [ "$status" -eq 0 ] - ctr_id="$output" - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream +@test "stats on a running container no id" { + ${KPOD_BINARY} ${KPOD_OPTIONS} run -d -t ${ALPINE} sleep 99 + run ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream echo "$output" [ "$status" -eq 0 ] - cleanup_ctrs - cleanup_pods - stop_crio } -@test "stats outputs stopped container with all flag" { - skip "Test needs to be converted to kpod run" - start_crio - run crioctl pod run --config "$TESTDATA"/sandbox_config.json +@test "stats on all containers" { + ${KPOD_BINARY} ${KPOD_OPTIONS} run -d -t ${ALPINE} ls + run ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream -a echo "$output" [ "$status" -eq 0 ] - pod_id="$output" - run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id" - echo "$output" - [ "$status" -eq 0 ] - ctr_id="$output" - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream --all - echo "$output" - [ "$status" -eq 0 ] - cleanup_ctrs - cleanup_pods - stop_crio } -@test "stats output only id" { - skip "Test needs to be converted to kpod run" - start_crio - run crioctl pod run --config "$TESTDATA"/sandbox_config.json - echo "$output" - [ "$status" -eq 0 ] - pod_id="$output" - run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id" - echo "$output" - [ "$status" -eq 0 ] - ctr_id="$output" - run crioctl ctr start --id "$ctr_id" +@test "stats only output IDs" { + ${KPOD_BINARY} ${KPOD_OPTIONS} run -d -t ${ALPINE} sleep 99 + run ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream --format "{{.Container}}" echo "$output" [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream --format {{.ID}} "$ctr_id" - echo "$output" - [ "$status" -eq 0 ] - # once ps is implemented, run ps -q and see if that equals the output from above - cleanup_ctrs - cleanup_pods - stop_crio } -@test "stats streaming output" { - skip "Test needs to be converted to kpod run" - start_crio - run crioctl pod run --config "$TESTDATA"/sandbox_config.json - echo "$output" - [ "$status" -eq 0 ] - pod_id="$output" - run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id" +@test "stats json output" { + ${KPOD_BINARY} ${KPOD_OPTIONS} run -d -t ${ALPINE} ls + run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream -a --format json | python -m json.tool" echo "$output" [ "$status" -eq 0 ] - ctr_id="$output" - run timeout 5s bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} stats --all" - echo "$output" - [ "$status" -eq 124 ] #124 is the status set by timeout when it has to kill the command at the end of the given time - cleanup_ctrs - cleanup_pods - stop_crio } |