X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=test%2Fns-ping.test;h=8e10d11ed064b331725ff12ce46490899aea5011;hb=77cd819058de43a5fcea54300dde50e03088c318;hp=5931c75ff0c542cbe13c73e0971424d27885bc12;hpb=046a10d692d1ac22de4daf783ee4fe025c4eb6ec;p=tinc diff --git a/test/ns-ping.test b/test/ns-ping.test index 5931c75f..8e10d11e 100755 --- a/test/ns-ping.test +++ b/test/ns-ping.test @@ -1,11 +1,8 @@ #!/bin/sh -# shellcheck source=testlib.sh -. "${0%/*}/testlib.sh" +. ./testlib.sh -echo "[STEP] Skip this test if we aren't root or if 'ip netns' does not exist" - -test "$(id -u)" = "0" || exit $EXIT_SKIP_TEST +require_root "$0" "$@" test -e /dev/net/tun || exit $EXIT_SKIP_TEST ip netns list || exit $EXIT_SKIP_TEST @@ -13,6 +10,16 @@ ip_foo=192.168.1.1 ip_bar=192.168.1.2 mask=24 +echo [STEP] Create network namespaces + +ip netns add ping.test1 +ip netns add ping.test2 + +cleanup_hook() { + ip netns del ping.test1 + ip netns del ping.test2 +} + echo [STEP] Initialize two nodes tinc foo <