From 859bda1936ee67a3da7a197f5207419493fffef0 Mon Sep 17 00:00:00 2001 From: Ed Santiago Date: Thu, 11 Apr 2019 16:14:13 -0600 Subject: new uidmap BATS test: fix Various problems, one of which was causing the test to fail completely (otherwise I wouldn't have caught the others): - option is --uidmap, not --uidmapping - run_podman cannot be piped (| grep /sys/kernel). That's an unfortunate limitation of BATS. Any invocation of 'run' saves results to $output, which then has to be tested in a separate step. - do so, using 'run' and 'grep' and 'is' to produce readable messages on failure - remove "$expected_rc", that looks like a copy/paste bug from a few lines above. Skip entire test if rootless. (The one without --net=host passes, but it also passes with older podman as both root and rootless. I don't think it's actually testing anything, but agree with leaving it in to catch weird regressions). We really need to get these tests running in CI. Signed-off-by: Ed Santiago --- test/system/030-run.bats | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'test/system') diff --git a/test/system/030-run.bats b/test/system/030-run.bats index 188070550..a29b1adc3 100644 --- a/test/system/030-run.bats +++ b/test/system/030-run.bats @@ -32,11 +32,15 @@ echo $rand | 0 | $rand } @test "podman run - uidmapping has no /sys/kernel mounts" { - run_podman $expected_rc run --uidmapping 0:100:10000 $IMAGE mount | grep /sys/kernel - is "$output" "" "podman run $cmd - output" + skip_if_rootless "cannot umount as rootless" - run_podman $expected_rc run --net host --uidmapping 0:100:10000 $IMAGE mount | grep /sys/kernel - is "$output" "" "podman run $cmd - output" + run_podman run --rm --uidmap 0:100:10000 $IMAGE mount + run grep /sys/kernel <(echo "$output") + is "$output" "" "unwanted /sys/kernel in 'mount' output" + + run_podman run --rm --net host --uidmap 0:100:10000 $IMAGE mount + run grep /sys/kernel <(echo "$output") + is "$output" "" "unwanted /sys/kernel in 'mount' output (with --net=host)" } # vim: filetype=sh -- cgit v1.2.3-54-g00ecf