Skip to content

Commit

Permalink
e2e update post-review
Browse files Browse the repository at this point in the history
Signed-off-by: Karol Szwaj <[email protected]>
  • Loading branch information
cnvergence committed Dec 16, 2024
1 parent a4fbd03 commit 90140f7
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions test/e2e/kube-ovn/ipam/ipam.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
})
})

0 comments on commit 90140f7

Please sign in to comment.