test/system: speed up user namespace preserved root ownership

We don't have two loop twice for the stat call we can just stat both
dirs at once. This means we only have to create half of the containers
so the test is twice as fast.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2024-05-31 16:42:11 +02:00
parent c510959826
commit 6b021dd4ba

View File

@@ -308,12 +308,10 @@ echo $rand | 0 | $rand
for user in "--user=0" "--user=100"; do
for keepid in "" ${keep}; do
opts="$priv $user $keepid"
for dir in /etc /usr;do
run_podman run --rm $opts $IMAGE stat -c '%u:%g:%n' $dir
remove_same_dev_warning # grumble
is "$output" "0:0:$dir" "run $opts ($dir)"
done
run_podman run --rm $opts $IMAGE stat -c '%u:%g:%n' $dir /etc /usr
remove_same_dev_warning # grumble
is "${lines[0]}" "0:0:/etc" "run $opts /etc"
is "${lines[1]}" "0:0:/usr" "run $opts /usr"
done
done
done