Skip to content

Commit

Permalink
e2e cleanup resources
Browse files Browse the repository at this point in the history
Signed-off-by: Karol Szwaj <[email protected]>
  • Loading branch information
cnvergence committed Dec 12, 2024
1 parent 2ecff3b commit db03de0
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions test/e2e/kube-ovn/ipam/ipam.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,15 +517,17 @@ var _ = framework.Describe("[group:ipam]", func() {
ipsRange2 := framework.RandomIPPool(cidr, ipsCount)
testStsName := "test-statefulset"
testSubnetName := "ip-pool-subnet2"
testIpPool1Name := "ip-pool1"

Check failure on line 520 in test/e2e/kube-ovn/ipam/ipam.go

View workflow job for this annotation

GitHub Actions / Build kube-ovn

var-naming: var testIpPool1Name should be testIPPool1Name (revive)
testIpPool2Name := "ip-pool2"

Check failure on line 521 in test/e2e/kube-ovn/ipam/ipam.go

View workflow job for this annotation

GitHub Actions / Build kube-ovn

var-naming: var testIpPool2Name should be testIPPool2Name (revive)

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.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)

Expand All @@ -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)
})
})

0 comments on commit db03de0

Please sign in to comment.