From 99d5c0231fff54657f890b3eb9ffe50ff3133db6 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Mon, 28 Feb 2022 18:33:43 -0800 Subject: [PATCH] tests/int/{root,list}.bats: ALT_ROOT fixups in teardown 1. Add "unset ALT_ROOT" since it should not be used after teardown is called. 2. Remove "rm -rf $ALT_ROOT". It is not needed, because ALT_ROOT is a subdirectory of ROOT, which is removed in teardown_bundle. 3. Checking for ALT_ROOT being non-empty is a leftover from the era when teardown() was called as the first step from setup(). Since commit 41670e21f0f36390ee9cb this is no longer the case, so the condition is no longer needed (plus, the `set -u` which is about to be added should catch any possible use of unset ALT_ROOT). Signed-off-by: Kir Kolyshkin --- tests/integration/list.bats | 5 ++--- tests/integration/root.bats | 6 ++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/tests/integration/list.bats b/tests/integration/list.bats index 9d25dfd36..a22dd19a4 100644 --- a/tests/integration/list.bats +++ b/tests/integration/list.bats @@ -9,9 +9,8 @@ function setup() { } function teardown() { - if [ -n "$ALT_ROOT" ]; then - ROOT="$ALT_ROOT" teardown_bundle - fi + ROOT="$ALT_ROOT" teardown_bundle + unset ALT_ROOT teardown_bundle } diff --git a/tests/integration/root.bats b/tests/integration/root.bats index 53bd1ce56..68bdf5e76 100644 --- a/tests/integration/root.bats +++ b/tests/integration/root.bats @@ -9,10 +9,8 @@ function setup() { } function teardown() { - if [ -n "$ALT_ROOT" ]; then - ROOT=$ALT_ROOT __runc delete -f test_dotbox - rm -rf "$ALT_ROOT" - fi + ROOT=$ALT_ROOT __runc delete -f test_dotbox + unset ALT_ROOT teardown_bundle }