From ce50e1da7ea9ff5274f6ebd80040d3254e204239 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Sun, 9 Aug 2020 13:24:01 -0700 Subject: [PATCH] test/int/spec.bats: simplify setup/teardown 1. cd is useless as all the paths are absolute 2. run is redundant, does not make sense to use it 3. use mkdir -p to save a line of code This also eliminates shellcheck warnings like this one: > In spec.bats line 8: > cd "$INTEGRATION_ROOT" > ^--------------------^ SC2164: Use 'cd ... || exit' or 'cd ... || return' in case cd fails. Signed-off-by: Kir Kolyshkin --- tests/integration/spec.bats | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/tests/integration/spec.bats b/tests/integration/spec.bats index 1aa38815..e344dbd4 100644 --- a/tests/integration/spec.bats +++ b/tests/integration/spec.bats @@ -4,18 +4,15 @@ load helpers function setup() { # initial cleanup in case a prior test exited and did not cleanup - cd "$INTEGRATION_ROOT" - run rm -f -r "$HELLO_BUNDLE" + rm -rf "$HELLO_BUNDLE" # setup hello-world for spec generation testing - run mkdir "$HELLO_BUNDLE" - run mkdir "$HELLO_BUNDLE"/rootfs - run tar -C "$HELLO_BUNDLE"/rootfs -xf "$HELLO_IMAGE" + mkdir -p "$HELLO_BUNDLE"/rootfs + tar -C "$HELLO_BUNDLE"/rootfs -xf "$HELLO_IMAGE" } function teardown() { - cd "$INTEGRATION_ROOT" - run rm -f -r "$HELLO_BUNDLE" + rm -rf "$HELLO_BUNDLE" } @test "spec generation cwd" {