Skip to content

Commit 31caa0d

Browse files
author
OpenShift Bot
authored
Merge pull request #14069 from kargakis/dump-events-from-e2e-tests
Merged by openshift-bot
2 parents 9063c2c + 61dc793 commit 31caa0d

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

hack/lib/cleanup.sh

+19-1
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,22 @@ function os::cleanup::tmpdir() {
152152
${USE_SUDO:+sudo} rm -rf "${directory}"
153153
done
154154
}
155-
readonly -f os::cleanup::tmpdir
155+
readonly -f os::cleanup::tmpdir
156+
157+
# os::cleanup::dump_events dumps all the events from a cluster to a file.
158+
#
159+
# Globals:
160+
# ARTIFACT_DIR
161+
# Arguments:
162+
# None
163+
# Returns:
164+
# None
165+
function os::cleanup::dump_events() {
166+
os::log::info "Dumping cluster events to ${ARTIFACT_DIR}/events.txt"
167+
local kubeconfig
168+
if [[ -n "${ADMIN_KUBECONFIG}" ]]; then
169+
kubeconfig="--config=${ADMIN_KUBECONFIG}"
170+
fi
171+
oc get events --all-namespaces ${kubeconfig} > "${ARTIFACT_DIR}/events.txt"
172+
}
173+
readonly -f os::cleanup::dump_events

hack/test-end-to-end-docker.sh

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ function cleanup()
3939

4040
os::cleanup::dump_etcd
4141

42+
os::cleanup::dump_events
43+
4244
if [[ -z "${SKIP_TEARDOWN-}" ]]; then
4345
os::cleanup::containers
4446
fi

hack/util.sh

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ function cleanup_openshift() {
5050

5151
if [[ -z "${SKIP_TEARDOWN-}" ]]; then
5252
os::cleanup::dump_etcd
53+
os::cleanup::dump_events
5354
os::log::info "Tearing down test"
5455
kill_all_processes
5556

0 commit comments

Comments
 (0)