summaryrefslogtreecommitdiff
path: root/test/system/140-diff.bats
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2020-10-03 06:56:42 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2020-10-15 09:51:15 -0400
commit22c8270135620bbbeb988076378173e452ec04af (patch)
tree656db8df0719d224b830acdefdb08019b1b61db6 /test/system/140-diff.bats
parenta1d5a518d3e9db785b7f15e07c679b9ae041ccae (diff)
downloadpodman-22c8270135620bbbeb988076378173e452ec04af.tar.gz
podman-22c8270135620bbbeb988076378173e452ec04af.tar.bz2
podman-22c8270135620bbbeb988076378173e452ec04af.zip
fix podman container exists and diff for storage containers
Current these commands only check if a container exists in libpod. With this fix, the commands will also check if they are in containers/storage. This allows users to look at differences within a buildah or CRI-O container. Currently buildah diff does not exists, so this helps out in that situation as well as in CRI-O since the cri does not implement a diff command. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'test/system/140-diff.bats')
-rw-r--r--test/system/140-diff.bats22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/system/140-diff.bats b/test/system/140-diff.bats
index 01ec5430e..d0f33e438 100644
--- a/test/system/140-diff.bats
+++ b/test/system/140-diff.bats
@@ -32,4 +32,26 @@ load helpers
run_podman rm $n
}
+@test "podman diff with buildah container " {
+ rand_file=$(random_string 10)
+ run buildah from --name buildahctr $IMAGE
+ run buildah run buildahctr sh -c "touch /$rand_file;rm /etc/services"
+
+ run_podman diff --format json buildahctr
+
+ # Expected results for each type of diff
+ declare -A expect=(
+ [added]="/$rand_file"
+ [changed]="/etc"
+ [deleted]="/etc/services"
+ )
+
+ for field in ${!expect[@]}; do
+ result=$(jq -r -c ".${field}[]" <<<"$output")
+ is "$result" "${expect[$field]}" "$field"
+ done
+
+ run buildah rm buildahctr
+}
+
# vim: filetype=sh