Skip to content

Commit 52b4e37

Browse files
author
sipriyaa
committed
topology parallel testcases execution code fix
1 parent a6b433d commit 52b4e37

8 files changed

+36
-30
lines changed

tests/e2e/binding_modes_with_topology.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ var _ = ginkgo.Describe("[csi-topology-vanilla] Topology-Aware-Provisioning-With
8282
framework.ExpectNoError(e2eVSphere.waitForCNSVolumeToBeDeleted(pv.Spec.CSI.VolumeHandle))
8383
}
8484
})
85-
verifyTopologyAwareProvisioning := func(f *framework.Framework, client clientset.Interface, namespace string,
86-
scParameters map[string]string, allowedTopologies []v1.TopologySelectorLabelRequirement) {
85+
verifyTopologyAwareProvisioning := func(client clientset.Interface, namespace string,
86+
allowedTopologies []v1.TopologySelectorLabelRequirement) {
8787
var cancel context.CancelFunc
8888
ctx, cancel := context.WithCancel(context.Background())
8989
defer cancel()
@@ -103,7 +103,7 @@ var _ = ginkgo.Describe("[csi-topology-vanilla] Topology-Aware-Provisioning-With
103103

104104
ginkgo.By("Expect claim status to be in Pending state")
105105
err = fpv.WaitForPersistentVolumeClaimPhase(ctx, v1.ClaimPending, client,
106-
pvclaim.Namespace, pvclaim.Name, framework.Poll, time.Minute)
106+
pvclaim.Namespace, pvclaim.Name, framework.Poll, framework.ClaimProvisionTimeout)
107107
gomega.Expect(err).NotTo(gomega.HaveOccurred(),
108108
fmt.Sprintf("Failed to find the volume in pending state with err: %v", err))
109109

@@ -113,7 +113,7 @@ var _ = ginkgo.Describe("[csi-topology-vanilla] Topology-Aware-Provisioning-With
113113

114114
ginkgo.By("Expect claim to be in Bound state and provisioning volume passes")
115115
err = fpv.WaitForPersistentVolumeClaimPhase(ctx, v1.ClaimBound, client,
116-
pvclaim.Namespace, pvclaim.Name, framework.Poll, time.Minute)
116+
pvclaim.Namespace, pvclaim.Name, framework.Poll, framework.ClaimProvisionTimeout)
117117
gomega.Expect(err).NotTo(gomega.HaveOccurred(), fmt.Sprintf("Failed to provision volume with err: %v", err))
118118

119119
pv = getPvFromClaim(client, pvclaim.Namespace, pvclaim.Name)
@@ -177,7 +177,7 @@ var _ = ginkgo.Describe("[csi-topology-vanilla] Topology-Aware-Provisioning-With
177177
// 9. Delete SC.
178178
ginkgo.It("Verify provisioning succeeds with VolumeBindingMode set to "+
179179
"WaitForFirstConsumer and without AllowedTopologies in the storage class ", func() {
180-
verifyTopologyAwareProvisioning(f, client, namespace, nil, nil)
180+
verifyTopologyAwareProvisioning(client, namespace, nil)
181181
})
182182

183183
// Test to verify provisioning with "VolumeBindingMode = WaitForFirstConsumer"
@@ -197,7 +197,7 @@ var _ = ginkgo.Describe("[csi-topology-vanilla] Topology-Aware-Provisioning-With
197197
// Preparing allowedTopologies using topologies with shared datastores.
198198
regionZoneValue := GetAndExpectStringEnvVar(envRegionZoneWithSharedDS)
199199
regionValues, zoneValues, allowedTopologies = topologyParameterForStorageClass(regionZoneValue)
200-
verifyTopologyAwareProvisioning(f, client, namespace, nil, allowedTopologies)
200+
verifyTopologyAwareProvisioning(client, namespace, allowedTopologies)
201201
})
202202

203203
})

tests/e2e/config_secret.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ var _ = ginkgo.Describe("Config-Secret", func() {
337337
gomega.Expect(err).NotTo(gomega.HaveOccurred())
338338
ginkgo.By("Expect claim status to be in Pending state")
339339
err = fpv.WaitForPersistentVolumeClaimPhase(ctx, v1.ClaimPending, client,
340-
pvclaim3.Namespace, pvclaim3.Name, framework.Poll, time.Minute)
340+
pvclaim3.Namespace, pvclaim3.Name, framework.Poll, framework.ClaimProvisionTimeout)
341341
gomega.Expect(err).NotTo(gomega.HaveOccurred(),
342342
fmt.Sprintf("Failed to find the volume in pending state with err: %v", err))
343343
defer func() {
@@ -692,7 +692,7 @@ var _ = ginkgo.Describe("Config-Secret", func() {
692692
gomega.Expect(err).NotTo(gomega.HaveOccurred())
693693
ginkgo.By("Expect claim status to be in Pending state")
694694
err = fpv.WaitForPersistentVolumeClaimPhase(ctx, v1.ClaimPending, client,
695-
pvclaim2.Namespace, pvclaim2.Name, framework.Poll, time.Minute)
695+
pvclaim2.Namespace, pvclaim2.Name, framework.Poll, framework.ClaimProvisionTimeout)
696696
gomega.Expect(err).NotTo(gomega.HaveOccurred(),
697697
fmt.Sprintf("Failed to find the volume in pending state with err: %v", err))
698698
defer func() {
@@ -813,7 +813,7 @@ var _ = ginkgo.Describe("Config-Secret", func() {
813813
gomega.Expect(err).NotTo(gomega.HaveOccurred())
814814
ginkgo.By("Expect claim status to be in Pending state")
815815
err = fpv.WaitForPersistentVolumeClaimPhase(ctx, v1.ClaimPending, client,
816-
pvclaim2.Namespace, pvclaim2.Name, framework.Poll, time.Minute)
816+
pvclaim2.Namespace, pvclaim2.Name, framework.Poll, framework.ClaimProvisionTimeout)
817817
gomega.Expect(err).NotTo(gomega.HaveOccurred(),
818818
fmt.Sprintf("Failed to find the volume in pending state with err: %v", err))
819819
defer func() {
@@ -931,7 +931,7 @@ var _ = ginkgo.Describe("Config-Secret", func() {
931931
gomega.Expect(err).NotTo(gomega.HaveOccurred())
932932
ginkgo.By("Expect claim status to be in Pending state")
933933
err = fpv.WaitForPersistentVolumeClaimPhase(ctx, v1.ClaimPending, client,
934-
pvclaim1.Namespace, pvclaim1.Name, framework.Poll, time.Minute)
934+
pvclaim1.Namespace, pvclaim1.Name, framework.Poll, framework.ClaimProvisionTimeout)
935935
gomega.Expect(err).NotTo(gomega.HaveOccurred(),
936936
fmt.Sprintf("Failed to find the volume in pending state with err: %v", err))
937937
defer func() {
@@ -1049,7 +1049,7 @@ var _ = ginkgo.Describe("Config-Secret", func() {
10491049
gomega.Expect(err).NotTo(gomega.HaveOccurred())
10501050
ginkgo.By("Expect claim status to be in Pending state")
10511051
err = fpv.WaitForPersistentVolumeClaimPhase(ctx, v1.ClaimPending, client,
1052-
pvclaim2.Namespace, pvclaim2.Name, framework.Poll, time.Minute)
1052+
pvclaim2.Namespace, pvclaim2.Name, framework.Poll, framework.ClaimProvisionTimeout)
10531053
gomega.Expect(err).NotTo(gomega.HaveOccurred(),
10541054
fmt.Sprintf("Failed to find the volume in pending state with err: %v", err))
10551055
defer func() {
@@ -1158,7 +1158,7 @@ var _ = ginkgo.Describe("Config-Secret", func() {
11581158
gomega.Expect(err).NotTo(gomega.HaveOccurred())
11591159
ginkgo.By("Expect claim status to be in Pending state")
11601160
err = fpv.WaitForPersistentVolumeClaimPhase(ctx, v1.ClaimPending, client,
1161-
pvclaim1.Namespace, pvclaim1.Name, framework.Poll, time.Minute)
1161+
pvclaim1.Namespace, pvclaim1.Name, framework.Poll, framework.ClaimProvisionTimeout)
11621162
gomega.Expect(err).NotTo(gomega.HaveOccurred(),
11631163
fmt.Sprintf("Failed to find the volume in pending state with err: %v", err))
11641164
var pvclaims1 []*v1.PersistentVolumeClaim
@@ -1301,7 +1301,7 @@ var _ = ginkgo.Describe("Config-Secret", func() {
13011301
gomega.Expect(err).NotTo(gomega.HaveOccurred())
13021302
ginkgo.By("Expect claim status to be in Pending state")
13031303
err = fpv.WaitForPersistentVolumeClaimPhase(ctx, v1.ClaimPending, client,
1304-
pvclaim2.Namespace, pvclaim2.Name, framework.Poll, time.Minute)
1304+
pvclaim2.Namespace, pvclaim2.Name, framework.Poll, framework.ClaimProvisionTimeout)
13051305
gomega.Expect(err).NotTo(gomega.HaveOccurred(),
13061306
fmt.Sprintf("Failed to find the volume in pending state with err: %v", err))
13071307
defer func() {

tests/e2e/no_hci_mesh_rwx_singlevc_topology.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ var _ = ginkgo.Describe("[rwx-nohci-singlevc-positive] RWX-Topology-NoHciMesh-Si
311311

312312
ginkgo.By(fmt.Sprintf("Creating Storage Class with access mode %q and fstype %q with no "+
313313
"allowed topology specified and with WFFC binding mode", accessmode, nfs4FSType))
314-
scSpec := getVSphereStorageClassSpec(defaultNginxStorageClassName, scParameters, nil, "", bindingModeWffc, false)
314+
scSpec := getVSphereStorageClassSpec("", scParameters, nil, "", bindingModeWffc, false)
315315
sc, err := client.StorageV1().StorageClasses().Create(ctx, scSpec, metav1.CreateOptions{})
316316
gomega.Expect(err).NotTo(gomega.HaveOccurred())
317317
defer func() {
@@ -321,7 +321,7 @@ var _ = ginkgo.Describe("[rwx-nohci-singlevc-positive] RWX-Topology-NoHciMesh-Si
321321

322322
ginkgo.By("Create StatefulSet with replica count 3 with RWX PVC access mode")
323323
service, statefulset, err := createStafeulSetAndVerifyPVAndPodNodeAffinty(ctx, client, namespace, true,
324-
int32(stsReplicas), false, nil, false, false, false, accessmode, sc, false, "")
324+
int32(stsReplicas), false, nil, false, false, true, accessmode, sc, false, "")
325325
gomega.Expect(err).NotTo(gomega.HaveOccurred())
326326
defer func() {
327327
fss.DeleteAllStatefulSets(ctx, client, namespace)
@@ -845,7 +845,7 @@ var _ = ginkgo.Describe("[rwx-nohci-singlevc-positive] RWX-Topology-NoHciMesh-Si
845845
ginkgo.By(fmt.Sprintf("Creating Storage Class with access mode %q and "+
846846
"fstype %q with allowed topology specified at top level "+
847847
"and with WFFC binding mode", accessmode, nfs4FSType))
848-
scSpec := getVSphereStorageClassSpec(defaultNginxStorageClassName, scParameters,
848+
scSpec := getVSphereStorageClassSpec("", scParameters,
849849
allowedTopologyForSC, "", bindingModeWffc, false)
850850
sc, err := client.StorageV1().StorageClasses().Create(ctx, scSpec, metav1.CreateOptions{})
851851
gomega.Expect(err).NotTo(gomega.HaveOccurred())
@@ -856,7 +856,7 @@ var _ = ginkgo.Describe("[rwx-nohci-singlevc-positive] RWX-Topology-NoHciMesh-Si
856856

857857
ginkgo.By("Create StatefulSet with replica count 3 with RWX PVC access mode with pod affinity set to true")
858858
service, statefulset, err := createStafeulSetAndVerifyPVAndPodNodeAffinty(ctx, client, namespace, true,
859-
int32(stsReplicas), false, allowedTopologyForSC, true, false, false, accessmode, sc, false, "")
859+
int32(stsReplicas), false, allowedTopologyForSC, true, false, true, accessmode, sc, false, "")
860860
gomega.Expect(err).NotTo(gomega.HaveOccurred())
861861
defer func() {
862862
fss.DeleteAllStatefulSets(ctx, client, namespace)

tests/e2e/provision_with_multiple_zones.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"context"
2121
"fmt"
2222
"strings"
23-
"time"
2423

2524
"github.com/onsi/ginkgo/v2"
2625
"github.com/onsi/gomega"
@@ -115,7 +114,7 @@ var _ = ginkgo.Describe("[csi-topology-vanilla] Topology-Aware-Provisioning-With
115114
}()
116115
ginkgo.By("Expect claim to pass provisioning volume")
117116
err = fpv.WaitForPersistentVolumeClaimPhase(ctx, v1.ClaimBound, client,
118-
pvclaim.Namespace, pvclaim.Name, framework.Poll, time.Minute)
117+
pvclaim.Namespace, pvclaim.Name, framework.Poll, framework.ClaimProvisionTimeout)
119118
gomega.Expect(err).NotTo(gomega.HaveOccurred(), fmt.Sprintf("Failed to provision volume with err: %v", err))
120119

121120
ginkgo.By("Verify if volume is provisioned in specified zone and region")
@@ -198,7 +197,7 @@ var _ = ginkgo.Describe("[csi-topology-vanilla] Topology-Aware-Provisioning-With
198197

199198
// Creating StorageClass with multiple zone and region topology details
200199
ginkgo.By("Creating StorageClass for Statefulset")
201-
scSpec := getVSphereStorageClassSpec(defaultNginxStorageClassName, nil, allowedTopologies, "", "", false)
200+
scSpec := getVSphereStorageClassSpec("", nil, allowedTopologies, "", "", false)
202201
sc, err := client.StorageV1().StorageClasses().Create(ctx, scSpec, metav1.CreateOptions{})
203202
gomega.Expect(err).NotTo(gomega.HaveOccurred())
204203
defer func() {
@@ -215,6 +214,8 @@ var _ = ginkgo.Describe("[csi-topology-vanilla] Topology-Aware-Provisioning-With
215214
// Creating statefulset with 3 replicas
216215
ginkgo.By("Creating statefulset with 3 replica")
217216
statefulset := GetStatefulSetFromManifest(namespace)
217+
statefulset.Spec.VolumeClaimTemplates[len(statefulset.Spec.VolumeClaimTemplates)-1].
218+
Spec.StorageClassName = &sc.Name
218219
ginkgo.By("Creating statefulset")
219220
var replica int32 = 3
220221
statefulset.Spec.Replicas = &replica

tests/e2e/statefulset_with_topology.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ var _ = ginkgo.Describe("[csi-topology-vanilla] Topology-Aware-Provisioning-With
8383
defer cancel()
8484

8585
ginkgo.By("Creating StorageClass for Statefulset")
86-
scSpec := getVSphereStorageClassSpec(defaultNginxStorageClassName, nil, allowedTopologies, "", "", false)
86+
scSpec := getVSphereStorageClassSpec("", nil, allowedTopologies, "", "", false)
8787
sc, err := client.StorageV1().StorageClasses().Create(ctx, scSpec, metav1.CreateOptions{})
8888
gomega.Expect(err).NotTo(gomega.HaveOccurred())
8989
defer func() {
@@ -92,7 +92,7 @@ var _ = ginkgo.Describe("[csi-topology-vanilla] Topology-Aware-Provisioning-With
9292
}()
9393

9494
ginkgo.By("Creating statefulset with single replica")
95-
statefulset, service, err := createStatefulSetWithOneReplica(client, manifestPath, namespace)
95+
statefulset, service, err := createStatefulSetWithOneReplica(client, manifestPath, namespace, sc)
9696
gomega.Expect(err).NotTo(gomega.HaveOccurred())
9797
defer func() {
9898
deleteService(namespace, client, service)
@@ -158,7 +158,7 @@ var _ = ginkgo.Describe("[csi-topology-vanilla] Topology-Aware-Provisioning-With
158158

159159
// Creating StorageClass with topology details
160160
ginkgo.By("Creating StorageClass for Statefulset")
161-
scSpec := getVSphereStorageClassSpec(defaultNginxStorageClassName, nil, allowedTopologies, "", "", false)
161+
scSpec := getVSphereStorageClassSpec("", nil, allowedTopologies, "", "", false)
162162
sc, err := client.StorageV1().StorageClasses().Create(ctx, scSpec, metav1.CreateOptions{})
163163
gomega.Expect(err).NotTo(gomega.HaveOccurred())
164164
defer func() {
@@ -175,6 +175,8 @@ var _ = ginkgo.Describe("[csi-topology-vanilla] Topology-Aware-Provisioning-With
175175
// Creating statefulset with 3 replicas
176176
ginkgo.By("Creating statefulset with 3 replica")
177177
statefulset := GetStatefulSetFromManifest(namespace)
178+
statefulset.Spec.VolumeClaimTemplates[len(statefulset.Spec.VolumeClaimTemplates)-1].
179+
Spec.StorageClassName = &sc.Name
178180
ginkgo.By("Creating statefulset")
179181
CreateStatefulSet(namespace, statefulset, client)
180182
replicas := *(statefulset.Spec.Replicas)

tests/e2e/topology_aware_node_poweroff.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ var _ = ginkgo.Describe("[csi-topology-vanilla] Topology-Aware-Provisioning-With
106106
GetAndExpectStringEnvVar(envRegionZoneWithSharedDS))
107107

108108
ginkgo.By("Creating StorageClass for Statefulset")
109-
scSpec := getVSphereStorageClassSpec(defaultNginxStorageClassName, nil, allowedTopologies, "", "", false)
109+
scSpec := getVSphereStorageClassSpec("", nil, allowedTopologies, "", "", false)
110110
sc, err := client.StorageV1().StorageClasses().Create(ctx, scSpec, metav1.CreateOptions{})
111111
gomega.Expect(err).NotTo(gomega.HaveOccurred())
112112
defer func() {
@@ -115,7 +115,9 @@ var _ = ginkgo.Describe("[csi-topology-vanilla] Topology-Aware-Provisioning-With
115115
}()
116116

117117
ginkgo.By("Creating statefulset with single replica")
118-
statefulset, service, err := createStatefulSetWithOneReplica(client, manifestPath, namespace)
118+
statefulset, service, err := createStatefulSetWithOneReplica(client, manifestPath, namespace, sc)
119+
statefulset.Spec.VolumeClaimTemplates[len(statefulset.Spec.VolumeClaimTemplates)-1].
120+
Spec.StorageClassName = &sc.Name
119121
gomega.Expect(err).NotTo(gomega.HaveOccurred())
120122
defer func() {
121123
deleteService(namespace, client, service)
@@ -241,7 +243,7 @@ var _ = ginkgo.Describe("[csi-topology-vanilla] Topology-Aware-Provisioning-With
241243
regionValues, zoneValues, allowedTopologies = topologyParameterForStorageClass(topologyValue)
242244

243245
ginkgo.By("Creating StorageClass for Statefulset")
244-
scSpec := getVSphereStorageClassSpec(defaultNginxStorageClassName, nil, allowedTopologies, "", "", false)
246+
scSpec := getVSphereStorageClassSpec("", nil, allowedTopologies, "", "", false)
245247
sc, err := client.StorageV1().StorageClasses().Create(ctx, scSpec, metav1.CreateOptions{})
246248
gomega.Expect(err).NotTo(gomega.HaveOccurred())
247249
defer func() {
@@ -256,7 +258,7 @@ var _ = ginkgo.Describe("[csi-topology-vanilla] Topology-Aware-Provisioning-With
256258
}()
257259

258260
ginkgo.By("Creating statefulset with single replica")
259-
statefulset, service, err := createStatefulSetWithOneReplica(client, manifestPath, namespace)
261+
statefulset, service, err := createStatefulSetWithOneReplica(client, manifestPath, namespace, sc)
260262
gomega.Expect(err).NotTo(gomega.HaveOccurred())
261263
defer func() {
262264
deleteService(namespace, client, service)

tests/e2e/util.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@ func randomPickPVC() *v1.PersistentVolumeClaim {
976976

977977
// createStatefulSetWithOneReplica helps create a stateful set with one replica.
978978
func createStatefulSetWithOneReplica(client clientset.Interface, manifestPath string,
979-
namespace string) (*appsv1.StatefulSet, *v1.Service, error) {
979+
namespace string, sc *storagev1.StorageClass) (*appsv1.StatefulSet, *v1.Service, error) {
980980
ctx, cancel := context.WithCancel(context.Background())
981981
defer cancel()
982982
mkpath := func(file string) string {
@@ -1000,6 +1000,8 @@ func createStatefulSetWithOneReplica(client clientset.Interface, manifestPath st
10001000
}
10011001
replicas := int32(1)
10021002
statefulSet.Spec.Replicas = &replicas
1003+
statefulSet.Spec.VolumeClaimTemplates[len(statefulSet.Spec.VolumeClaimTemplates)-1].
1004+
Spec.StorageClassName = &sc.Name
10031005
_, err = client.AppsV1().StatefulSets(namespace).Create(ctx, statefulSet, metav1.CreateOptions{})
10041006
if err != nil {
10051007
return nil, nil, err

tests/e2e/volume_provisioning_with_topology.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package e2e
1919
import (
2020
"context"
2121
"fmt"
22-
"time"
2322

2423
"github.com/onsi/ginkgo/v2"
2524
"github.com/onsi/gomega"
@@ -103,7 +102,7 @@ var _ = ginkgo.Describe("[csi-topology-vanilla] Basic-Topology-Aware-Provisionin
103102

104103
ginkgo.By("Expect claim to pass provisioning volume")
105104
err = fpv.WaitForPersistentVolumeClaimPhase(ctx, v1.ClaimBound, client,
106-
pvclaim.Namespace, pvclaim.Name, framework.Poll, time.Minute)
105+
pvclaim.Namespace, pvclaim.Name, framework.Poll, framework.ClaimProvisionTimeout)
107106
gomega.Expect(err).NotTo(gomega.HaveOccurred(), fmt.Sprintf("Failed to provision volume with err: %v", err))
108107

109108
ginkgo.By("Verify if volume is provisioned in specified zone and region")

0 commit comments

Comments
 (0)