From 90140f71e9528dc7efbd2a7e382488fc98ce9f76 Mon Sep 17 00:00:00 2001 From: Karol Szwaj Date: Mon, 16 Dec 2024 17:34:08 +0100 Subject: [PATCH] e2e update post-review Signed-off-by: Karol Szwaj --- test/e2e/kube-ovn/ipam/ipam.go | 36 +++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/test/e2e/kube-ovn/ipam/ipam.go b/test/e2e/kube-ovn/ipam/ipam.go index e98d1a055fa..6a24fcd25c8 100644 --- a/test/e2e/kube-ovn/ipam/ipam.go +++ b/test/e2e/kube-ovn/ipam/ipam.go @@ -511,31 +511,45 @@ var _ = framework.Describe("[group:ipam]", func() { }) framework.ConformanceIt("should allocate right IPs for the statefulset when there are multiple IP Pools added to its namespace", func() { + f.SkipVersionPriorTo(1, 14, "Multiple IP Pools per namespace support was introduced in v1.14") replicas := 1 ipsCount := 12 - ipsRange1 := framework.RandomIPPool(cidr, ipsCount) - ipsRange2 := framework.RandomIPPool(cidr, ipsCount) - testStsName := "test-statefulset" - testSubnetName := "ip-pool-subnet2" - testIPPool1Name := "ip-pool1" - testIPPool2Name := "ip-pool2" + testStsName := "test-statefulset" + framework.RandomSuffix() + testSubnetName := "ip-pool-subnet2" + framework.RandomSuffix() + testIPPool1Name := "ip-pool1" + framework.RandomSuffix() + testIPPool2Name := "ip-pool2" + framework.RandomSuffix() ginkgo.By("Creating a new subnet " + testSubnetName) testCidr := framework.RandomCIDR(f.ClusterIPFamily) testSubnet := framework.MakeSubnet(testSubnetName, "", testCidr, "", "", "", nil, nil, []string{namespaceName}) subnetClient.CreateSync(testSubnet) + ginkgo.DeferCleanup(func() { + ginkgo.By("Deleting subnet " + testSubnetName) + subnetClient.DeleteSync(testSubnetName) + }) ginkgo.By("Creating IPPool resources ") + ipsRange1 := framework.RandomIPPool(cidr, ipsCount) + ipsRange2 := framework.RandomIPPool(testCidr, ipsCount) ippool1 := framework.MakeIPPool(testIPPool1Name, subnetName, ipsRange1, []string{namespaceName}) ippool2 := framework.MakeIPPool(testIPPool2Name, testSubnetName, ipsRange2, []string{namespaceName}) ippoolClient.CreateSync(ippool1) ippoolClient.CreateSync(ippool2) + ginkgo.DeferCleanup(func() { + ginkgo.By("Deleting ippools") + ippoolClient.DeleteSync(testIPPool1Name) + ippoolClient.DeleteSync(testIPPool2Name) + }) ginkgo.By("Creating statefulset " + testStsName + " with logical switch annotation and no ippool annotation") labels := map[string]string{"app": testStsName} sts := framework.MakeStatefulSet(testStsName, testStsName, int32(replicas), labels, framework.PauseImage) sts.Spec.Template.Annotations = map[string]string{util.LogicalSwitchAnnotation: subnetName} sts = stsClient.CreateSync(sts) + ginkgo.DeferCleanup(func() { + ginkgo.By("Deleting statefulset " + testStsName) + stsClient.DeleteSync(testStsName) + }) ginkgo.By("Getting pods for statefulset " + testStsName) pods := stsClient.GetPods(sts) @@ -550,15 +564,5 @@ var _ = framework.Describe("[group:ipam]", func() { framework.ExpectMAC(pod.Annotations[util.MacAddressAnnotation]) framework.ExpectHaveKeyWithValue(pod.Annotations, util.RoutedAnnotation, "true") } - - ginkgo.By("Deleting statefulset " + testStsName) - stsClient.DeleteSync(testStsName) - - ginkgo.By("Deleting ippools") - ippoolClient.DeleteSync(testIPPool1Name) - ippoolClient.DeleteSync(testIPPool2Name) - - ginkgo.By("Deleting subnet " + testSubnetName) - subnetClient.DeleteSync(testSubnetName) }) })