Skip to content

Commit

Permalink
fix lb svc e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzujian committed Feb 24, 2023
1 parent f3e9b79 commit e1f7a95
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions test/e2e/lb-svc/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"flag"
"fmt"
"math/big"
"math/rand"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -55,7 +56,7 @@ func lbSvcDeploymentName(serviceName string) string {
return "lb-svc-" + serviceName
}

var _ = framework.Describe("[group:lb-svc]", func() {
var _ = framework.SerialDescribe("[group:lb-svc]", func() {
f := framework.NewDefaultFramework("lb-svc")

var skip bool
Expand All @@ -74,7 +75,7 @@ var _ = framework.Describe("[group:lb-svc]", func() {
serviceName = "service-" + framework.RandomSuffix()

if skip {
ginkgo.Skip("underlay spec only runs on kind clusters")
ginkgo.Skip("lb svc spec only runs on kind clusters")
}

if clusterName == "" {
Expand All @@ -85,7 +86,7 @@ var _ = framework.Describe("[group:lb-svc]", func() {
cluster, ok := kind.IsKindProvided(k8sNodes.Items[0].Spec.ProviderID)
if !ok {
skip = true
ginkgo.Skip("underlay spec only runs on kind clusters")
ginkgo.Skip("lb svc spec only runs on kind clusters")
}
clusterName = cluster
}
Expand Down Expand Up @@ -138,8 +139,8 @@ var _ = framework.Describe("[group:lb-svc]", func() {
service := framework.MakeService(serviceName, corev1.ServiceTypeLoadBalancer, annotations, selector, ports, corev1.ServiceAffinityNone)
_ = serviceClient.CreateSync(service)

ginkgo.By("Waiting for 5 seconds")
time.Sleep(5 * time.Second)
ginkgo.By("Waiting for 10 seconds")
time.Sleep(10 * time.Second)

deploymentName := lbSvcDeploymentName(serviceName)
ginkgo.By("Getting deployment " + deploymentName)
Expand Down Expand Up @@ -176,7 +177,7 @@ var _ = framework.Describe("[group:lb-svc]", func() {
framework.ConformanceIt("should allocate static external IP for service", func() {
ginkgo.By("Creating service " + serviceName)
base := util.Ip2BigInt(gateway)
lbIP := util.BigInt2Ip(base.Add(base, big.NewInt(100)))
lbIP := util.BigInt2Ip(base.Add(base, big.NewInt(50+rand.Int63n(50))))
ports := []corev1.ServicePort{{
Name: "tcp",
Protocol: corev1.ProtocolTCP,
Expand Down

0 comments on commit e1f7a95

Please sign in to comment.