podman/test/system/140-diff.bats
Ed Santiago a4fcf09b7a Reenable remote system tests
podman-remote is in better shape now. Let's see what needs
to be done to reenable remote system tests.

 - logs test: skip multilog, it doesn't work remote

 - diff test: use -l only when local, not with remote

 - many other tests: skip_if_remote, with 'FIXME: pending #xxxx'
   where xxxx is a filed issue.

Unrelated: added new helper to skip_if_remote and _if_rootless,
where we check if the source message includes "remote"/"rootless"
and insert it if missing. This is a minor usability enhancement
to make it easier to understand at-a-glance why a skip triggers.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-08-03 09:36:36 -06:00

36 lines
787 B
Bash

#!/usr/bin/env bats -*- bats -*-
#
# Tests for podman diff
#
load helpers
@test "podman diff" {
n=$(random_string 10) # container name
rand_file=$(random_string 10)
run_podman run --name $n $IMAGE sh -c "touch /$rand_file;rm /etc/services"
# If running local, test `-l` (latest) option. This can't work with remote.
if ! is_remote; then
n=-l
fi
run_podman diff --format json $n
# 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 $n
}
# vim: filetype=sh