From: Kirill Isakov Date: Tue, 20 Jul 2021 12:00:05 +0000 (+0600) Subject: Add cleanup hook for integration tests X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=commitdiff_plain;h=612ad2749ae504e6513748f881f0884ceeab2ed7 Add cleanup hook for integration tests --- diff --git a/test/ns-ping.test b/test/ns-ping.test index 54a9199c..417ed328 100755 --- a/test/ns-ping.test +++ b/test/ns-ping.test @@ -13,6 +13,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 </dev/null; then + echo >&2 "Cleanup hook found, calling..." + cleanup_hook + fi + stop_all_tincs # Ask nicely, then kill anything that's left.