Skip to content

Commit 7956b37

Browse files
committed
Add test for trafficDistribution: PreferSameZone
(Identical to the PreferClose test.)
1 parent 23aff5d commit 7956b37

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/e2e/network/traffic_distribution.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
"k8s.io/apimachinery/pkg/util/intstr"
3030
"k8s.io/apimachinery/pkg/util/sets"
3131
clientset "k8s.io/client-go/kubernetes"
32+
"k8s.io/kubernetes/pkg/features"
3233
"k8s.io/kubernetes/test/e2e/framework"
3334
e2enode "k8s.io/kubernetes/test/e2e/framework/node"
3435
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
@@ -260,10 +261,17 @@ var _ = common.SIGDescribe("Traffic Distribution", func() {
260261
// Main test specifications.
261262
////////////////////////////////////////////////////////////////////////////
262263

263-
ginkgo.It("should route traffic to an endpoint in the same zone when using PreferClose", func(ctx context.Context) {
264+
framework.It("should route traffic to an endpoint in the same zone when using PreferClose", func(ctx context.Context) {
264265
clientPods, serverPods := allocateClientsAndServers(ctx)
265266
svc := createService(ctx, v1.ServiceTrafficDistributionPreferClose)
266267
createPods(ctx, svc, clientPods, serverPods)
267268
checkTrafficDistribution(ctx, clientPods)
268269
})
270+
271+
framework.It("should route traffic to an endpoint in the same zone when using PreferSameZone", framework.WithFeatureGate(features.PreferSameTrafficDistribution), func(ctx context.Context) {
272+
clientPods, serverPods := allocateClientsAndServers(ctx)
273+
svc := createService(ctx, v1.ServiceTrafficDistributionPreferSameZone)
274+
createPods(ctx, svc, clientPods, serverPods)
275+
checkTrafficDistribution(ctx, clientPods)
276+
})
269277
})

0 commit comments

Comments
 (0)