mirror of
https://github.com/containers/podman
synced 2024-10-20 09:13:46 +00:00
e0bc8ffb59
RHEL8 rootless gating tests are inconsistently failing with: $ podman diff --format json -l # {"changed":["/etc"],"added":["/sys/fs","/sys/fs/cgroup","/pMOm1Q0fnN"],"deleted":["/etc/services"]} # #/vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv # #| FAIL: added # #| expected: '/pMOm1Q0fnN' # #| actual: '/sys/fs' # #| > '/sys/fs/cgroup' # #| > '/pMOm1Q0fnN' # #\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Reason: PR #8561, I think (something to do with /sys on RHEL). Workaround: ignore '/sys/fs' in diffs. Signed-off-by: Ed Santiago <santiago@redhat.com>
63 lines
1.7 KiB
Bash
63 lines
1.7 KiB
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
|
|
# ARGH! The /sys/fs kludgery is for RHEL8 rootless, which mumble mumble
|
|
# does some sort of magic muckery with /sys - I think the relevant
|
|
# PR is https://github.com/containers/podman/pull/8561
|
|
# Anyhow, without the egrep below, this test fails about 50% of the
|
|
# time on rootless RHEL8. (No, I don't know why it's not 100%).
|
|
result=$(jq -r -c ".${field}[]" <<<"$output" | egrep -v '^/sys/fs')
|
|
is "$result" "${expect[$field]}" "$field"
|
|
done
|
|
|
|
run_podman rm $n
|
|
}
|
|
|
|
@test "podman diff with buildah container " {
|
|
rand_file=$(random_string 10)
|
|
buildah from --name buildahctr $IMAGE
|
|
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
|
|
|
|
buildah rm buildahctr
|
|
}
|
|
|
|
# vim: filetype=sh
|