2017-08-31 12:46:26 +00:00
|
|
|
#!/usr/bin/env bats
|
2017-08-01 20:47:12 +00:00
|
|
|
|
|
|
|
load helpers
|
|
|
|
|
|
|
|
IMAGE="alpine:latest"
|
|
|
|
|
|
|
|
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 ]
|
2017-08-31 12:46:26 +00:00
|
|
|
run ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE
|
2017-08-01 20:47:12 +00:00
|
|
|
echo "$output"
|
2017-08-31 12:46:26 +00:00
|
|
|
[ "$status" -eq 0 ]
|
2017-08-01 20:47:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "test diff on non-existent layer" {
|
|
|
|
run ${KPOD_BINARY} $KPOD_OPTIONS diff "abc123"
|
|
|
|
echo "$output"
|
2017-08-31 12:46:26 +00:00
|
|
|
[ "$status" -ne 0 ]
|
2017-08-01 20:47:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@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-31 12:46:26 +00:00
|
|
|
run ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE
|
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2017-08-01 20:47:12 +00:00
|
|
|
}
|