podman/test/system/140-diff.bats
Ed Santiago 1298f19773 more BATS tests
- run: --name (includes 'podman container exists' tests)
- run: --pull (always, never, missing)
- build: new test for ADD URL (#4420)
- exec: new test for issue #4785 (pipe getting lost)
- diff: new test
- selinux (mostly copied from docker-autotest)

Plus a bug fix: the wait_for_output() helper would continue
checking, eventually timing out, even if the container had
already exited (probably because of an error). Fix: as
part of the loop, run 'podman inspect' and bail out if
container is not running. Include exit code and logs.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-01-13 06:29:52 -07:00

29 lines
598 B
Bash

#!/usr/bin/env bats -*- bats -*-
#
# Tests for podman diff
#
load helpers
@test "podman diff" {
rand_file=$(random_string 10)
run_podman run $IMAGE sh -c "touch /$rand_file;rm /etc/services"
run_podman diff --format json -l
# 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_podman rm -l
}
# vim: filetype=sh