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" }