aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2022-11-28 18:25:14 +0100
committerEgor Tensin <Egor.Tensin@gmail.com>2022-11-28 18:25:14 +0100
commit3240f3efef849b0f09ee3101a75bcd3d48775668 (patch)
tree885df193fa3212ac616c9fb367074c9659fbadef
parenttest: rename peers (diff)
downloadwg-api-web-3240f3efef849b0f09ee3101a75bcd3d48775668.tar.gz
wg-api-web-3240f3efef849b0f09ee3101a75bcd3d48775668.zip
test: fix error handling
-rwxr-xr-xtest/test.sh14
1 files changed, 8 insertions, 6 deletions
diff --git a/test/test.sh b/test/test.sh
index 78aa164..665f8e9 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -132,12 +132,14 @@ cleanup() {
echo Cleaning up
echo ------------------------------------------------------------------
- local name
- find "$base_dir/devices" -mindepth 1 -maxdepth 1 -type d -printf '%P\0' \
- | while IFS= read -d '' -r name; do
- echo "Removing interface: $name"
- ip link delete "$name" type wireguard || true
- done
+ if [ -d "$base_dir/devices" ]; then
+ local name
+ find "$base_dir/devices" -mindepth 1 -maxdepth 1 -type d -printf '%P\0' \
+ | while IFS= read -d '' -r name; do
+ echo "Removing interface: $name"
+ ip link delete "$name" type wireguard || true
+ done
+ fi
echo "Removing $base_dir"
rm -rf -- "$base_dir"