Skip to content

Commit b7e109d

Browse files
tests: add a test script to help debug CI failures
Add a simple script to get operator and pod logs when possible. This can be added to the CI scripts to gather debugging information. Signed-off-by: John Mulligan <[email protected]>
1 parent a98d87a commit b7e109d

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

tests/post-test-info.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/sh
2+
#
3+
# A very simplistic script to help dump logs / diagnose test failures.
4+
#
5+
6+
7+
dump_operator_logs() {
8+
ns="samba-operator-system"
9+
echo "----> operator logs:"
10+
kubectl -n "$ns" logs \
11+
deploy/samba-operator-controller-manager \
12+
--all-containers=true \
13+
--prefix=true
14+
}
15+
16+
dump_smb_pod_logs() {
17+
ns="samba-operator-system"
18+
echo "----> samba pod logs/info ($ns):"
19+
podnames="$(kubectl -n "$ns" get pods \
20+
-l app.kubernetes.io/name=samba \
21+
-o go-template='{{range .items}}{{.metadata.name}}{{printf "\n"}}{{end}}')"
22+
for pod in ${podnames}; do
23+
echo "------> ${pod}"
24+
kubectl -n "$ns" describe pod "${pod}"
25+
kubectl -n "$ns" logs \
26+
"pod/${pod}" \
27+
--all-containers=true \
28+
--prefix=true
29+
done
30+
}
31+
32+
33+
echo "----- dumping logs --------------"
34+
dump_operator_logs
35+
dump_smb_pod_logs
36+
echo "---------------------------------"

0 commit comments

Comments
 (0)