Skip to content

Commit

Permalink
test: Mark the bom tests as slow. (#488)
Browse files Browse the repository at this point in the history
These tests are extremely slow.  We should probably use a different
container to test them in.  A recent run of c-i showed:

    ok 19 all container contents must be accounted for in 2617sec
    20 bom tool should work inside run in 1233sec

So these 2 tests accounted for 3850 seconds (64 minutes).

Signed-off-by: Scott Moser <smoser@brickies.net>
  • Loading branch information
smoser authored Sep 5, 2023
1 parent fdddd5b commit 2341b93
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
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 @@ -97,6 +97,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

0 comments on commit 2341b93

Please sign in to comment.