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 <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin 2020-08-09 13:24:01 -07:00
parent 699fdf8952
commit ce50e1da7e
1 changed files with 4 additions and 7 deletions

View File

@ -4,18 +4,15 @@ load helpers
function setup() { function setup() {
# initial cleanup in case a prior test exited and did not cleanup # initial cleanup in case a prior test exited and did not cleanup
cd "$INTEGRATION_ROOT" rm -rf "$HELLO_BUNDLE"
run rm -f -r "$HELLO_BUNDLE"
# setup hello-world for spec generation testing # setup hello-world for spec generation testing
run mkdir "$HELLO_BUNDLE" mkdir -p "$HELLO_BUNDLE"/rootfs
run mkdir "$HELLO_BUNDLE"/rootfs tar -C "$HELLO_BUNDLE"/rootfs -xf "$HELLO_IMAGE"
run tar -C "$HELLO_BUNDLE"/rootfs -xf "$HELLO_IMAGE"
} }
function teardown() { function teardown() {
cd "$INTEGRATION_ROOT" rm -rf "$HELLO_BUNDLE"
run rm -f -r "$HELLO_BUNDLE"
} }
@test "spec generation cwd" { @test "spec generation cwd" {