From db03de0ce0dad5125e36cd8d8bdcd9ce0f91289a Mon Sep 17 00:00:00 2001 From: Karol Szwaj Date: Thu, 12 Dec 2024 14:26:44 +0100 Subject: [PATCH] e2e cleanup resources Signed-off-by: Karol Szwaj --- test/e2e/kube-ovn/ipam/ipam.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/test/e2e/kube-ovn/ipam/ipam.go b/test/e2e/kube-ovn/ipam/ipam.go index c341f37a638..5f47c8d4c81 100644 --- a/test/e2e/kube-ovn/ipam/ipam.go +++ b/test/e2e/kube-ovn/ipam/ipam.go @@ -517,6 +517,8 @@ var _ = framework.Describe("[group:ipam]", func() { ipsRange2 := framework.RandomIPPool(cidr, ipsCount) testStsName := "test-statefulset" testSubnetName := "ip-pool-subnet2" + testIpPool1Name := "ip-pool1" + testIpPool2Name := "ip-pool2" ginkgo.By("Creating a new subnet " + testSubnetName) testCidr := framework.RandomCIDR(f.ClusterIPFamily) @@ -524,8 +526,8 @@ var _ = framework.Describe("[group:ipam]", func() { subnetClient.CreateSync(testSubnet) ginkgo.By("Creating IPPool resources ") - ippool1 := framework.MakeIPPool("ippool1", subnetName, ipsRange1, []string{namespaceName}) - ippool2 := framework.MakeIPPool("ippool2", testSubnetName, ipsRange2, []string{namespaceName}) + ippool1 := framework.MakeIPPool(testIpPool1Name, subnetName, ipsRange1, []string{namespaceName}) + ippool2 := framework.MakeIPPool(testIpPool2Name, testSubnetName, ipsRange2, []string{namespaceName}) ippoolClient.CreateSync(ippool1) ippoolClient.CreateSync(ippool2) @@ -544,9 +546,20 @@ var _ = framework.Describe("[group:ipam]", func() { framework.ExpectHaveKeyWithValue(pod.Annotations, util.CidrAnnotation, subnet.Spec.CIDRBlock) framework.ExpectHaveKeyWithValue(pod.Annotations, util.GatewayAnnotation, subnet.Spec.Gateway) framework.ExpectContainElement(ipsRange1, pod.Annotations[util.IPAddressAnnotation]) + framework.ExpectIPInCIDR(pod.Annotations[util.IPAddressAnnotation], subnet.Spec.CIDRBlock) framework.ExpectHaveKeyWithValue(pod.Annotations, util.LogicalSwitchAnnotation, subnetName) 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) }) })