Skip to content

Commit dfc6042

Browse files
committed
new changes
1 parent c8fba6c commit dfc6042

File tree

1 file changed

+7
-52
lines changed

1 file changed

+7
-52
lines changed

tests/e2e/mgmt_wrkld_domain_isolation.go

Lines changed: 7 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -476,11 +476,11 @@ var _ bool = ginkgo.Describe("[domain-isolation] Management-Workload-Domain-Isol
476476
gomega.Expect(err).NotTo(gomega.HaveOccurred())
477477

478478
/*
479-
EX - zone -> zone-1, zone-2, zone-3, zone-4, zone-5
479+
EX - zone -> zone-1, zone-2, zone-3, zone-4
480480
so topValStartIndex=1 and topValEndIndex=3 will fetch the 2nd and 3rd index from topology map string
481481
*/
482482
topValStartIndex := 0
483-
topValEndIndex := 5
483+
topValEndIndex := 4
484484

485485
ginkgo.By("Fetching allowed topology assigned to all zones")
486486
allowedTopologies = setSpecificAllowedTopology(allowedTopologies, topkeyStartIndex, topValStartIndex,
@@ -511,24 +511,13 @@ var _ bool = ginkgo.Describe("[domain-isolation] Management-Workload-Domain-Isol
511511
diskSize, storageclass, true)
512512
gomega.Expect(err).NotTo(gomega.HaveOccurred())
513513
volHandle := persistentVolumes[0].Spec.CSI.VolumeHandle
514-
defer func() {
515-
err := fpv.DeletePersistentVolumeClaim(ctx, client, pvclaim.Name, namespace)
516-
gomega.Expect(err).NotTo(gomega.HaveOccurred())
517-
err = e2eVSphere.waitForCNSVolumeToBeDeleted(volHandle)
518-
gomega.Expect(err).NotTo(gomega.HaveOccurred())
519-
}()
520514

521515
ginkgo.By("Creating a Deployment using pvc")
522516
dep, err := createDeployment(ctx, client, 1, labelsMap, nil, namespace,
523517
[]*v1.PersistentVolumeClaim{pvclaim}, execRWXCommandPod1, false, busyBoxImageOnGcr)
524518
gomega.Expect(err).NotTo(gomega.HaveOccurred())
525519
podList, err := fdep.GetPodsForDeployment(ctx, client, dep)
526520
gomega.Expect(err).NotTo(gomega.HaveOccurred())
527-
defer func() {
528-
ginkgo.By("Delete Deployment")
529-
err := client.AppsV1().Deployments(namespace).Delete(ctx, dep.Name, metav1.DeleteOptions{})
530-
gomega.Expect(err).NotTo(gomega.HaveOccurred())
531-
}()
532521

533522
ginkgo.By("Verify the volume is accessible and Read/write is possible")
534523
output := readFileFromPod(namespace, podList.Items[0].Name, filePathPod1)
@@ -543,17 +532,11 @@ var _ bool = ginkgo.Describe("[domain-isolation] Management-Workload-Domain-Isol
543532
gomega.Expect(strings.Contains(output2, "Hello message from Pod1")).NotTo(gomega.BeFalse())
544533

545534
ginkgo.By("Creating service")
546-
service := CreateService(namespace, client)
547-
defer func() {
548-
deleteService(namespace, client, service)
549-
}()
535+
_ = CreateService(namespace, client)
550536

551537
ginkgo.By("Creating statefulset")
552538
statefulset := createCustomisedStatefulSets(ctx, client, namespace, true, replicas, false, nil,
553539
false, true, "", "", storageclass, storageclass.Name)
554-
defer func() {
555-
fss.DeleteAllStatefulSets(ctx, client, namespace)
556-
}()
557540

558541
ginkgo.By("Verify svc pv affinity, pvc annotation and pod node affinity")
559542
err = verifyPvcAnnotationPvAffinityPodAnnotationInSvc(ctx, client, statefulset, nil, dep, namespace,
@@ -581,46 +564,19 @@ var _ bool = ginkgo.Describe("[domain-isolation] Management-Workload-Domain-Isol
581564
gomega.Expect(err).NotTo(gomega.HaveOccurred())
582565

583566
ginkgo.By("Create a dynamic volume snapshot")
584-
volumeSnapshot, snapshotContent, snapshotCreated,
585-
snapshotContentCreated, snapshotId, _, err := createDynamicVolumeSnapshot(ctx, namespace, snapc,
567+
volumeSnapshot, _, _,
568+
_, snapshotId, _, err := createDynamicVolumeSnapshot(ctx, namespace, snapc,
586569
volumeSnapshotClass, pvclaim, volHandle, diskSize, true)
587570
gomega.Expect(err).NotTo(gomega.HaveOccurred())
588-
defer func() {
589-
if snapshotContentCreated {
590-
err = deleteVolumeSnapshotContent(ctx, snapshotContent, snapc, pandoraSyncWaitTime)
591-
gomega.Expect(err).NotTo(gomega.HaveOccurred())
592-
}
593-
594-
if snapshotCreated {
595-
framework.Logf("Deleting volume snapshot")
596-
deleteVolumeSnapshotWithPandoraWait(ctx, snapc, namespace, volumeSnapshot.Name, pandoraSyncWaitTime)
597-
598-
framework.Logf("Wait till the volume snapshot is deleted")
599-
err = waitForVolumeSnapshotContentToBeDeletedWithPandoraWait(ctx, snapc,
600-
*volumeSnapshot.Status.BoundVolumeSnapshotContentName, pandoraSyncWaitTime)
601-
gomega.Expect(err).NotTo(gomega.HaveOccurred())
602-
}
603-
}()
604571

605572
ginkgo.By("Mark zone-2 for removal from wcp namespace")
606573
err = markZoneForRemovalFromWcpNs(vcRestSessionId, namespace,
607574
topologyAffinityDetails[topologyCategories[0]][1]) // this will fetch zone-2
608575
gomega.Expect(err).NotTo(gomega.HaveOccurred())
609576

610577
ginkgo.By("Restore a volume snapshot")
611-
pvclaim2, pvs2, pod2 := verifyVolumeRestoreOperation(ctx, client, namespace, storageclass,
578+
_, _, pod2 := verifyVolumeRestoreOperation(ctx, client, namespace, storageclass,
612579
volumeSnapshot, diskSize, true)
613-
volHandle2 := pvs2[0].Spec.CSI.VolumeHandle
614-
defer func() {
615-
ginkgo.By(fmt.Sprintf("Deleting the pod %s in namespace %s", pod2.Name, namespace))
616-
err = fpod.DeletePodWithWait(ctx, client, pod2)
617-
gomega.Expect(err).NotTo(gomega.HaveOccurred())
618-
619-
err := fpv.DeletePersistentVolumeClaim(ctx, client, pvclaim2.Name, namespace)
620-
gomega.Expect(err).NotTo(gomega.HaveOccurred())
621-
err = e2eVSphere.waitForCNSVolumeToBeDeleted(volHandle2)
622-
gomega.Expect(err).NotTo(gomega.HaveOccurred())
623-
}()
624580

625581
ginkgo.By("Perform scaling operation on statefulset. Increase the replica count to 9 when zone is marked" +
626582
" for removal")
@@ -634,7 +590,7 @@ var _ bool = ginkgo.Describe("[domain-isolation] Management-Workload-Domain-Isol
634590
gomega.Expect(err).NotTo(gomega.HaveOccurred())
635591

636592
ginkgo.By("Delete dynamic volume snapshot")
637-
snapshotCreated, snapshotContentCreated, err = deleteVolumeSnapshot(ctx, snapc, namespace,
593+
_, _, err = deleteVolumeSnapshot(ctx, snapc, namespace,
638594
volumeSnapshot, pandoraSyncWaitTime, volHandle, snapshotId, true)
639595
gomega.Expect(err).NotTo(gomega.HaveOccurred())
640596
})
@@ -1369,7 +1325,6 @@ var _ bool = ginkgo.Describe("[domain-isolation] Management-Workload-Domain-Isol
13691325
deployments := []*appsv1.Deployment{}
13701326
depSpecs := [][]*v1.PersistentVolumeClaim{
13711327
{pvcList[0], pvcList[1]},
1372-
{pvcList[2]},
13731328
}
13741329
for _, pvcSet := range depSpecs {
13751330
dep, err := createDeployment(ctx, client, 1, labelsMap, nil, namespace,

0 commit comments

Comments
 (0)