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() {
# 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" {