From 5d46601c4fa7916252b217cf78eb9e7ca9a8da23 Mon Sep 17 00:00:00 2001 From: Ramkumar Chinchani Date: Mon, 6 Nov 2023 17:31:48 +0000 Subject: [PATCH] add Signed-off-by: Ramkumar Chinchani --- test/helpers.bash | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/helpers.bash b/test/helpers.bash index c56fc5bc..6a212c72 100644 --- a/test/helpers.bash +++ b/test/helpers.bash @@ -204,7 +204,17 @@ function zot_teardown { function test_copy_buffer_size() { local buffer_size=$1 local file_type=$2 - cd "$BATS_TEST_TMPDIR" + + # create a temporary dir + local tmpdir=$(mktemp -d "$BATS_TEST_TMPDIR") + cd "$tmpdir" + if [ "$PRIVILEGE_LEVEL" = "priv" ]; then + return + fi + + "${ROOT_DIR}/stacker" unpriv-setup + chown -R $SUDO_USER:$SUDO_USER . + mkdir folder1 truncate -s $buffer_size folder1/file1 if [ $file_type = "tar" ] @@ -245,4 +255,5 @@ EOF stacker clean rm -rf folder1 cd "$ROOT_DIR" + rm -rf "tmpdir" }