Skip to content

Commit 6a77140

Browse files
committed
[e2e] Update traffic distribution test
Skip traffic distribution test if cluster has < 3 zones. Signed-off-by: Zhecheng Li <[email protected]>
1 parent a2a7090 commit 6a77140

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
@@ -121,6 +121,17 @@ func SkipUnlessMultizone(ctx context.Context, c clientset.Interface) {
121121
}
122122
}
123123

124+
// SkipUnlessAtLeastNZones skips if the cluster does not have n multizones.
125+
func SkipUnlessAtLeastNZones(ctx context.Context, c clientset.Interface, n int) {
126+
zones, err := e2enode.GetClusterZones(ctx, c)
127+
if err != nil {
128+
skipInternalf(1, "Error listing cluster zones")
129+
}
130+
if zones.Len() < n {
131+
skipInternalf(1, "Requires >= %d zones", n)
132+
}
133+
}
134+
124135
// SkipIfMultizone skips if the cluster has multizone.
125136
func SkipIfMultizone(ctx context.Context, c clientset.Interface) {
126137
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
@@ -49,7 +49,7 @@ var _ = common.SIGDescribe("TrafficDistribution", func() {
4949

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

5555
////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)