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/sriov-network-operator#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 authored and SchSeba committed May 6, 2024
1 parent 1082ef4 commit 5622fa1
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 @@ -426,9 +426,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 @@ -293,9 +293,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 5622fa1

Please sign in to comment.