Skip to content

Commit

Permalink
test all suites by default
Browse files Browse the repository at this point in the history
  • Loading branch information
cam-schultz committed Oct 15, 2024
1 parent 098442e commit 646e4dd
Showing 1 changed file with 30 additions and 21 deletions.
51 changes: 30 additions & 21 deletions scripts/local/e2e_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,24 @@ function printHelp() {
function printUsage() {
cat << EOF
Arguments:
--component <component> Component test suite to run. Must be a valid directory in tests/local/
--components component1,component2 Comma separated list of test suites to run. Valid components are:
$(echo $valid_components | tr ' ' '\n' | sort | tr '\n' ' ')
(default: all)
Options:
--help Print this help message
--help Print this help message
EOF
}

component=
valid_components=$(ls -d $TELEPORTER_PATH/tests/local/*/ | xargs -n 1 basename)
components=

while [ $# -gt 0 ]; do
case "$1" in
--component)
--components)
if [[ $2 != --* ]]; then
component=$2
components=$2
else
echo "Invalid component $2" && printHelp && exit 1
echo "Invalid components $2" && printHelp && exit 1
fi
shift;;
--help)
Expand All @@ -43,14 +46,17 @@ while [ $# -gt 0 ]; do
shift
done

# Exit if no component is provided
if [ -z "$component" ]; then
echo "No component provided" && exit 1
# Run all suites if no component is provided
if [ -z "$components" ]; then
components=$valid_components
fi

if [ ! -d "./tests/local/$component" ]; then
echo "Component test suite not found" && exit 1
fi
# Exit if invalid component is provided
for component in $(echo $components | tr ',' ' '); do
if [[ $valid_components != *$component* ]]; then
echo "Invalid component $component" && exit 1
fi
done

source "$TELEPORTER_PATH"/scripts/constants.sh
source "$TELEPORTER_PATH"/scripts/versions.sh
Expand Down Expand Up @@ -81,15 +87,18 @@ cd "$TELEPORTER_PATH"
# to install the ginkgo binary (required for test build and run)
go install -v github.com/onsi/ginkgo/v2/ginkgo@${GINKGO_VERSION}

ginkgo build ./tests/local/$component
for component in $(echo $components | tr ',' ' '); do
echo "Building e2e tests for $component"
ginkgo build ./tests/local/$component

# Run the tests
echo "Running e2e tests $RUN_E2E"
RUN_E2E=true ./tests/local/$component/$component.test \
--ginkgo.vv \
--ginkgo.label-filter=${GINKGO_LABEL_FILTER:-""} \
--ginkgo.focus=${GINKGO_FOCUS:-""} \
--ginkgo.trace
echo "Running e2e tests for $component"
RUN_E2E=true ./tests/local/$component/$component.test \
--ginkgo.vv \
--ginkgo.label-filter=${GINKGO_LABEL_FILTER:-""} \
--ginkgo.focus=${GINKGO_FOCUS:-""} \
--ginkgo.trace

echo "e2e tests passed"
echo "$component e2e tests passed"
echo ""
done
exit 0

0 comments on commit 646e4dd

Please sign in to comment.