Merge pull request #653 from baude/images_json

cmd/kpod/images.go: Add JSON output option
This commit is contained in:
Mrunal Patel 2017-08-13 07:19:04 -07:00 committed by GitHub
commit 4311020c36
6 changed files with 155 additions and 60 deletions

View file

@ -201,6 +201,7 @@ function teardown() {
}
run ${KPOD_BINARY} $KPOD_OPTIONS rmi redis:alpine
@test "kpod inspect non-existent container" {
run ${KPOD_BINARY} $KPOD_OPTIONS inspect 14rcole/non-existent
echo "$output"
@ -227,3 +228,23 @@ function teardown() {
[ "$status" -eq 0]
run ${KPOD_BINARY} $KPOD_OPTIONS rmi redis:alpine
}
@test "kpod images" {
run ${KPOD_BINARY} $KPOD_OPTIONS pull debian:6.0.10
run ${KPOD_BINARY} $KPOD_OPTIONS images
[ "$status" -eq 0 ]
}
@test "kpod images test valid json" {
run ${KPOD_BINARY} $KPOD_OPTIONS pull debian:6.0.10
run ${KPOD_BINARY} $KPOD_OPTIONS images --format json
echo "$output" | python -m json.tool
[ "$status" -eq 0 ]
}
@test "kpod images check name json output" {
run ${KPOD_BINARY} $KPOD_OPTIONS pull debian:6.0.10
run ${KPOD_BINARY} $KPOD_OPTIONS images --format json
name=$(echo $output | python -c 'import sys; import json; print(json.loads(sys.stdin.read())[0])["names"][0]')
[ "$name" == "docker.io/library/debian:6.0.10" ]
}