Refactor kpod tests

Move kpod tests from kpod.bats to kpod_[commandname].bats
Also make sure all status checks have a echo $output before them.

Signed-off-by: Ryan Cole <rcyoalne@gmail.com>

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Signed-off-by: umohnani8 <umohnani@redhat.com>
This commit is contained in:
Daniel J Walsh 2017-08-31 08:46:26 -04:00 committed by umohnani8
parent e838611fdd
commit e16bb3feb3
19 changed files with 350 additions and 295 deletions

View file

@ -2,10 +2,6 @@
load helpers
ROOT="$TESTDIR/crio"
RUNROOT="$TESTDIR/crio-run"
KPOD_OPTIONS="--root $ROOT --runroot $RUNROOT $STORAGE_OPTS"
function teardown() {
cleanup_test
}
@ -23,7 +19,7 @@ function teardown() {
run crioctl ctr start --id "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS stats --no-stream "$ctr_id"
run ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs
@ -41,7 +37,7 @@ function teardown() {
echo "$output"
[ "$status" -eq 0 ]
ctr_id="$output"
run ${KPOD_BINARY} $KPOD_OPTIONS stats --no-stream
run ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs
@ -59,7 +55,7 @@ function teardown() {
echo "$output"
[ "$status" -eq 0 ]
ctr_id="$output"
run ${KPOD_BINARY} $KPOD_OPTIONS stats --no-stream --all
run ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream --all
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs
@ -80,7 +76,8 @@ function teardown() {
run crioctl ctr start --id "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS stats --no-stream --format {{.ID}} "$ctr_id"
run ${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
@ -98,7 +95,7 @@ function teardown() {
echo "$output"
[ "$status" -eq 0 ]
ctr_id="$output"
run timeout 5s bash -c "${KPOD_BINARY} $KPOD_OPTIONS stats --all"
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