2017-08-01 20:47:12 +00:00
|
|
|
#/usr/bin/env bats
|
|
|
|
|
|
|
|
load helpers
|
|
|
|
|
|
|
|
IMAGE="alpine:latest"
|
|
|
|
ROOT="$TESTDIR/crio"
|
|
|
|
RUNROOT="$TESTDIR/crio-run"
|
2017-08-30 20:03:26 +00:00
|
|
|
KPOD_OPTIONS="--root $ROOT --runroot $RUNROOT $STORAGE_OPTS"
|
2017-08-01 20:47:12 +00:00
|
|
|
|
|
|
|
function teardown() {
|
|
|
|
cleanup_test
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "test diff of image and parent" {
|
|
|
|
run ${KPOD_BINARY} $KPOD_OPTIONS pull $IMAGE
|
2017-08-30 20:03:26 +00:00
|
|
|
echo "$output"
|
2017-08-01 20:47:12 +00:00
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
run ${KPOD_BINARY} $KPOD_OPTIONS diff $IMAGE
|
2017-08-30 20:03:26 +00:00
|
|
|
echo "$output"
|
2017-08-01 20:47:12 +00:00
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
echo "$output"
|
|
|
|
run ${KKPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "test diff on non-existent layer" {
|
|
|
|
run ${KPOD_BINARY} $KPOD_OPTIONS diff "abc123"
|
|
|
|
[ "$status" -ne 0 ]
|
|
|
|
echo "$output"
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "test diff with json output" {
|
|
|
|
run ${KPOD_BINARY} $KPOD_OPTIONS pull $IMAGE
|
2017-08-30 20:03:26 +00:00
|
|
|
echo "$output"
|
2017-08-01 20:47:12 +00:00
|
|
|
[ "$status" -eq 0 ]
|
2017-08-14 19:32:00 +00:00
|
|
|
# run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} diff --format json $IMAGE | python -m json.tool"
|
|
|
|
run ${KPOD_BINARY} $KPOD_OPTIONS diff --format json $IMAGE
|
2017-08-01 20:47:12 +00:00
|
|
|
echo "$output"
|
2017-08-30 20:03:26 +00:00
|
|
|
[ "$status" -eq 0 ]
|
2017-08-01 20:47:12 +00:00
|
|
|
run ${KKPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE
|
|
|
|
}
|