[e2e] Update traffic distribution test

Skip traffic distribution test if cluster has < 3 zones.

Signed-off-by: Zhecheng Li <zhechengli@microsoft.com>
This commit is contained in:
Zhecheng Li 2024-03-19 03:25:58 +00:00
parent a2a709077f
commit 6a77140cb0
2 changed files with 12 additions and 1 deletions

View File

@ -121,6 +121,17 @@ func SkipUnlessMultizone(ctx context.Context, c clientset.Interface) {
} }
} }
// SkipUnlessAtLeastNZones skips if the cluster does not have n multizones.
func SkipUnlessAtLeastNZones(ctx context.Context, c clientset.Interface, n int) {
zones, err := e2enode.GetClusterZones(ctx, c)
if err != nil {
skipInternalf(1, "Error listing cluster zones")
}
if zones.Len() < n {
skipInternalf(1, "Requires >= %d zones", n)
}
}
// SkipIfMultizone skips if the cluster has multizone. // SkipIfMultizone skips if the cluster has multizone.
func SkipIfMultizone(ctx context.Context, c clientset.Interface) { func SkipIfMultizone(ctx context.Context, c clientset.Interface) {
zones, err := e2enode.GetClusterZones(ctx, c) zones, err := e2enode.GetClusterZones(ctx, c)

View File

@ -49,7 +49,7 @@ var _ = common.SIGDescribe("TrafficDistribution", func() {
ginkgo.BeforeEach(func(ctx context.Context) { ginkgo.BeforeEach(func(ctx context.Context) {
c = f.ClientSet c = f.ClientSet
e2eskipper.SkipUnlessMultizone(ctx, c) e2eskipper.SkipUnlessAtLeastNZones(ctx, c, 3)
}) })
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////