Skip to content

Commit

Permalink
tests/e2e: add E2E_SKIP env var to skip specific e2e tests, as test_m…
Browse files Browse the repository at this point in the history
…ulti_master tends to fail in travis
  • Loading branch information
iwilltry42 committed May 11, 2020
1 parent fe21c27 commit e98f96b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ INTERACTIVE:=$(shell [ -t 0 ] && echo 1)

# E2E test settings
E2E_LOG_LEVEL ?= WARN
E2E_SKIP ?=

# Go options
GO ?= go
Expand Down Expand Up @@ -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'"
Expand Down
1 change: 1 addition & 0 deletions tests/dind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
12 changes: 8 additions & 4 deletions tests/runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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
Expand Down

0 comments on commit e98f96b

Please sign in to comment.