Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Mark the bom tests as slow. #488

Merged
merged 1 commit into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions test/bom.bats
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function teardown() {
}

@test "all container contents must be accounted for" {
skip_slow_test
cat > stacker.yaml <<EOF
bom-parent:
from:
Expand Down Expand Up @@ -66,6 +67,7 @@ EOF
}

@test "bom tool should work inside run" {
skip_slow_test
cat > stacker.yaml <<EOF
bom-parent:
from:
Expand Down
12 changes: 3 additions & 9 deletions test/convert.bats
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ EOF
}

@test "alpine" {
if [ -z "${SLOW_TEST}" ]; then
skip "test since slow tests are not enabled"
fi
skip_slow_test
git clone https://github.com/alpinelinux/docker-alpine.git
chmod -R a+rwx docker-alpine
cd docker-alpine
Expand All @@ -65,9 +63,7 @@ EOF
}

@test "elasticsearch" {
if [ -z "${SLOW_TEST}" ]; then
skip "test since slow tests are not enabled"
fi
skip_slow_test
git clone https://github.com/elastic/dockerfiles.git
chmod -R a+rwx dockerfiles
cd dockerfiles/elasticsearch
Expand All @@ -81,9 +77,7 @@ EOF
}

@test "python" {
if [ -z "${SLOW_TEST}" ]; then
skip "test since slow tests are not enabled"
fi
skip_slow_test
git clone https://github.com/docker-library/python.git
cd python/3.11/alpine3.17
chmod -R a+rw .
Expand Down
10 changes: 10 additions & 0 deletions test/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@ function require_privilege {
[ "$PRIVILEGE_LEVEL" = "$1" ] || skip "test not valid for privilege level $PRIVILEGE_LEVEL"
}

function skip_slow_test {
case "${SLOW_TEST:-false}" in
true) return;;
false) skip "${BATS_TEST_NAME} is slow. Set SLOW_TEST=true to run.";;
*) stderr "SLOW_TEST variable must be 'true' or 'false'" \
"found '${SLOW_TEST}'"
return 1;;
esac
}

function tmpd() {
mktemp -d "${PWD}/stackertest${1:+-$1}.XXXXXX"
}
Expand Down