Skip to content

Commit a434875

Browse files
e2e: changes for e2e parallel
Signed-off-by: Praveen M <m.praveen@ibm.com>
1 parent b22ca60 commit a434875

5 files changed

Lines changed: 87 additions & 100 deletions

File tree

e2e/cephfs.go

Lines changed: 19 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2734,43 +2734,24 @@ var _ = Describe(cephfsType, func() {
27342734

27352735
// Make sure this should be last testcase in
27362736
// this file, because it deletes pool
2737-
It("Create a PVC and delete PVC when backend pool deleted", func() {
2738-
// FIXME: in case NFS testing is done, prevent deletion
2739-
// of the CephFS filesystem and related pool. This can
2740-
// probably be addressed in a nicer way, making sure
2741-
// everything is tested, always.
2742-
if testNFS {
2743-
framework.Logf("skipping CephFS destructive tests, allow NFS to run")
2744-
2745-
return
2746-
}
2747-
err := pvcDeleteWhenPoolNotFound(pvcPath, true, f)
2748-
if err != nil {
2749-
logAndFail("failed to delete PVC: %v", err)
2750-
}
2751-
})
2752-
2753-
It("delete ceph users", func() {
2754-
// FIXME: in case NFS testing is done, prevent deletion
2755-
// of the CephFS filesystem and related pool. This can
2756-
// probably be addressed in a nicer way, making sure
2757-
// everything is tested, always.
2758-
if testNFS {
2759-
framework.Logf("skipping CephFS destructive tests, allow NFS to run")
2760-
2761-
return
2762-
}
2763-
2764-
// delete cephFS provisioner secret
2765-
err := deleteCephUser(f, keyringCephFSProvisionerUsername)
2766-
if err != nil {
2767-
logAndFail("failed to delete user %s: %v", keyringCephFSProvisionerUsername, err)
2768-
}
2769-
// delete cephFS plugin secret
2770-
err = deleteCephUser(f, keyringCephFSNodePluginUsername)
2771-
if err != nil {
2772-
logAndFail("failed to delete user %s: %v", keyringCephFSNodePluginUsername, err)
2773-
}
2774-
})
2737+
// It("Create a PVC and delete PVC when backend pool deleted", func() {
2738+
// err := pvcDeleteWhenPoolNotFound(pvcPath, true, f)
2739+
// if err != nil {
2740+
// logAndFail("failed to delete PVC: %v", err)
2741+
// }
2742+
// })
2743+
2744+
// It("delete ceph users", func() {
2745+
// // delete cephFS provisioner secret
2746+
// err := deleteCephUser(f, keyringCephFSProvisionerUsername)
2747+
// if err != nil {
2748+
// logAndFail("failed to delete user %s: %v", keyringCephFSProvisionerUsername, err)
2749+
// }
2750+
// // delete cephFS plugin secret
2751+
// err = deleteCephUser(f, keyringCephFSNodePluginUsername)
2752+
// if err != nil {
2753+
// logAndFail("failed to delete user %s: %v", keyringCephFSNodePluginUsername, err)
2754+
// }
2755+
// })
27752756
})
27762757
})

e2e/deploy-vault.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,11 @@ func createORDeleteVault(action kubectlAction) {
7272
}
7373

7474
data = strings.ReplaceAll(data, "vault.default", "vault."+cephCSINamespace)
75-
7675
data = strings.ReplaceAll(data, "value: default", "value: "+cephCSINamespace)
76+
// Match SA name to the namespace-unique name created in the RBAC template.
77+
data = strings.ReplaceAll(data,
78+
"rbd-csi-vault-token-review",
79+
"rbd-csi-vault-token-review-"+cephCSINamespace)
7780
err = retryKubectlInput(cephCSINamespace, action, data, deployTimeout)
7881
if err != nil {
7982
logAndFail("failed to %s vault statefulset %v", action, err)
@@ -83,6 +86,11 @@ func createORDeleteVault(action kubectlAction) {
8386
if err != nil {
8487
logAndFail("failed to read content from %s %v", vaultExamplePath+vaultRBACPath, err)
8588
}
89+
// Make cluster-scoped resource names unique per namespace to avoid
90+
// conflicts when multiple driver tests run in parallel.
91+
data = strings.ReplaceAll(data,
92+
"rbd-csi-vault-token-review",
93+
"rbd-csi-vault-token-review-"+cephCSINamespace)
8694
err = retryKubectlInput(cephCSINamespace, action, data, deployTimeout)
8795
if err != nil {
8896
logAndFail("failed to %s vault statefulset %v", action, err)
@@ -145,6 +153,10 @@ func createORDeleteTenantServiceAccount(action kubectlAction, ns string) error {
145153

146154
// replace "default" in the URL to the Vault service
147155
data = strings.ReplaceAll(data, "vault.default", "vault."+cephCSINamespace)
156+
// Match SA name to the namespace-unique name created in the RBAC template.
157+
data = strings.ReplaceAll(data,
158+
"rbd-csi-vault-token-review",
159+
"rbd-csi-vault-token-review-"+cephCSINamespace)
148160

149161
err = retryKubectlInput(cephCSINamespace, action, data, deployTimeout)
150162
if err != nil {

e2e/e2e_test.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,20 +92,14 @@ func handleFlags() {
9292
testing.Init()
9393
flag.Parse()
9494

95-
// testNFS will automatically be enabled when testCephFS is enabled,
96-
// this makes sure the NFS tests run in the CI where there are
97-
// different jobs for CephFS and RBD. With a dedicated testNFS
98-
// variable, it is still possible to only run the NFS tests, when both
99-
// CephFS and RBD are disabled.
100-
if testCephFS {
101-
testNFS = testCephFS
102-
deployNFS = deployCephFS
103-
}
104-
10595
if testNVMeoF {
10696
deployNVMeoF = true
10797
}
10898

99+
if testNFS {
100+
deployNFS = true
101+
}
102+
109103
if operatorDeployment {
110104
cephCSINamespace = "ceph-csi-operator-system"
111105
}

e2e/nfs.go

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ var (
5050
nfsExamplePath = examplePath + "nfs/"
5151
nfsPoolName = ".nfs"
5252

53-
// FIXME: some tests change the subvolumegroup to "e2e".
5453
defaultSubvolumegroup = "csi"
54+
nfsSubvolumegroup = defaultSubvolumegroup
55+
nfsMetadataPool = ""
5556

5657
helmNFSPodsLabel = "ceph-csi-nfs"
5758

@@ -380,8 +381,7 @@ var _ = Describe("nfs", func() {
380381
deployNFSPlugin()
381382
}
382383

383-
// cephfs testing might have changed the default subvolumegroup
384-
subvolumegroup = defaultSubvolumegroup
384+
subvolumegroup = nfsSubvolumegroup
385385
err := createConfigMap(nfsDirPath, f.ClientSet, f)
386386
if err != nil {
387387
logAndFail("failed to create configmap: %v", err)
@@ -405,11 +405,11 @@ var _ = Describe("nfs", func() {
405405
logAndFail("failed to create node secret: %v", err)
406406
}
407407

408-
err = createSubvolumegroup(f, fileSystemName, subvolumegroup)
408+
err = createSubvolumegroup(f, fileSystemName, nfsSubvolumegroup)
409409
if err != nil {
410-
logAndFail("failed to create subvolumegroup %s: %v", subvolumegroup, err)
410+
logAndFail("failed to create subvolumegroup %s: %v", nfsSubvolumegroup, err)
411411
}
412-
metadataPool, err = getCephFSMetadataPoolName(f, fileSystemName)
412+
nfsMetadataPool, err = getCephFSMetadataPoolName(f, fileSystemName)
413413
if err != nil {
414414
logAndFail("failed getting cephFS metadata pool name: %v", err)
415415
}
@@ -451,9 +451,9 @@ var _ = Describe("nfs", func() {
451451
if err != nil {
452452
logAndFail("failed to delete storageclass: %v", err)
453453
}
454-
err = deleteSubvolumegroup(f, fileSystemName, subvolumegroup)
454+
err = deleteSubvolumegroup(f, fileSystemName, nfsSubvolumegroup)
455455
if err != nil {
456-
logAndFail("failed to delete subvolumegroup %s: %v", subvolumegroup, err)
456+
logAndFail("failed to delete subvolumegroup %s: %v", nfsSubvolumegroup, err)
457457
}
458458

459459
if deployNFS {
@@ -766,7 +766,7 @@ var _ = Describe("nfs", func() {
766766
}
767767
// validate no subvolumes remain
768768
validateSubvolumeCount(f, 0, fileSystemName, defaultSubvolumegroup)
769-
validateOmapCount(f, 0, cephfsType, metadataPool, volumesType)
769+
validateOmapCount(f, 0, cephfsType, nfsMetadataPool, volumesType)
770770
})
771771

772772
It("Mount pvc as readonly in pod", func() {
@@ -928,7 +928,7 @@ var _ = Describe("nfs", func() {
928928
name := fmt.Sprintf("%s-%d", uniqueName, n)
929929
wgErrs[n] = createPVCAndApp(name, f, &p, &a, deployTimeout)
930930
if wgErrs[n] == nil {
931-
err = validateSubvolumePath(f, p.Name, p.Namespace, fileSystemName, subvolumegroup)
931+
err = validateSubvolumePath(f, p.Name, p.Namespace, fileSystemName, nfsSubvolumegroup)
932932
if err != nil {
933933
wgErrs[n] = err
934934
}
@@ -971,9 +971,9 @@ var _ = Describe("nfs", func() {
971971
logAndFail("calculating checksum failed, %d errors were logged", failed)
972972
}
973973

974-
validateSubvolumeCount(f, totalSubvolumes, fileSystemName, subvolumegroup)
975-
validateOmapCount(f, totalSubvolumes, cephfsType, metadataPool, volumesType)
976-
validateOmapCount(f, totalCount, cephfsType, metadataPool, snapsType)
974+
validateSubvolumeCount(f, totalSubvolumes, fileSystemName, nfsSubvolumegroup)
975+
validateOmapCount(f, totalSubvolumes, cephfsType, nfsMetadataPool, volumesType)
976+
validateOmapCount(f, totalCount, cephfsType, nfsMetadataPool, snapsType)
977977

978978
wg.Add(totalCount)
979979
// delete clone and app
@@ -999,9 +999,9 @@ var _ = Describe("nfs", func() {
999999
}
10001000

10011001
parentPVCCount := totalSubvolumes - totalCount
1002-
validateSubvolumeCount(f, parentPVCCount, fileSystemName, subvolumegroup)
1003-
validateOmapCount(f, parentPVCCount, cephfsType, metadataPool, volumesType)
1004-
validateOmapCount(f, totalCount, cephfsType, metadataPool, snapsType)
1002+
validateSubvolumeCount(f, parentPVCCount, fileSystemName, nfsSubvolumegroup)
1003+
validateOmapCount(f, parentPVCCount, cephfsType, nfsMetadataPool, volumesType)
1004+
validateOmapCount(f, totalCount, cephfsType, nfsMetadataPool, snapsType)
10051005
// create clones from different snapshots and bind it to an app
10061006
wg.Add(totalCount)
10071007
for i := range totalCount {
@@ -1010,7 +1010,7 @@ var _ = Describe("nfs", func() {
10101010
p.Spec.DataSource.Name = name
10111011
wgErrs[n] = createPVCAndApp(name, f, &p, &a, deployTimeout)
10121012
if wgErrs[n] == nil {
1013-
err = validateSubvolumePath(f, p.Name, p.Namespace, fileSystemName, subvolumegroup)
1013+
err = validateSubvolumePath(f, p.Name, p.Namespace, fileSystemName, nfsSubvolumegroup)
10141014
if err != nil {
10151015
wgErrs[n] = err
10161016
}
@@ -1053,9 +1053,9 @@ var _ = Describe("nfs", func() {
10531053
logAndFail("calculating checksum failed, %d errors were logged", failed)
10541054
}
10551055

1056-
validateSubvolumeCount(f, totalSubvolumes, fileSystemName, subvolumegroup)
1057-
validateOmapCount(f, totalSubvolumes, cephfsType, metadataPool, volumesType)
1058-
validateOmapCount(f, totalCount, cephfsType, metadataPool, snapsType)
1056+
validateSubvolumeCount(f, totalSubvolumes, fileSystemName, nfsSubvolumegroup)
1057+
validateOmapCount(f, totalSubvolumes, cephfsType, nfsMetadataPool, volumesType)
1058+
validateOmapCount(f, totalCount, cephfsType, nfsMetadataPool, snapsType)
10591059

10601060
wg.Add(totalCount)
10611061
// delete snapshot
@@ -1104,18 +1104,18 @@ var _ = Describe("nfs", func() {
11041104
logAndFail("deleting PVCs and apps failed, %d errors were logged", failed)
11051105
}
11061106

1107-
validateSubvolumeCount(f, parentPVCCount, fileSystemName, subvolumegroup)
1108-
validateOmapCount(f, parentPVCCount, cephfsType, metadataPool, volumesType)
1109-
validateOmapCount(f, 0, cephfsType, metadataPool, snapsType)
1107+
validateSubvolumeCount(f, parentPVCCount, fileSystemName, nfsSubvolumegroup)
1108+
validateOmapCount(f, parentPVCCount, cephfsType, nfsMetadataPool, volumesType)
1109+
validateOmapCount(f, 0, cephfsType, nfsMetadataPool, snapsType)
11101110
// delete parent pvc
11111111
err = deletePVCAndValidatePV(f.ClientSet, pvc, deployTimeout)
11121112
if err != nil {
11131113
logAndFail("failed to delete PVC or application: %v", err)
11141114
}
11151115

1116-
validateSubvolumeCount(f, 0, fileSystemName, subvolumegroup)
1117-
validateOmapCount(f, 0, cephfsType, metadataPool, volumesType)
1118-
validateOmapCount(f, 0, cephfsType, metadataPool, snapsType)
1116+
validateSubvolumeCount(f, 0, fileSystemName, nfsSubvolumegroup)
1117+
validateOmapCount(f, 0, cephfsType, nfsMetadataPool, volumesType)
1118+
validateOmapCount(f, 0, cephfsType, nfsMetadataPool, snapsType)
11191119
})
11201120

11211121
It("create a PVC-PVC clone and bind it to an app", func() {
@@ -1213,8 +1213,8 @@ var _ = Describe("nfs", func() {
12131213
logAndFail("calculating checksum failed, %d errors were logged", failed)
12141214
}
12151215

1216-
validateSubvolumeCount(f, totalSubvolumes, fileSystemName, subvolumegroup)
1217-
validateOmapCount(f, totalSubvolumes, cephfsType, metadataPool, volumesType)
1216+
validateSubvolumeCount(f, totalSubvolumes, fileSystemName, nfsSubvolumegroup)
1217+
validateOmapCount(f, totalSubvolumes, cephfsType, nfsMetadataPool, volumesType)
12181218

12191219
// delete parent pvc
12201220
err = deletePVCAndValidatePV(f.ClientSet, pvc, deployTimeout)
@@ -1245,8 +1245,8 @@ var _ = Describe("nfs", func() {
12451245
logAndFail("deleting PVCs and apps failed, %d errors were logged", failed)
12461246
}
12471247

1248-
validateSubvolumeCount(f, 0, fileSystemName, subvolumegroup)
1249-
validateOmapCount(f, 0, cephfsType, metadataPool, volumesType)
1248+
validateSubvolumeCount(f, 0, fileSystemName, nfsSubvolumegroup)
1249+
validateOmapCount(f, 0, cephfsType, nfsMetadataPool, volumesType)
12501250
})
12511251

12521252
It("delete NFS provisioner and plugin secret", func() {

e2e/rbd.go

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7163,26 +7163,26 @@ var _ = Describe("RBD", func() {
71637163
}
71647164
})
71657165

7166-
It("delete ceph users", func() {
7167-
// delete RBD provisioner secret
7168-
err := deleteCephUser(f, keyringRBDProvisionerUsername)
7169-
if err != nil {
7170-
logAndFail("failed to delete user %s: %v", keyringRBDProvisionerUsername, err)
7171-
}
7172-
// delete RBD plugin secret
7173-
err = deleteCephUser(f, keyringRBDNodePluginUsername)
7174-
if err != nil {
7175-
logAndFail("failed to delete user %s: %v", keyringRBDNodePluginUsername, err)
7176-
}
7177-
})
7178-
7179-
// Make sure this should be last testcase in this file, because
7180-
// it deletes pool
7181-
It("Create a PVC and delete PVC when backend pool deleted", func() {
7182-
err := pvcDeleteWhenPoolNotFound(pvcPath, false, f)
7183-
if err != nil {
7184-
logAndFail("failed to delete PVC when pool not found: %v", err)
7185-
}
7186-
})
7166+
// It("delete ceph users", func() {
7167+
// // delete RBD provisioner secret
7168+
// err := deleteCephUser(f, keyringRBDProvisionerUsername)
7169+
// if err != nil {
7170+
// logAndFail("failed to delete user %s: %v", keyringRBDProvisionerUsername, err)
7171+
// }
7172+
// // delete RBD plugin secret
7173+
// err = deleteCephUser(f, keyringRBDNodePluginUsername)
7174+
// if err != nil {
7175+
// logAndFail("failed to delete user %s: %v", keyringRBDNodePluginUsername, err)
7176+
// }
7177+
// })
7178+
7179+
// // Make sure this should be last testcase in this file, because
7180+
// // it deletes pool
7181+
// It("Create a PVC and delete PVC when backend pool deleted", func() {
7182+
// err := pvcDeleteWhenPoolNotFound(pvcPath, false, f)
7183+
// if err != nil {
7184+
// logAndFail("failed to delete PVC when pool not found: %v", err)
7185+
// }
7186+
// })
71877187
})
71887188
})

0 commit comments

Comments
 (0)