Skip to content

Commit

Permalink
test: fix test panic
Browse files Browse the repository at this point in the history
  • Loading branch information
andyzhangx committed Jan 31, 2024
1 parent 60bd25f commit 4c1e5c2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/e2e/testsuites/testsuites.go
Original file line number Diff line number Diff line change
Expand Up @@ -989,10 +989,12 @@ func (t *TestPod) GetZoneForVolume(ctx context.Context, index int) string {
framework.ExpectNoError(err)

zone := ""
for _, term := range pv.Spec.NodeAffinity.Required.NodeSelectorTerms {
for _, ex := range term.MatchExpressions {
if ex.Key == "topology.disk.csi.azure.com/zone" && ex.Operator == v1.NodeSelectorOpIn {
zone = ex.Values[0]
if pv.Spec.NodeAffinity == nil || pv.Spec.NodeAffinity.Required == nil {
for _, term := range pv.Spec.NodeAffinity.Required.NodeSelectorTerms {
for _, ex := range term.MatchExpressions {
if ex.Key == "topology.disk.csi.azure.com/zone" && ex.Operator == v1.NodeSelectorOpIn {
zone = ex.Values[0]
}
}
}
}
Expand Down

0 comments on commit 4c1e5c2

Please sign in to comment.