Skip to content

Commit 1413d50

Browse files
author
sipriyaa
committed
topology parallel testcases execution code fix
1 parent a6b433d commit 1413d50

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+395
-177
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_change_test.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ var _ bool = ginkgo.Describe("[csi-supervisor] config-change-test", func() {
2525
cancel context.CancelFunc
2626
nimbusGeneratedVcPwd string
2727
clientIndex int
28+
vcAddress string
2829
)
2930
const (
3031
configSecret = "vsphere-config-secret"
@@ -100,7 +101,8 @@ var _ bool = ginkgo.Describe("[csi-supervisor] config-change-test", func() {
100101
gomega.Expect(err).NotTo(gomega.HaveOccurred())
101102

102103
ginkgo.By(fmt.Sprintln("Changing password on the vCenter host"))
103-
vcAddress := e2eVSphere.Config.Global.VCenterHostname + ":" + sshdPort
104+
vcAddress, _, err = readVcAddress()
105+
gomega.Expect(err).NotTo(gomega.HaveOccurred())
104106
username := vsphereCfg.Global.User
105107
currentPassword := vsphereCfg.Global.Password
106108
newPassword := e2eTestPassword

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/crypto.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ var _ = ginkgo.Describe("[csi-supervisor] [encryption] Block volume encryption",
5959
encryptedStorageClass *storagev1.StorageClass
6060
keyProviderID string
6161
isVsanHealthServiceStopped bool
62+
vcAddress string
63+
err error
6264
)
6365

6466
ginkgo.BeforeEach(func() {
@@ -152,7 +154,8 @@ var _ = ginkgo.Describe("[csi-supervisor] [encryption] Block volume encryption",
152154

153155
if isVsanHealthServiceStopped {
154156
ginkgo.By(fmt.Sprintln("Starting vsan-health on the vCenter host"))
155-
vcAddress := e2eVSphere.Config.Global.VCenterHostname + ":" + sshdPort
157+
vcAddress, _, err = readVcAddress()
158+
gomega.Expect(err).NotTo(gomega.HaveOccurred())
156159
err := invokeVCenterServiceControl(ctx, startOperation, vsanhealthServiceName, vcAddress)
157160
gomega.Expect(err).NotTo(gomega.HaveOccurred())
158161
ginkgo.By(fmt.Sprintf("Sleeping for %v seconds to allow vsan-health to come up again", vsanHealthServiceWaitTime))
@@ -604,7 +607,6 @@ var _ = ginkgo.Describe("[csi-supervisor] [encryption] Block volume encryption",
604607
validateVolumeToBeEncryptedWithKey(ctx, pvc.Spec.VolumeName, keyProviderID, keyID1)
605608

606609
ginkgo.By("7. Stop Vsan-health service")
607-
vcAddress := e2eVSphere.Config.Global.VCenterHostname + ":" + sshdPort
608610
ginkgo.By(fmt.Sprintln("Stopping vsan-health on the vCenter host"))
609611
isVsanHealthServiceStopped = true
610612
err := invokeVCenterServiceControl(ctx, stopOperation, vsanhealthServiceName, vcAddress)

tests/e2e/csi_cns_telemetry_vc_reboot.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ var _ bool = ginkgo.Describe("[csi-block-vanilla] [csi-file-vanilla] "+
6262
// Reset the cluster distribution value to default value "CSI-Vanilla".
6363
setClusterDistribution(ctx, client, vanillaClusterDistribution)
6464
}
65-
vcAddress = e2eVSphere.Config.Global.VCenterHostname + ":" + sshdPort
65+
vcAddress, _, err = readVcAddress()
66+
gomega.Expect(err).NotTo(gomega.HaveOccurred())
6667
})
6768
ginkgo.AfterEach(func() {
6869
ctx, cancel := context.WithCancel(context.Background())

tests/e2e/csi_snapshot_basic.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ var _ = ginkgo.Describe("Volume Snapshot Basic Test", func() {
106106
}
107107

108108
// reading vc credentials
109-
vcAddress = e2eVSphere.Config.Global.VCenterHostname + ":" + sshdPort
109+
vcAddress, _, err = readVcAddress()
110+
gomega.Expect(err).NotTo(gomega.HaveOccurred())
110111

111112
// reading operation scale value
112113
if os.Getenv("VOLUME_OPS_SCALE") != "" {
@@ -167,8 +168,6 @@ var _ = ginkgo.Describe("Volume Snapshot Basic Test", func() {
167168
snapc, err = snapclient.NewForConfig(restConfig)
168169
gomega.Expect(err).NotTo(gomega.HaveOccurred())
169170
setStoragePolicyQuota(ctx, restConfig, storagePolicyName, namespace, rqLimit)
170-
171-
vcAddress := e2eVSphere.Config.Global.VCenterHostname + ":" + sshdPort
172171
//if isQuotaValidationSupported is true then quotaValidation is considered in tests
173172
vcVersion = getVCversion(ctx, vcAddress)
174173
isQuotaValidationSupported = isVersionGreaterOrEqual(vcVersion, quotaSupportedVCVersion)

tests/e2e/csi_snapshot_negative.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ var _ = ginkgo.Describe("[block-snapshot-negative] Volume Snapshot Fault-Injecti
6161
serviceName string
6262
pandoraSyncWaitTime int
6363
storagePolicyName string
64+
vcAddress string
6465
)
6566

6667
ginkgo.BeforeEach(func() {
@@ -78,6 +79,10 @@ var _ = ginkgo.Describe("[block-snapshot-negative] Volume Snapshot Fault-Injecti
7879
framework.Failf("Unable to find ready and schedulable Node")
7980
}
8081

82+
//reading vc address
83+
vcAddress, _, err = readVcAddress()
84+
gomega.Expect(err).NotTo(gomega.HaveOccurred())
85+
8186
// Get snapshot client using the rest config
8287
if vanillaCluster {
8388
restConfig = getRestConfigClient()
@@ -163,7 +168,6 @@ var _ = ginkgo.Describe("[block-snapshot-negative] Volume Snapshot Fault-Injecti
163168
startHostDOnHost(ctx, hostIP)
164169
}
165170
} else {
166-
vcAddress := e2eVSphere.Config.Global.VCenterHostname + ":" + sshdPort
167171
ginkgo.By(fmt.Sprintf("Starting %v on the vCenter host", serviceName))
168172
err := invokeVCenterServiceControl(ctx, startOperation, serviceName, vcAddress)
169173
gomega.Expect(err).NotTo(gomega.HaveOccurred())
@@ -320,6 +324,7 @@ func snapshotOperationWhileServiceDown(serviceName string, namespace string,
320324
scParameters := make(map[string]string)
321325

322326
storagePolicyName := GetAndExpectStringEnvVar(envStoragePolicyNameForSharedDatastores)
327+
vcAddress, _, err := readVcAddress()
323328

324329
if vanillaCluster {
325330
ginkgo.By("Create storage class")
@@ -477,7 +482,6 @@ func snapshotOperationWhileServiceDown(serviceName string, namespace string,
477482

478483
} else {
479484
ginkgo.By(fmt.Sprintf("Stopping %v on the vCenter host", serviceName))
480-
vcAddress := e2eVSphere.Config.Global.VCenterHostname + ":" + sshdPort
481485
err = invokeVCenterServiceControl(ctx, stopOperation, serviceName, vcAddress)
482486
gomega.Expect(err).NotTo(gomega.HaveOccurred())
483487
isServiceStopped = true
@@ -604,7 +608,6 @@ func snapshotOperationWhileServiceDown(serviceName string, namespace string,
604608

605609
} else {
606610
ginkgo.By(fmt.Sprintf("Stopping %v on the vCenter host", serviceName))
607-
vcAddress := e2eVSphere.Config.Global.VCenterHostname + ":" + sshdPort
608611
err = invokeVCenterServiceControl(ctx, stopOperation, serviceName, vcAddress)
609612
gomega.Expect(err).NotTo(gomega.HaveOccurred())
610613
isServiceStopped = true
@@ -730,7 +733,6 @@ func snapshotOperationWhileServiceDown(serviceName string, namespace string,
730733

731734
} else {
732735
ginkgo.By(fmt.Sprintf("Stopping %v on the vCenter host", serviceName))
733-
vcAddress := e2eVSphere.Config.Global.VCenterHostname + ":" + sshdPort
734736
err = invokeVCenterServiceControl(ctx, stopOperation, serviceName, vcAddress)
735737
gomega.Expect(err).NotTo(gomega.HaveOccurred())
736738
isServiceStopped = true

tests/e2e/csi_static_provisioning_basic.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ var _ = ginkgo.Describe("Basic Static Provisioning", func() {
8080
nonSharedDatastoreURL string
8181
fullSyncWaitTime int
8282
isQuotaValidationSupported bool
83+
vcAddress string
8384
)
8485

8586
ginkgo.BeforeEach(func() {
@@ -109,6 +110,10 @@ var _ = ginkgo.Describe("Basic Static Provisioning", func() {
109110
datastoreURL = GetAndExpectStringEnvVar(envSharedDatastoreURL)
110111
nonSharedDatastoreURL = GetAndExpectStringEnvVar(envNonSharedStorageClassDatastoreURL)
111112

113+
// reading vc address
114+
vcAddress, _, err = readVcAddress()
115+
gomega.Expect(err).NotTo(gomega.HaveOccurred())
116+
112117
finder := find.NewFinder(e2eVSphere.Client.Client, false)
113118
cfg, err := getConfig()
114119
gomega.Expect(err).NotTo(gomega.HaveOccurred())
@@ -146,7 +151,6 @@ var _ = ginkgo.Describe("Basic Static Provisioning", func() {
146151
}
147152

148153
if supervisorCluster || stretchedSVC {
149-
vcAddress := e2eVSphere.Config.Global.VCenterHostname + ":" + sshdPort
150154
//if isQuotaValidationSupported is true then quotaValidation is considered in tests
151155
vcVersion = getVCversion(ctx, vcAddress)
152156
isQuotaValidationSupported = isVersionGreaterOrEqual(vcVersion, quotaSupportedVCVersion)
@@ -155,7 +159,6 @@ var _ = ginkgo.Describe("Basic Static Provisioning", func() {
155159
})
156160

157161
ginkgo.AfterEach(func() {
158-
vcAddress := e2eVSphere.Config.Global.VCenterHostname + ":" + sshdPort
159162
ctx, cancel := context.WithCancel(context.Background())
160163
defer cancel()
161164
ginkgo.By("Performing test cleanup")
@@ -1387,7 +1390,6 @@ var _ = ginkgo.Describe("Basic Static Provisioning", func() {
13871390

13881391
ginkgo.By(fmt.Sprintln("Stopping vsan-health on the vCenter host"))
13891392
isVsanHealthServiceStopped = true
1390-
vcAddress := e2eVSphere.Config.Global.VCenterHostname + ":" + sshdPort
13911393
err = invokeVCenterServiceControl(ctx, stopOperation, vsanhealthServiceName, vcAddress)
13921394
gomega.Expect(err).NotTo(gomega.HaveOccurred())
13931395
ginkgo.By(fmt.Sprintf("Sleeping for %v seconds to allow vsan-health to completely shutdown",
@@ -1469,7 +1471,6 @@ var _ = ginkgo.Describe("Basic Static Provisioning", func() {
14691471

14701472
ginkgo.By(fmt.Sprintln("Stopping sps on the vCenter host"))
14711473
isSPSserviceStopped = true
1472-
vcAddress := e2eVSphere.Config.Global.VCenterHostname + ":" + sshdPort
14731474
err = invokeVCenterServiceControl(ctx, stopOperation, spsServiceName, vcAddress)
14741475
gomega.Expect(err).NotTo(gomega.HaveOccurred())
14751476
ginkgo.By(fmt.Sprintf("Sleeping for %v seconds to allow sps to completely shutdown", vsanHealthServiceWaitTime))
@@ -2271,7 +2272,6 @@ var _ = ginkgo.Describe("Basic Static Provisioning", func() {
22712272

22722273
ginkgo.By(fmt.Sprintln("Stopping vsan-health on the vCenter host"))
22732274
isVsanHealthServiceStopped = true
2274-
vcAddress := e2eVSphere.Config.Global.VCenterHostname + ":" + sshdPort
22752275
err = invokeVCenterServiceControl(ctx, stopOperation, vsanhealthServiceName, vcAddress)
22762276
gomega.Expect(err).NotTo(gomega.HaveOccurred())
22772277
err = waitVCenterServiceToBeInState(ctx, vsanhealthServiceName, vcAddress, svcStoppedMessage)

tests/e2e/ds_rename.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ var _ bool = ginkgo.Describe("ds-rename", func() {
5555
bootstrap()
5656
scParameters = make(map[string]string)
5757
storagePolicyName = GetAndExpectStringEnvVar(envStoragePolicyNameForSharedDatastores)
58-
vcAddress = e2eVSphere.Config.Global.VCenterHostname + ":" + sshdPort
58+
vcAddress, _, err = readVcAddress()
59+
gomega.Expect(err).NotTo(gomega.HaveOccurred())
5960

6061
govmomiClient := newClient(ctx, &e2eVSphere)
6162
pc = newPbmClient(ctx, govmomiClient)

tests/e2e/e2e_common.go

+13-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ const (
193193
oneMinuteWaitTimeInSeconds = 60
194194
spsServiceName = "sps"
195195
snapshotterContainerName = "csi-snapshotter"
196-
sshdPort = "22"
197196
sshSecretName = "SSH_SECRET_NAME"
198197
svcRunningMessage = "Running"
199198
svcMasterIP = "SVC_MASTER_IP"
@@ -352,6 +351,19 @@ var (
352351
busyBoxImageOnGcr = "busybox"
353352
)
354353

354+
// Private network and public network ports read for master vm and vcenter for nimbus testbed
355+
var (
356+
defaultShhdPortNum = "22"
357+
envMasterIp1 = "MASTER_IP1"
358+
envMasterIp2 = "MASTER_IP2"
359+
envMasterIp3 = "MASTER_IP3"
360+
envMasterIP1SshdPortNum = "MASTER_IP1_SSHD_PORT_NUM"
361+
envMasterIP2SshdPortNum = "MASTER_IP2_SSHD_PORT_NUM"
362+
envMasterIP3SshdPortNum = "MASTER_IP3_SSHD_PORT_NUM"
363+
envVcSshdPortNum = "VC_SSHD_PORT_NUM"
364+
envEsxPortNum = "ESX_SSHD_PORT_NUM"
365+
)
366+
355367
// For VCP to CSI migration tests.
356368
var (
357369
envSharedDatastoreName = "SHARED_VSPHERE_DATASTORE_NAME"

0 commit comments

Comments
 (0)