@@ -110,31 +110,23 @@ var _ = common.SIGDescribe("Traffic Distribution", func() {
110
110
////////////////////////////////////////////////////////////////////////////
111
111
112
112
ginkgo .It ("should route traffic to an endpoint in the same zone when using PreferClose" , func (ctx context.Context ) {
113
-
114
113
ginkgo .By ("finding 3 zones with schedulable nodes" )
115
- allZonesSet , err := e2enode .GetSchedulableClusterZones (ctx , c )
116
- framework .ExpectNoError (err )
117
- if len (allZonesSet ) < 3 {
118
- framework .Failf ("got %d zones with schedulable nodes, want atleast 3 zones with schedulable nodes" , len (allZonesSet ))
119
- }
120
- zones := allZonesSet .UnsortedList ()[:3 ]
121
-
122
- ginkgo .By (fmt .Sprintf ("finding a node in each of the chosen 3 zones %v" , zones ))
123
114
nodeList , err := e2enode .GetReadySchedulableNodes (ctx , c )
124
115
framework .ExpectNoError (err )
125
116
nodeForZone := make (map [string ]* v1.Node )
126
- for _ , zone := range zones {
127
- found := false
128
- for _ , node := range nodeList .Items {
129
- if zone == node .Labels [v1 .LabelTopologyZone ] {
130
- found = true
131
- nodeForZone [zone ] = & node
132
- }
117
+ for _ , node := range nodeList .Items {
118
+ zone := node .Labels [v1 .LabelTopologyZone ]
119
+ if nodeForZone [zone ] != nil {
120
+ continue
133
121
}
134
- if ! found {
135
- framework .Failf ("could not find a node in zone %q; nodes=\n %v" , zone , format .Object (nodeList , 1 /* indent one level */ ))
122
+ nodeForZone [zone ] = & node
123
+ if len (nodeForZone ) == 3 {
124
+ break
136
125
}
137
126
}
127
+ if len (nodeForZone ) < 3 {
128
+ e2eskipper .Skipf ("got %d zones with schedulable nodes, need at least 3" , len (nodeForZone ))
129
+ }
138
130
139
131
var clientPods []* clientPod
140
132
var serverPods []* serverPod
0 commit comments