From 612ad2749ae504e6513748f881f0884ceeab2ed7 Mon Sep 17 00:00:00 2001 From: Kirill Isakov Date: Tue, 20 Jul 2021 18:00:05 +0600 Subject: [PATCH] Add cleanup hook for integration tests --- test/ns-ping.test | 17 ++++++++++------- test/testlib.sh.in | 5 +++++ 2 files changed, 15 insertions(+), 7 deletions(-) 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. -- 2.20.1