Skip to content

Commit

Permalink
tests, reporter, Add missing nil pointer check
Browse files Browse the repository at this point in the history
In case the virt-handler pod list is nil,
the reporter should not dereference it,
else it will result in panic.

Signed-off-by: Or Shoval <[email protected]>
  • Loading branch information
oshoval committed Oct 11, 2021
1 parent 1dcfcdb commit f11a9d1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/reporter/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,11 @@ func (r *KubernetesReporter) logVirtLauncherPrivilegedCommands(virtCli kubecli.K
return
}

if virtHandlerPods == nil {
fmt.Fprintf(os.Stderr, "virt-handler pod list is empty, skipping logVirtLauncherPrivilegedCommands\n")
return
}

nodeMap := map[string]v1.Pod{}
for _, virtHandlerPod := range virtHandlerPods.Items {
if virtHandlerPod.Status.Phase != "Running" {
Expand Down

0 comments on commit f11a9d1

Please sign in to comment.