e2e: add prefixname to rbd controller test

Signed-off-by: Rakshith R <rar@redhat.com>
(cherry picked from commit 0744ad502b)
This commit is contained in:
Rakshith R 2021-07-16 18:46:36 +05:30 committed by mergify[bot]
parent a797b7e200
commit 33899663e1
2 changed files with 18 additions and 7 deletions

View File

@ -2354,17 +2354,23 @@ var _ = Describe("RBD", func() {
By("validate the functionality of controller", func() {
err := deleteResource(rbdExamplePath + "storageclass.yaml")
if err != nil {
e2elog.Failf("failed to delete storageclass with error %v", err)
e2elog.Failf("failed to delete storageclass : %v", err)
}
err = validateController(f, pvcPath, appPath, rbdExamplePath+"storageclass.yaml")
scParams := map[string]string{
"volumeNamePrefix": "test-",
}
err = validateController(f,
pvcPath, appPath, rbdExamplePath+"storageclass.yaml",
nil,
scParams)
if err != nil {
e2elog.Failf("failed to validate controller with error %v", err)
e2elog.Failf("failed to validate controller : %v", err)
}
// validate created backend rbd images
validateRBDImageCount(f, 0, defaultRBDPool)
err = createRBDStorageClass(f.ClientSet, f, defaultSCName, nil, nil, deletePolicy)
if err != nil {
e2elog.Failf("failed to create storageclass with error %v", err)
e2elog.Failf("failed to create storageclass : %v", err)
}
})

View File

@ -1045,13 +1045,17 @@ func validatePVCSnapshot(
// Mount the PVC to application (NodeStage/NodePublish should work)
// Resize the PVC
// Delete the Application and PVC.
func validateController(f *framework.Framework, pvcPath, appPath, scPath string) error {
func validateController(
f *framework.Framework,
pvcPath, appPath, scPath string,
scOptions, scParams map[string]string) error {
size := "1Gi"
poolName := defaultRBDPool
expandSize := "10Gi"
var err error
// create storageclass with retain
err = createRBDStorageClass(f.ClientSet, f, defaultSCName, nil, nil, retainPolicy)
err = createRBDStorageClass(f.ClientSet, f, defaultSCName, scOptions, scParams,
retainPolicy)
if err != nil {
return fmt.Errorf("failed to create storageclass: %w", err)
}
@ -1083,7 +1087,8 @@ func validateController(f *framework.Framework, pvcPath, appPath, scPath string)
if err != nil {
return fmt.Errorf("failed to delete storageclass: %w", err)
}
err = createRBDStorageClass(f.ClientSet, f, defaultSCName, nil, nil, deletePolicy)
err = createRBDStorageClass(f.ClientSet, f, defaultSCName, scOptions, scParams,
deletePolicy)
if err != nil {
return fmt.Errorf("failed to create storageclass: %w", err)
}