Skip to content

Commit 7f17ef2

Browse files
author
Jonathan Basseri
committed
Fix nil panic in vsphere tests
During test cleanup, we iterate over nodes.Items, but if test fails during setup, nodes may be nil.
1 parent 426e5dc commit 7f17ef2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/e2e/storage/vsphere/vsphere_scale.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323

2424
"github.com/onsi/ginkgo"
2525
"github.com/onsi/gomega"
26-
"k8s.io/api/core/v1"
26+
v1 "k8s.io/api/core/v1"
2727
storagev1 "k8s.io/api/storage/v1"
2828
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2929
clientset "k8s.io/client-go/kubernetes"
@@ -108,7 +108,7 @@ var _ = utils.SIGDescribe("vcp at scale [Feature:vsphere] ", func() {
108108
*/
109109
framework.AddCleanupAction(func() {
110110
// Cleanup actions will be called even when the tests are skipped and leaves namespace unset.
111-
if len(namespace) > 0 {
111+
if len(namespace) > 0 && nodes != nil {
112112
for _, node := range nodes.Items {
113113
framework.RemoveLabelOffNode(client, node.Name, NodeLabelKey)
114114
}

0 commit comments

Comments
 (0)