Skip to content

Commit dc481fe

Browse files
authored
Merge pull request kubernetes#123981 from lzhecheng/update-traffic-distribution-test
[e2e] Update traffic distribution test
2 parents a95db41 + 6a77140 commit dc481fe

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

test/e2e/framework/skipper/skipper.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,17 @@ func SkipUnlessMultizone(ctx context.Context, c clientset.Interface) {
133133
}
134134
}
135135

136+
// SkipUnlessAtLeastNZones skips if the cluster does not have n multizones.
137+
func SkipUnlessAtLeastNZones(ctx context.Context, c clientset.Interface, n int) {
138+
zones, err := e2enode.GetClusterZones(ctx, c)
139+
if err != nil {
140+
skipInternalf(1, "Error listing cluster zones")
141+
}
142+
if zones.Len() < n {
143+
skipInternalf(1, "Requires >= %d zones", n)
144+
}
145+
}
146+
136147
// SkipIfMultizone skips if the cluster has multizone.
137148
func SkipIfMultizone(ctx context.Context, c clientset.Interface) {
138149
zones, err := e2enode.GetClusterZones(ctx, c)

test/e2e/network/traffic_distribution.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ var _ = common.SIGDescribe(feature.TrafficDistribution, func() {
5050

5151
ginkgo.BeforeEach(func(ctx context.Context) {
5252
c = f.ClientSet
53-
e2eskipper.SkipUnlessMultizone(ctx, c)
53+
e2eskipper.SkipUnlessAtLeastNZones(ctx, c, 3)
5454
})
5555

5656
////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)