From e98f96b4f44ea0aa30b349ed3bdae6939529e3cf Mon Sep 17 00:00:00 2001 From: iwilltry42 Date: Mon, 11 May 2020 12:31:16 +0200 Subject: [PATCH] tests/e2e: add E2E_SKIP env var to skip specific e2e tests, as test_multi_master tends to fail in travis --- .travis.yml | 2 +- Makefile | 3 ++- tests/dind.sh | 1 + tests/runner.sh | 12 ++++++++---- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index b994c560..fa07c779 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ matrix: before_script: - make ci-setup script: - - make ci-tests build-cross + - make -e "E2E_SKIP=test_multi_master" ci-tests build-cross deploy: provider: releases skip_cleanup: true diff --git a/Makefile b/Makefile index c449bab5..ac8629ed 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,7 @@ INTERACTIVE:=$(shell [ -t 0 ] && echo 1) # E2E test settings E2E_LOG_LEVEL ?= WARN +E2E_SKIP ?= # Go options GO ?= go @@ -94,7 +95,7 @@ fmt: e2e: build-docker @echo "Running e2e tests in k3d:$(K3D_IMAGE_TAG)" - LOG_LEVEL=$(E2E_LOG_LEVEL) tests/dind.sh "${K3D_IMAGE_TAG}" + LOG_LEVEL="$(E2E_LOG_LEVEL)" E2E_SKIP="$(E2E_SKIP)" tests/dind.sh "${K3D_IMAGE_TAG}" # check-fmt returns an error code if any source code contains format error. check-fmt: @test -z $(shell gofmt -s -l $(GO_SRC) | tee /dev/stderr) || echo "[WARN] Fix formatting issues with 'make fmt'" diff --git a/tests/dind.sh b/tests/dind.sh index 452fafb8..bc41b829 100755 --- a/tests/dind.sh +++ b/tests/dind.sh @@ -16,6 +16,7 @@ k3de2e=$(docker run -d \ -e EXE="$K3D_EXE" \ -e CI="true" \ -e LOG_LEVEL="$LOG_LEVEL" \ + -e E2E_SKIP="$E2E_SKIP" \ --name "k3d-e2e-runner-$TIMESTAMP" \ k3d:$K3D_IMAGE_TAG) diff --git a/tests/runner.sh b/tests/runner.sh index 289d5d8b..7a889529 100755 --- a/tests/runner.sh +++ b/tests/runner.sh @@ -3,6 +3,8 @@ CURR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" [ -d "$CURR_DIR" ] || { echo "FATAL: no current dir (maybe running in zsh?)"; exit 1; } +: "${E2E_SKIP:=""}" + # shellcheck source=./common.sh source "$CURR_DIR/common.sh" @@ -14,12 +16,14 @@ info "Preparing filesystem and environment..." mkdir -p /root/.kube -info "Starting e2e tests..." - for i in $CURR_DIR/test_*.sh ; do base=$(basename $i .sh) - highlight "***** Running $base *****" - $i || abort "test $base failed" + if [[ $E2E_SKIP =~ (^| )$base($| ) ]]; then + highlight "***** Skipping $base *****" + else + highlight "***** Running $base *****" + $i || abort "test $base failed" + fi done exit 0