Skip to content

Commit

Permalink
e2e: Gather cluster-info on test failure
Browse files Browse the repository at this point in the history
This is a leftover from
- k8snetworkplumbingwg#534

Prior to this commit, `kubectl cluster-info ...` is invoked
only if the conformance tests does not fail, which is not
that useful.

Signed-off-by: Andrea Panattoni <apanatto@redhat.com>
  • Loading branch information
zeeke committed Jan 23, 2024
1 parent bcb4970 commit 111af4c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions hack/run-e2e-conformance-virtual-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,17 @@ if [ -z $SKIP_TEST ]; then
export JUNIT_OUTPUT="${root}/${TEST_REPORT_PATH}/conformance-test-report"
fi

# Disable exit on error temporarily to gather cluster information
set +e
SUITE=./test/conformance hack/run-e2e-conformance.sh
TEST_EXITE_CODE=$?
set -e

if [[ -v TEST_REPORT_PATH ]]; then
kubectl cluster-info dump --namespaces ${NAMESPACE} --output-directory "${root}/${TEST_REPORT_PATH}/cluster-info"
fi

if [[ $TEST_EXITE_CODE -ne 0 ]]; then
exit $TEST_EXITE_CODE
fi
fi
8 changes: 8 additions & 0 deletions hack/run-e2e-conformance-virtual-ocp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,17 @@ if [ -z $SKIP_TEST ]; then
export JUNIT_OUTPUT="${root}/${TEST_REPORT_PATH}/conformance-test-report"
fi

# Disable exit on error temporarily to gather cluster information
set +e
SUITE=./test/conformance hack/run-e2e-conformance.sh
TEST_EXITE_CODE=$?
set -e

if [[ -v TEST_REPORT_PATH ]]; then
kubectl cluster-info dump --namespaces ${NAMESPACE} --output-directory "${root}/${TEST_REPORT_PATH}/cluster-info"
fi

if [[ $TEST_EXITE_CODE -ne 0 ]]; then
exit $TEST_EXITE_CODE
fi
fi

0 comments on commit 111af4c

Please sign in to comment.