From 00b155e46669f2716cd3bce78b67d220e5082002 Mon Sep 17 00:00:00 2001 From: Harjit Singh <105671702+harjsing7@users.noreply.github.com> Date: Mon, 17 Apr 2023 10:10:08 -0700 Subject: [PATCH] Handle case where returned object from a Watch is not a Pod (#132) * Handle cases where returned object from a watch is not a Pod --- testing/it_sidecar/stern/watch.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/testing/it_sidecar/stern/watch.go b/testing/it_sidecar/stern/watch.go index 558b7cc9..d27e7a87 100644 --- a/testing/it_sidecar/stern/watch.go +++ b/testing/it_sidecar/stern/watch.go @@ -59,7 +59,13 @@ func Watch(ctx context.Context, i v1.PodInterface, podFilter *regexp.Regexp, con return } - pod := e.Object.(*corev1.Pod) + var ( + pod *corev1.Pod + ok bool + ) + if pod, ok = e.Object.(*corev1.Pod); !ok { + continue + } if !podFilter.MatchString(pod.Name) { continue