From 46823d0bf302c3272f45d5f2be876a20bdbeaeee Mon Sep 17 00:00:00 2001 From: Andrea Frittoli Date: Mon, 29 Nov 2021 21:48:42 +0000 Subject: [PATCH] Add some env variables to the e2e script Add three switches (env variables) in the main e2e script, that can be used to: - skip setting up the test environment - skip running the YAML based tests - set the feature gate (this is also available as ENV var They are useful for setting up the E2E tests in KinD clusters, as well as generally useful for development purposes. Signed-off-by: Andrea Frittoli --- test/e2e-tests-kind.env | 3 +++ test/e2e-tests.sh | 25 +++++++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 test/e2e-tests-kind.env diff --git a/test/e2e-tests-kind.env b/test/e2e-tests-kind.env new file mode 100644 index 00000000000..ddc0636c73b --- /dev/null +++ b/test/e2e-tests-kind.env @@ -0,0 +1,3 @@ +SKIP_INITIALIZE=true +PIPELINE_FEATURE_GATE=stable +RUN_YAML_TESTS=false diff --git a/test/e2e-tests.sh b/test/e2e-tests.sh index 4a077e56a3e..3001f74c631 100755 --- a/test/e2e-tests.sh +++ b/test/e2e-tests.sh @@ -19,9 +19,18 @@ source $(git rev-parse --show-toplevel)/test/e2e-common.sh + +# Setting defaults +PIPELINE_FEATURE_GATE=${PIPELINE_FEATURE_GATE:-stable} +SKIP_INITIALIZE=${SKIP_INITIALIZE:="false"} +RUN_YAML_TESTS=${RUN_YAML_TESTS:="true"} +failed=0 + # Script entry point. -initialize $@ +if [ "${SKIP_INITIALIZE}" != "true" ]; then + initialize $@ +fi header "Setting up environment" @@ -49,17 +58,13 @@ function run_e2e() { # Run these _after_ the integration tests b/c they don't quite work all the way # and they cause a lot of noise in the logs, making it harder to debug integration # test failures. - go_test_e2e -tags=examples -timeout=20m ./test/ || failed=1 + if [ "${RUN_YAML_TESTS}" == "true"]; then + go_test_e2e -tags=examples -timeout=20m ./test/ || failed=1 + fi } -if [ "$PIPELINE_FEATURE_GATE" == "" ]; then - set_feature_gate "stable" - run_e2e -else - set_feature_gate "$PIPELINE_FEATURE_GATE" - run_e2e -fi - +set_feature_gate "$PIPELINE_FEATURE_GATE" +run_e2e (( failed )) && fail_test success