Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile.core.mk
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,10 @@ DOCKER_BUILD_FLAGS ?= "--platform=$(TARGET_OS)/$(TARGET_ARCH)"
GOTEST_FLAGS := $(if $(VERBOSE),-v) $(if $(COVERAGE),-coverprofile=$(REPO_ROOT)/out/coverage-unit.out)
GINKGO_FLAGS ?= $(if $(VERBOSE),-v) $(if $(CI),--no-color) $(if $(COVERAGE),-coverprofile=coverage-integration.out -coverpkg=./... --output-dir=out)

# Fail fast when keeping the environment on failure, to make sure we don't contaminate it with other resources.
# Fail fast when keeping the environment on failure, to make sure we don't contaminate it with other resources. Also make sure to skip cleanup so it won't be deleted.
ifeq ($(KEEP_ON_FAILURE),true)
GINKGO_FLAGS += --fail-fast
SKIP_CLEANUP = true
endif

# CHANNELS define the bundle channels used in the bundle.
Expand Down
22 changes: 0 additions & 22 deletions tests/e2e/integ-suite-kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export MULTICLUSTER="${MULTICLUSTER:-false}"
export IP_FAMILY="${IP_FAMILY:-ipv4}"
export ISTIOCTL="${ISTIOCTL:-${ROOT}/bin/istioctl}"
export KIND_CLUSTER_NAME="${KIND_CLUSTER_NAME:-operator-integration-tests}"
export KEEP_ON_FAILURE="${KEEP_ON_FAILURE:-}"

function check_prerequisites() {
if ! command -v "${ISTIOCTL}" &> /dev/null; then
Expand All @@ -42,22 +41,6 @@ function run_integration_tests() {
fi
}

function keep_on_failure() {
if [ $? -eq 0 ]; then
original_trap="${original_trap#*\'}"
eval "${original_trap%\'*}"
exit 0
fi

KUBECONFIG="${ARTIFACTS}/config"
if [ "${MULTICLUSTER}" == "true" ]; then
printf -v KUBECONFIG '%s:' "${KUBECONFIGS[@]}"
fi

echo "The kind cluster has been kept due to a test failure."
echo "To access it use \`export KUBECONFIG=${KUBECONFIG%:}\`"
}

check_prerequisites

source "${ROOT}/tests/e2e/setup/setup-kind.sh"
Expand All @@ -67,9 +50,4 @@ export HUB="${KIND_REGISTRY}"
# Workaround make inside make: ovewrite this variable so it is not recomputed in Makefile.core.mk
export IMAGE="${HUB}/${IMAGE_BASE:-sail-operator}:${TAG:-latest}"

if [ "${KEEP_ON_FAILURE}" == "true" ]; then
original_trap="$(trap -p EXIT)"
trap keep_on_failure EXIT
fi

run_integration_tests