Skip to content

Commit e56d511

Browse files
CSI testing with different personas
1 parent e338da4 commit e56d511

File tree

124 files changed

+2306
-1489
lines changed

Some content is hidden

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

124 files changed

+2306
-1489
lines changed

tests/e2e/binding_modes_with_topology.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ var _ = ginkgo.Describe("[csi-topology-vanilla] Topology-Aware-Provisioning-With
8888
ctx, cancel := context.WithCancel(context.Background())
8989
defer cancel()
9090

91-
storageclass, pvclaim, err = createPVCAndStorageClass(ctx, client, namespace,
91+
storageclass, pvclaim, err = createPVCAndStorageClass(ctx, client, nil, namespace,
9292
nil, nil, "", allowedTopologies, bindingMode, false, "")
9393
gomega.Expect(err).NotTo(gomega.HaveOccurred())
9494
defer func() {
@@ -116,7 +116,7 @@ var _ = ginkgo.Describe("[csi-topology-vanilla] Topology-Aware-Provisioning-With
116116
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

119-
pv = getPvFromClaim(client, pvclaim.Namespace, pvclaim.Name)
119+
pv = getPvFromClaim(client, nil, pvclaim.Namespace, pvclaim.Name)
120120
ginkgo.By(fmt.Sprintf("Verify volume: %s is attached to the node: %s",
121121
pv.Spec.CSI.VolumeHandle, pod.Spec.NodeName))
122122
vmUUID := getNodeUUID(ctx, client, pod.Spec.NodeName)

tests/e2e/config_change_test.go

Lines changed: 20 additions & 3 deletions
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+
adminClient clientset.Interface
2829
)
2930
const (
3031
configSecret = "vsphere-config-secret"
@@ -35,7 +36,23 @@ var _ bool = ginkgo.Describe("[csi-supervisor] config-change-test", func() {
3536
namespace = getNamespaceToRunTests(f)
3637
ctx, cancel = context.WithCancel(context.Background())
3738
defer cancel()
38-
nodeList, err := fnodes.GetReadySchedulableNodes(ctx, f.ClientSet)
39+
var err error
40+
var nodeList *v1.NodeList
41+
if supervisorCluster || guestCluster {
42+
if svAdminK8sEnv := GetAndExpectStringEnvVar("SUPERVISOR_CLUSTER_KUBE_CONFIG"); svAdminK8sEnv != "" {
43+
adminClient, err = createKubernetesClientFromConfig(svAdminK8sEnv)
44+
gomega.Expect(err).NotTo(gomega.HaveOccurred())
45+
}
46+
if devopsK8sEnv := GetAndExpectStringEnvVar("DEVOPS_KUBE_CONFIG"); devopsK8sEnv != "" {
47+
client, err = createKubernetesClientFromConfig(devopsK8sEnv)
48+
gomega.Expect(err).NotTo(gomega.HaveOccurred())
49+
}
50+
}
51+
if vanillaCluster {
52+
nodeList, err = fnodes.GetReadySchedulableNodes(ctx, f.ClientSet)
53+
} else {
54+
nodeList, err = fnodes.GetReadySchedulableNodes(ctx, adminClient)
55+
}
3956
framework.ExpectNoError(err, "Unable to find ready and schedulable Node")
4057
if !(len(nodeList.Items) > 0) {
4158
framework.Failf("Unable to find ready and schedulable Node")
@@ -76,12 +93,12 @@ var _ bool = ginkgo.Describe("[csi-supervisor] config-change-test", func() {
7693
createResourceQuota(client, namespace, rqLimit, storagePolicyName)
7794
// Create Storage class and PVC
7895
ginkgo.By("Creating Storage Class and PVC")
79-
_, pvc, err := createPVCAndStorageClass(ctx, client, namespace, nil,
96+
_, pvc, err := createPVCAndStorageClass(ctx, client, nil, namespace, nil,
8097
scParameters, "", nil, "", true, "", storagePolicyName)
8198
gomega.Expect(err).NotTo(gomega.HaveOccurred())
8299

83100
ginkgo.By(fmt.Sprintf("Waiting for claim %s to be in bound phase", pvc.Name))
84-
pvs, err := fpv.WaitForPVClaimBoundPhase(ctx, client,
101+
pvs, err := WaitForPVClaimBoundPhase(ctx, client, adminClient,
85102
[]*v1.PersistentVolumeClaim{pvc}, framework.ClaimProvisionTimeout)
86103
gomega.Expect(err).NotTo(gomega.HaveOccurred())
87104
gomega.Expect(pvs).NotTo(gomega.BeEmpty())

tests/e2e/config_secret.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ var _ = ginkgo.Describe("Config-Secret", func() {
187187
gomega.Expect(err).NotTo(gomega.HaveOccurred())
188188

189189
ginkgo.By("Creating Storage Class")
190-
storageclass, err := createStorageClass(client, nil, nil, "", "", false, "")
190+
storageclass, err := createStorageClass(client, nil, nil, nil, "", "", false, "")
191191
gomega.Expect(err).NotTo(gomega.HaveOccurred())
192192
defer func() {
193193
ginkgo.By("Delete Storage Class")
@@ -288,7 +288,7 @@ var _ = ginkgo.Describe("Config-Secret", func() {
288288
gomega.Expect(err).NotTo(gomega.HaveOccurred())
289289

290290
ginkgo.By("Creating Storage Class")
291-
storageclass, err := createStorageClass(client, nil, nil, "", "", false, "")
291+
storageclass, err := createStorageClass(client, nil, nil, nil, "", "", false, "")
292292
gomega.Expect(err).NotTo(gomega.HaveOccurred())
293293
defer func() {
294294
ginkgo.By("Delete Storage Class")
@@ -443,7 +443,7 @@ var _ = ginkgo.Describe("Config-Secret", func() {
443443
gomega.Expect(err).NotTo(gomega.HaveOccurred())
444444

445445
ginkgo.By("Creating Storage Class")
446-
storageclass, err := createStorageClass(client, nil, nil, "", "", false, "")
446+
storageclass, err := createStorageClass(client, nil, nil, nil, "", "", false, "")
447447
gomega.Expect(err).NotTo(gomega.HaveOccurred())
448448
defer func() {
449449
ginkgo.By("Delete Storage Class")
@@ -541,7 +541,7 @@ var _ = ginkgo.Describe("Config-Secret", func() {
541541

542542
ginkgo.By("Verify we can create a PVC and attach it to pod")
543543
ginkgo.By("Creating Storage Class")
544-
storageclass, err := createStorageClass(client, nil, nil, "", "", false, "")
544+
storageclass, err := createStorageClass(client, nil, nil, nil, "", "", false, "")
545545
gomega.Expect(err).NotTo(gomega.HaveOccurred())
546546
defer func() {
547547
ginkgo.By("Delete Storage Class")
@@ -657,7 +657,7 @@ var _ = ginkgo.Describe("Config-Secret", func() {
657657
gomega.Expect(err).NotTo(gomega.HaveOccurred())
658658

659659
ginkgo.By("Creating Storage Class")
660-
storageclass, err := createStorageClass(client, nil, nil, "", "", false, "")
660+
storageclass, err := createStorageClass(client, nil, nil, nil, "", "", false, "")
661661
gomega.Expect(err).NotTo(gomega.HaveOccurred())
662662
defer func() {
663663
ginkgo.By("Delete Storage Class")
@@ -785,7 +785,7 @@ var _ = ginkgo.Describe("Config-Secret", func() {
785785
gomega.Expect(err).NotTo(gomega.HaveOccurred())
786786

787787
ginkgo.By("Creating Storage Class")
788-
storageclass, err := createStorageClass(client, nil, nil, "", "", false, "")
788+
storageclass, err := createStorageClass(client, nil, nil, nil, "", "", false, "")
789789
gomega.Expect(err).NotTo(gomega.HaveOccurred())
790790
defer func() {
791791
ginkgo.By("Delete Storage Class")
@@ -918,7 +918,7 @@ var _ = ginkgo.Describe("Config-Secret", func() {
918918
gomega.Expect(err).NotTo(gomega.HaveOccurred())
919919

920920
ginkgo.By("Creating Storage Class")
921-
storageclass, err := createStorageClass(client, nil, nil, "", "", false, "")
921+
storageclass, err := createStorageClass(client, nil, nil, nil, "", "", false, "")
922922
gomega.Expect(err).NotTo(gomega.HaveOccurred())
923923
defer func() {
924924
ginkgo.By("Delete Storage Class")
@@ -1020,7 +1020,7 @@ var _ = ginkgo.Describe("Config-Secret", func() {
10201020
gomega.Expect(err).NotTo(gomega.HaveOccurred())
10211021

10221022
ginkgo.By("Creating Storage Class")
1023-
storageclass, err := createStorageClass(client, nil, nil, "", "", false, "")
1023+
storageclass, err := createStorageClass(client, nil, nil, nil, "", "", false, "")
10241024
gomega.Expect(err).NotTo(gomega.HaveOccurred())
10251025
defer func() {
10261026
ginkgo.By("Delete Storage Class")
@@ -1145,7 +1145,7 @@ var _ = ginkgo.Describe("Config-Secret", func() {
11451145

11461146
ginkgo.By("Verify we can create a PVC and attach it to pod")
11471147
ginkgo.By("Creating Storage Class")
1148-
storageclass, err := createStorageClass(client, nil, nil, "", "", false, "")
1148+
storageclass, err := createStorageClass(client, nil, nil, nil, "", "", false, "")
11491149
gomega.Expect(err).NotTo(gomega.HaveOccurred())
11501150
defer func() {
11511151
ginkgo.By("Delete Storage Class")
@@ -1273,7 +1273,7 @@ var _ = ginkgo.Describe("Config-Secret", func() {
12731273

12741274
ginkgo.By("Verify we can create a PVC and attach it to pod")
12751275
ginkgo.By("Creating Storage Class")
1276-
storageclass, err := createStorageClass(client, nil, nil, "", "", false, "")
1276+
storageclass, err := createStorageClass(client, nil, nil, nil, "", "", false, "")
12771277
gomega.Expect(err).NotTo(gomega.HaveOccurred())
12781278
defer func() {
12791279
ginkgo.By("Delete Storage Class")

tests/e2e/crypto.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ var _ = ginkgo.Describe("[csi-supervisor] [encryption] Block volume encryption",
9090

9191
// Load standard storage class
9292
standardStoragePolicyName := GetAndExpectStringEnvVar(envStoragePolicyNameForSharedDatastores)
93-
standardStorageClass, err = createStorageClass(client,
93+
standardStorageClass, err = createStorageClass(client, nil,
9494
map[string]string{
9595
scParamStoragePolicyID: e2eVSphere.GetSpbmPolicyID(standardStoragePolicyName),
9696
},
@@ -101,7 +101,7 @@ var _ = ginkgo.Describe("[csi-supervisor] [encryption] Block volume encryption",
101101

102102
// Load encrypted storage class
103103
encryptedStoragePolicyName := GetAndExpectStringEnvVar(envStoragePolicyNameWithEncryption)
104-
encryptedStorageClass, err = createStorageClass(client,
104+
encryptedStorageClass, err = createStorageClass(client, nil,
105105
map[string]string{
106106
scParamStoragePolicyID: e2eVSphere.GetSpbmPolicyID(encryptedStoragePolicyName),
107107
},

tests/e2e/crypto_snapshot.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ var _ = ginkgo.Describe("[csi-supervisor] [encryption] Block volume snapshot enc
9292

9393
// Load standard storage class
9494
standardStoragePolicyName := GetAndExpectStringEnvVar(envStoragePolicyNameForSharedDatastores)
95-
standardStorageClass, err = createStorageClass(client,
95+
standardStorageClass, err = createStorageClass(client, nil,
9696
map[string]string{
9797
scParamStoragePolicyID: e2eVSphere.GetSpbmPolicyID(standardStoragePolicyName),
9898
},
@@ -103,7 +103,7 @@ var _ = ginkgo.Describe("[csi-supervisor] [encryption] Block volume snapshot enc
103103

104104
// Load encrypted storage class
105105
encryptedStoragePolicyName := GetAndExpectStringEnvVar(envStoragePolicyNameWithEncryption)
106-
encryptedStorageClass, err = createStorageClass(client,
106+
encryptedStorageClass, err = createStorageClass(client, nil,
107107
map[string]string{
108108
scParamStoragePolicyID: e2eVSphere.GetSpbmPolicyID(encryptedStoragePolicyName),
109109
},

tests/e2e/csi_cns_telemetry.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ var _ = ginkgo.Describe("[csi-block-vanilla] [csi-file-vanilla] [csi-block-vanil
122122

123123
ginkgo.By("Creating a PVC")
124124
scParameters[scParamDatastoreURL] = datastoreURL
125-
storageclasspvc1, pvclaim1, err = createPVCAndStorageClass(ctx, client,
125+
storageclasspvc1, pvclaim1, err = createPVCAndStorageClass(ctx, client, nil,
126126
namespace, nil, scParameters, diskSize, nil, "", false, "")
127127
gomega.Expect(err).NotTo(gomega.HaveOccurred())
128128

@@ -171,7 +171,7 @@ var _ = ginkgo.Describe("[csi-block-vanilla] [csi-file-vanilla] [csi-block-vanil
171171

172172
ginkgo.By("Creating Second PVC")
173173
scParameters[scParamDatastoreURL] = datastoreURL
174-
storageclasspvc2, pvclaim2, err = createPVCAndStorageClass(ctx, client,
174+
storageclasspvc2, pvclaim2, err = createPVCAndStorageClass(ctx, client, nil,
175175
namespace, nil, scParameters, diskSize, nil, "", false, "")
176176
gomega.Expect(err).NotTo(gomega.HaveOccurred())
177177

@@ -309,7 +309,7 @@ var _ = ginkgo.Describe("[csi-block-vanilla] [csi-file-vanilla] [csi-block-vanil
309309

310310
ginkgo.By("Creating a PVC")
311311
scParameters[scParamDatastoreURL] = datastoreURL
312-
storageclasspvc, pvclaim, err = createPVCAndStorageClass(ctx, client,
312+
storageclasspvc, pvclaim, err = createPVCAndStorageClass(ctx, client, nil,
313313
namespace, nil, scParameters, diskSize, nil, "", false, "")
314314
gomega.Expect(err).NotTo(gomega.HaveOccurred())
315315

tests/e2e/csi_cns_telemetry_statefulsets.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ var _ = ginkgo.Describe("[csi-block-vanilla] [csi-file-vanilla] [csi-supervisor]
177177
gomega.Expect(err).NotTo(gomega.HaveOccurred())
178178
for _, volumespec := range sspod.Spec.Volumes {
179179
if volumespec.PersistentVolumeClaim != nil {
180-
pv := getPvFromClaim(client, statefulset.Namespace, volumespec.PersistentVolumeClaim.ClaimName)
180+
pv := getPvFromClaim(client, nil, statefulset.Namespace, volumespec.PersistentVolumeClaim.ClaimName)
181181
// Verify the attached volume match the one in CNS cache.
182182
volumeID := pv.Spec.CSI.VolumeHandle
183183

tests/e2e/csi_cns_telemetry_vc_reboot.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ var _ bool = ginkgo.Describe("[csi-block-vanilla] [csi-file-vanilla] "+
118118
// Decide which test setup is available to run.
119119
if vanillaCluster {
120120
ginkgo.By("CNS_TEST: Running for Vanilla setup")
121-
storageclass, pvclaim, err = createPVCAndStorageClass(ctx, client, namespace, nil, nil, "", nil, "", false, "")
121+
storageclass, pvclaim, err = createPVCAndStorageClass(ctx, client, nil, namespace, nil, nil, "", nil, "", false, "")
122122
}
123123
gomega.Expect(err).NotTo(gomega.HaveOccurred())
124124

@@ -137,7 +137,7 @@ var _ bool = ginkgo.Describe("[csi-block-vanilla] [csi-file-vanilla] "+
137137
[]*v1.PersistentVolumeClaim{pvclaim}, 2*framework.ClaimProvisionTimeout)
138138
gomega.Expect(err).NotTo(gomega.HaveOccurred())
139139
gomega.Expect(pvc).NotTo(gomega.BeEmpty())
140-
pv := getPvFromClaim(client, pvclaim.Namespace, pvclaim.Name)
140+
pv := getPvFromClaim(client, nil, pvclaim.Namespace, pvclaim.Name)
141141
volumeID := pv.Spec.CSI.VolumeHandle
142142

143143
ginkgo.By("Creating pod to attach PV to the node")
@@ -186,7 +186,7 @@ var _ bool = ginkgo.Describe("[csi-block-vanilla] [csi-file-vanilla] "+
186186
// Decide which test setup is available to run.
187187
if vanillaCluster {
188188
ginkgo.By("Creating another PVC for Vanilla setup")
189-
storageclass2, pvclaim2, err = createPVCAndStorageClass(ctx, client, namespace, nil, nil, "", nil, "", false, "")
189+
storageclass2, pvclaim2, err = createPVCAndStorageClass(ctx, client, nil, namespace, nil, nil, "", nil, "", false, "")
190190
}
191191
gomega.Expect(err).NotTo(gomega.HaveOccurred())
192192

@@ -214,7 +214,7 @@ var _ bool = ginkgo.Describe("[csi-block-vanilla] [csi-file-vanilla] "+
214214
[]*v1.PersistentVolumeClaim{pvclaim2}, 2*framework.ClaimProvisionTimeout)
215215
gomega.Expect(err).NotTo(gomega.HaveOccurred())
216216
gomega.Expect(pvc2).NotTo(gomega.BeEmpty())
217-
pv2 := getPvFromClaim(client, pvclaim2.Namespace, pvclaim2.Name)
217+
pv2 := getPvFromClaim(client, nil, pvclaim2.Namespace, pvclaim2.Name)
218218
volumeID2 := pv2.Spec.CSI.VolumeHandle
219219

220220
ginkgo.By("Creating pod to attach PV2 to the node")
@@ -329,7 +329,7 @@ var _ bool = ginkgo.Describe("[csi-block-vanilla] [csi-file-vanilla] "+
329329
// Decide which test setup is available to run.
330330
if vanillaCluster {
331331
ginkgo.By("CNS_TEST: Running for Vanilla setup")
332-
storageclass, pvclaim, err = createPVCAndStorageClass(ctx, client, namespace, nil, nil, "", nil, "", false, "")
332+
storageclass, pvclaim, err = createPVCAndStorageClass(ctx, client, nil, namespace, nil, nil, "", nil, "", false, "")
333333
}
334334
gomega.Expect(err).NotTo(gomega.HaveOccurred())
335335

@@ -343,7 +343,7 @@ var _ bool = ginkgo.Describe("[csi-block-vanilla] [csi-file-vanilla] "+
343343
[]*v1.PersistentVolumeClaim{pvclaim}, 2*framework.ClaimProvisionTimeout)
344344
gomega.Expect(err).NotTo(gomega.HaveOccurred())
345345
gomega.Expect(pvc).NotTo(gomega.BeEmpty())
346-
pv := getPvFromClaim(client, pvclaim.Namespace, pvclaim.Name)
346+
pv := getPvFromClaim(client, nil, pvclaim.Namespace, pvclaim.Name)
347347
volumeID := pv.Spec.CSI.VolumeHandle
348348

349349
defer func() {

0 commit comments

Comments
 (0)