]> git.ipfire.org Git - thirdparty/nftables.git/commit
tests/shell: bind mount private /var/run/netns in test container
authorThomas Haller <thaller@redhat.com>
Wed, 6 Sep 2023 11:52:18 +0000 (13:52 +0200)
committerFlorian Westphal <fw@strlen.de>
Thu, 7 Sep 2023 17:35:20 +0000 (19:35 +0200)
commitdf6f1a3e08030c90510c6a817a1771276439efed
tree0f8c0e828964f3c69413e11f9102e0d1c55e4808
parent8ba377f5d1954bc662ec4bedfb2f3d7c1ae66428
tests/shell: bind mount private /var/run/netns in test container

Some tests want to run `ip netns add`, which requires write permissions
to /var/run/netns. Also, /var/run/netns would be a systemwide mount
path, and shared between the tests. We would want to isolate that.

Fix that by bind mount a tmpfs inside the test wrapper, if we appear to
have a private mount namespace.

Fixes

  $ ./tests/shell/run-tests.sh -- tests/shell/testcases/netns/0001nft-f_0

Optimally, `ip netns add` would allow to specify a private
location for those bind mounts.

It seems that iproute2 is build with /var/run/netns, instead the more
common /run/netns. Hence, handle /var/run instead of /run.

Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
tests/shell/helpers/test-wrapper.sh
tests/shell/run-tests.sh