summaryrefslogtreecommitdiff
path: root/test/system/110-history.bats
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-03-07 15:23:54 -0800
committerGitHub <noreply@github.com>2019-03-07 15:23:54 -0800
commit1b2f8679b864b882fdccaad6fdd6a5c86c83291b (patch)
treee131eaf7fbecf6c36ca6f21468cef6bd8ebac4cd /test/system/110-history.bats
parente0f224816d41ccf353bccd9ef6933a201cdc7d64 (diff)
parent589248d2f359dea73fc763ac587e2927f005b300 (diff)
downloadpodman-1b2f8679b864b882fdccaad6fdd6a5c86c83291b.tar.gz
podman-1b2f8679b864b882fdccaad6fdd6a5c86c83291b.tar.bz2
podman-1b2f8679b864b882fdccaad6fdd6a5c86c83291b.zip
Merge pull request #2533 from edsantiago/bats
New system tests under BATS
Diffstat (limited to 'test/system/110-history.bats')
-rw-r--r--test/system/110-history.bats49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/system/110-history.bats b/test/system/110-history.bats
new file mode 100644
index 000000000..84a1e42b4
--- /dev/null
+++ b/test/system/110-history.bats
@@ -0,0 +1,49 @@
+#!/usr/bin/env bats
+
+load helpers
+
+@test "podman history - basic tests" {
+ tests="
+ | .*[0-9a-f]\\\{12\\\} .* CMD .* LABEL
+--format '{{.ID}} {{.Created}}' | .*[0-9a-f]\\\{12\\\} .* ago
+--human=false | .*[0-9a-f]\\\{12\\\} *[0-9-]\\\+T[0-9:]\\\+Z
+-qH | .*[0-9a-f]\\\{12\\\}
+--no-trunc | .*[0-9a-f]\\\{64\\\}
+"
+
+ parse_table "$tests" | while read options expect; do
+ if [ "$options" = "''" ]; then options=; fi
+
+ eval set -- "$options"
+
+ run_podman history "$@" $IMAGE
+ is "$output" "$expect" "podman history $options"
+ done
+}
+
+@test "podman history - json" {
+ tests="
+id | [0-9a-f]\\\{64\\\}
+created | [0-9-]\\\+T[0-9:]\\\+\\\.[0-9]\\\+Z
+size | -\\\?[0-9]\\\+
+"
+
+ run_podman history --format json $IMAGE
+
+ parse_table "$tests" | while read field expect; do
+ # HACK: we can't include '|' in the table
+ if [ "$field" = "id" ]; then expect="$expect\|<missing>";fi
+
+ # output is an array of dicts; check each one
+ count=$(echo "$output" | jq '. | length')
+ i=0
+ while [ $i -lt $count ]; do
+ actual=$(echo "$output" | jq -r ".[$i].$field")
+ is "$actual" "$expect\$" "jq .[$i].$field"
+ i=$(expr $i + 1)
+ done
+ done
+
+}
+
+# vim: filetype=sh