Skip to content

Commit 6f25113

Browse files
Merge pull request #29448 from kyrtapz/fix_cudn_cleanup
SDN-4930: Fix pods cleanup in ClusterUserDefinedNetwork test
2 parents 3709116 + 9837f5d commit 6f25113

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

test/extended/networking/network_segmentation.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -414,11 +414,6 @@ var _ = Describe("[sig-network][OCPFeatureGate:NetworkSegmentation][Feature:User
414414
namespaceRed := f.Namespace.Name + "-" + red
415415
namespaceBlue := f.Namespace.Name + "-" + blue
416416

417-
netConfig := &networkAttachmentConfigParams{
418-
topology: topology,
419-
cidr: correctCIDRFamily(oc, userDefinedv4Subnet, userDefinedv6Subnet),
420-
role: "primary",
421-
}
422417
for _, namespace := range []string{namespaceRed, namespaceBlue} {
423418
By("Creating namespace " + namespace)
424419
_, err := cs.CoreV1().Namespaces().Create(context.Background(), &v1.Namespace{
@@ -428,6 +423,7 @@ var _ = Describe("[sig-network][OCPFeatureGate:NetworkSegmentation][Feature:User
428423
}, metav1.CreateOptions{})
429424
Expect(err).NotTo(HaveOccurred())
430425
defer func() {
426+
By("Removing namespace " + namespace)
431427
Expect(cs.CoreV1().Namespaces().Delete(
432428
context.Background(),
433429
namespace,
@@ -438,8 +434,13 @@ var _ = Describe("[sig-network][OCPFeatureGate:NetworkSegmentation][Feature:User
438434
networkNamespaceMap := map[string]string{namespaceRed: red, namespaceBlue: blue}
439435
for namespace, network := range networkNamespaceMap {
440436
By("creating the network " + network + " in namespace " + namespace)
441-
netConfig.namespace = namespace
442-
netConfig.name = network
437+
netConfig := &networkAttachmentConfigParams{
438+
topology: topology,
439+
cidr: correctCIDRFamily(oc, userDefinedv4Subnet, userDefinedv6Subnet),
440+
role: "primary",
441+
namespace: namespace,
442+
name: network,
443+
}
443444

444445
Expect(createNetworkFn(netConfig)).To(Succeed())
445446
// update the name because createNetworkFn may mutate the netConfig.name
@@ -601,7 +602,7 @@ var _ = Describe("[sig-network][OCPFeatureGate:NetworkSegmentation][Feature:User
601602
cleanup, err := createManifest("", cudnManifest)
602603
DeferCleanup(func() {
603604
cleanup()
604-
By("delete pods in test namespace to unblock CUDN CR & associate NAD deletion")
605+
By(fmt.Sprintf("delete pods in %s namespace to unblock CUDN CR & associate NAD deletion", c.namespace))
605606
Expect(cs.CoreV1().Pods(c.namespace).DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{})).To(Succeed())
606607
_, err := e2ekubectl.RunKubectl("", "delete", "clusteruserdefinednetwork", cudnName, "--wait", fmt.Sprintf("--timeout=%ds", 120))
607608
Expect(err).NotTo(HaveOccurred())

0 commit comments

Comments
 (0)