X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=test%2Fns-ping.test;h=33e72708db7e579719bdff9ec89e049d39035e01;hb=df716df33af8e9a5b93d573a023ecd7fc24d9a03;hp=54a9199c17e476ae83b0d8b20286210c63b2cbc8;hpb=4fbaf80d56a418ebd23eeace9053fa8f20097f77;p=tinc diff --git a/test/ns-ping.test b/test/ns-ping.test index 54a9199c..33e72708 100755 --- a/test/ns-ping.test +++ b/test/ns-ping.test @@ -1,18 +1,26 @@ #!/bin/sh -# shellcheck source=testlib.sh -. ./testlib.sh +# shellcheck disable=SC1090 +. "$TESTLIB_PATH" -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 -test -e /dev/net/tun || exit $EXIT_SKIP_TEST -ip netns list || exit $EXIT_SKIP_TEST +require_root "$0" "$@" +test -e /dev/net/tun || exit "$EXIT_SKIP_TEST" +ip netns list || exit "$EXIT_SKIP_TEST" 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 <