diff --git a/test/e2e/framework/util.go b/test/e2e/framework/util.go index 4cc40ab9d91..60d779a7a0d 100644 --- a/test/e2e/framework/util.go +++ b/test/e2e/framework/util.go @@ -21,7 +21,7 @@ const ( // RandomSuffix provides a random sequence to append to resources. func RandomSuffix() string { - return fmt.Sprintf("%d%04d", ginkgo.GinkgoParallelProcess(), rand.Intn(10000)) + return fmt.Sprintf("%d%04d%04d", ginkgo.GinkgoParallelProcess(), rand.Intn(10000), rand.Intn(10000)) } func RandomCIDR(family string) string { diff --git a/test/e2e/kube-ovn/network-policy/network-policy.go b/test/e2e/kube-ovn/network-policy/network-policy.go index b488ae6c840..bb3eb406921 100644 --- a/test/e2e/kube-ovn/network-policy/network-policy.go +++ b/test/e2e/kube-ovn/network-policy/network-policy.go @@ -23,7 +23,7 @@ import ( "github.com/kubeovn/kube-ovn/test/e2e/framework" ) -var _ = framework.Describe("[group:network-policy]", func() { +var _ = framework.SerialDescribe("[group:network-policy]", func() { f := framework.NewDefaultFramework("network-policy") var subnet *apiv1.Subnet diff --git a/test/e2e/kube-ovn/service/service.go b/test/e2e/kube-ovn/service/service.go index 4abd66de56a..b2b7b93b826 100644 --- a/test/e2e/kube-ovn/service/service.go +++ b/test/e2e/kube-ovn/service/service.go @@ -126,11 +126,12 @@ var _ = framework.Describe("[group:service]", func() { } f.SkipVersionPriorTo(1, 11, "This case is support in v1.11") ginkgo.By("Creating service " + serviceName) + port := 8000 + rand.Int31n(1000) ports := []corev1.ServicePort{{ Name: "tcp", Protocol: corev1.ProtocolTCP, - Port: 80, - TargetPort: intstr.FromInt(80), + Port: port, + TargetPort: intstr.FromInt(int(port)), }} selector := map[string]string{"app": "svc-dual"} @@ -142,6 +143,7 @@ var _ = framework.Describe("[group:service]", func() { v6ClusterIp := service.Spec.ClusterIPs[1] originService := service.DeepCopy() + ginkgo.By("Creating pod " + podName) podBackend := framework.MakePod(namespaceName, podName, selector, nil, framework.PauseImage, nil, nil) _ = podClient.CreateSync(podBackend) @@ -149,11 +151,19 @@ var _ = framework.Describe("[group:service]", func() { execCmd := "kubectl ko nbctl --format=csv --data=bare --no-heading --columns=vips find Load_Balancer name=cluster-tcp-loadbalancer" framework.WaitUntil(2*time.Second, 30*time.Second, func(_ context.Context) (bool, error) { output, err := exec.Command("bash", "-c", execCmd).CombinedOutput() - framework.Logf("output is %s ", output) - framework.Logf("v6ClusterIp is %s ", v6ClusterIp) framework.ExpectNoError(err) - if (isContain && strings.Contains(string(output), v6ClusterIp)) || - (!isContain && !strings.Contains(string(output), v6ClusterIp)) { + framework.Logf("output is %q", output) + framework.Logf("v6ClusterIp is %q", v6ClusterIp) + vips := strings.Fields(string(output)) + prefix := util.JoinHostPort(v6ClusterIp, port) + "=" + var found bool + for _, vip := range vips { + if strings.HasPrefix(vip, prefix) { + found = true + break + } + } + if found == isContain { return true, nil } return false, nil diff --git a/test/e2e/kube-ovn/subnet/subnet.go b/test/e2e/kube-ovn/subnet/subnet.go index 4bae84280eb..6a1b470646f 100644 --- a/test/e2e/kube-ovn/subnet/subnet.go +++ b/test/e2e/kube-ovn/subnet/subnet.go @@ -1085,7 +1085,6 @@ var _ = framework.Describe("[group:subnet]", func() { util.LogicalSwitchAnnotation: subnetName, } - podName = "pod-" + framework.RandomSuffix() pod := framework.MakePod(namespaceName, podName, nil, annotations, framework.AgnhostImage, nil, nil) _ = podClient.CreateSync(pod) @@ -1099,7 +1098,7 @@ var _ = framework.Describe("[group:subnet]", func() { { Match: apiv1.NatOutGoingPolicyMatch{ SrcIPs: "1.1.1.1", - DstIPs: "169.254.0.0/16", + DstIPs: "199.255.0.0/16", }, Action: util.NatPolicyRuleActionNat, }, diff --git a/test/e2e/kube-ovn/underlay/underlay.go b/test/e2e/kube-ovn/underlay/underlay.go index ca7a71ce704..c14aa48d99e 100644 --- a/test/e2e/kube-ovn/underlay/underlay.go +++ b/test/e2e/kube-ovn/underlay/underlay.go @@ -167,7 +167,7 @@ var _ = framework.SerialDescribe("[group:underlay]", func() { } itFn = func(exchangeLinkName bool) { - ginkgo.By("Creating provider network") + ginkgo.By("Creating provider network " + providerNetworkName) pn := makeProviderNetwork(providerNetworkName, exchangeLinkName, linkMap) pn = providerNetworkClient.CreateSync(pn) @@ -313,7 +313,7 @@ var _ = framework.SerialDescribe("[group:underlay]", func() { ginkgo.By("Deleting vlan " + vlanName) vlanClient.Delete(vlanName, metav1.DeleteOptions{}) - ginkgo.By("Deleting provider network") + ginkgo.By("Deleting provider network " + providerNetworkName) providerNetworkClient.DeleteSync(providerNetworkName) ginkgo.By("Getting nodes") @@ -345,7 +345,7 @@ var _ = framework.SerialDescribe("[group:underlay]", func() { }) framework.ConformanceIt("should keep pod mtu the same with node interface", func() { - ginkgo.By("Creating provider network") + ginkgo.By("Creating provider network " + providerNetworkName) pn := makeProviderNetwork(providerNetworkName, false, linkMap) _ = providerNetworkClient.CreateSync(pn) @@ -406,7 +406,7 @@ var _ = framework.SerialDescribe("[group:underlay]", func() { } f.SkipVersionPriorTo(1, 9, "Address conflict detection was introduced in v1.9") - ginkgo.By("Creating provider network") + ginkgo.By("Creating provider network " + providerNetworkName) pn := makeProviderNetwork(providerNetworkName, false, linkMap) _ = providerNetworkClient.CreateSync(pn) @@ -469,7 +469,7 @@ var _ = framework.SerialDescribe("[group:underlay]", func() { framework.ConformanceIt("should support underlay to overlay subnet interconnection", func() { f.SkipVersionPriorTo(1, 9, "This feature was introduced in v1.9") - ginkgo.By("Creating provider network") + ginkgo.By("Creating provider network " + providerNetworkName) pn := makeProviderNetwork(providerNetworkName, false, linkMap) _ = providerNetworkClient.CreateSync(pn) diff --git a/test/e2e/ovn-vpc-nat-gw/e2e_test.go b/test/e2e/ovn-vpc-nat-gw/e2e_test.go index b2f8bf3d074..c93dad2fca0 100644 --- a/test/e2e/ovn-vpc-nat-gw/e2e_test.go +++ b/test/e2e/ovn-vpc-nat-gw/e2e_test.go @@ -200,7 +200,7 @@ var _ = framework.Describe("[group:ovn-vpc-nat-gw]", func() { } itFn = func(exchangeLinkName bool) { - ginkgo.By("Creating provider network") + ginkgo.By("Creating provider network " + providerNetworkName) pn := makeProviderNetwork(providerNetworkName, exchangeLinkName, linkMap) pn = providerNetworkClient.CreateSync(pn) @@ -293,7 +293,7 @@ var _ = framework.Describe("[group:ovn-vpc-nat-gw]", func() { ginkgo.By("Deleting vlan " + vlanName) vlanClient.Delete(vlanName, metav1.DeleteOptions{}) - ginkgo.By("Deleting provider network") + ginkgo.By("Deleting provider network " + providerNetworkName) providerNetworkClient.DeleteSync(providerNetworkName) ginkgo.By("Getting nodes")