summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2024-10-02 18:17:07 +0200
committerPhil Sutter <phil@nwl.cc>2024-11-06 11:00:21 +0100
commit4cbb233400e17664d817e4b638c2d8bb88b372ed (patch)
tree9b7969259b5ce900b316359060139ac72e053ea9 /tests
parent73a8adfc2432ec8337288cc90e7c9f4509139846 (diff)
tests: monitor: Run in own netns
Have the script call itself prefixed by unshare. This won't prevent clashing test case contents, but at least leave the host netns alone. Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/monitor/run-tests.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/monitor/run-tests.sh b/tests/monitor/run-tests.sh
index f1ac790a..214512d2 100755
--- a/tests/monitor/run-tests.sh
+++ b/tests/monitor/run-tests.sh
@@ -120,6 +120,14 @@ echo_run_test() {
return $rc
}
+netns=true
+for arg in "$@"; do
+ [[ "$arg" == "--no-netns" ]] && netns=false
+done
+if $netns; then
+ exec unshare -n $0 --no-netns "$@"
+fi
+
testcases=""
while [ -n "$1" ]; do
case "$1" in
@@ -131,6 +139,9 @@ while [ -n "$1" ]; do
test_json=true
shift
;;
+ --no-netns)
+ shift
+ ;;
-H|--host)
nft=nft
shift