diff --git a/scripts/local/e2e_test.sh b/scripts/local/e2e_test.sh index 7bd5acbbc..783a898f2 100755 --- a/scripts/local/e2e_test.sh +++ b/scripts/local/e2e_test.sh @@ -18,21 +18,24 @@ function printHelp() { function printUsage() { cat << EOF Arguments: - --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) @@ -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 @@ -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