e2e: define replicapool as constant

the static check is failing as the replicapool
is used in 3 or more places, we need to define
a variable and use it.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2020-05-05 09:23:24 +05:30 committed by mergify[bot]
parent 76a55350aa
commit f0b3cee94a
3 changed files with 10 additions and 9 deletions

View File

@ -22,6 +22,7 @@ var (
rbdExamplePath = "../examples/rbd/"
rbdDeploymentName = "csi-rbdplugin-provisioner"
rbdDaemonsetName = "csi-rbdplugin"
defaultRBDPool = "replicapool"
// Topology related variables
nodeRegionLabel = "test.failure-domain/region"
regionValue = "testregion"
@ -267,7 +268,7 @@ var _ = Describe("RBD", func() {
if err != nil {
Fail(err.Error())
}
pool := "replicapool"
pool := defaultRBDPool
snapList, err := listSnapshots(f, pool, images[0])
if err != nil {
Fail(err.Error())

View File

@ -103,7 +103,7 @@ func validateRBDStaticPV(f *framework.Framework, appPath string, isBlock bool) e
fsID = strings.Trim(fsID, "\n")
size := "4Gi"
// create rbd image
cmd := fmt.Sprintf("rbd create %s --size=%d --pool=replicapool --image-feature=layering", rbdImageName, 4096)
cmd := fmt.Sprintf("rbd create %s --size=%d --pool=%s --image-feature=layering", rbdImageName, 4096, defaultRBDPool)
_, e = execCommandInPod(f, cmd, rookNamespace, &listOpt)
if e != "" {
@ -111,7 +111,7 @@ func validateRBDStaticPV(f *framework.Framework, appPath string, isBlock bool) e
}
opt["clusterID"] = fsID
opt["imageFeatures"] = "layering"
opt["pool"] = "replicapool"
opt["pool"] = defaultRBDPool
opt["staticVolume"] = "true"
pv := getStaticPV(pvName, rbdImageName, size, "csi-rbd-secret", cephCSINamespace, sc, "rbd.csi.ceph.com", isBlock, opt)
@ -155,7 +155,7 @@ func validateRBDStaticPV(f *framework.Framework, appPath string, isBlock bool) e
return err
}
cmd = fmt.Sprintf("rbd rm %s --pool=replicapool", rbdImageName)
cmd = fmt.Sprintf("rbd rm %s --pool=%s", rbdImageName, defaultRBDPool)
execCommandInPod(f, cmd, rookNamespace, &listOpt)
return nil
}

View File

@ -274,7 +274,7 @@ func createCephfsStorageClass(c kubernetes.Interface, f *framework.Framework, en
func createRBDStorageClass(c kubernetes.Interface, f *framework.Framework, scOptions, parameters map[string]string) {
scPath := fmt.Sprintf("%s/%s", rbdExamplePath, "storageclass.yaml")
sc := getStorageClass(scPath)
sc.Parameters["pool"] = "replicapool"
sc.Parameters["pool"] = defaultRBDPool
sc.Parameters["csi.storage.k8s.io/provisioner-secret-namespace"] = rookNamespace
sc.Parameters["csi.storage.k8s.io/provisioner-secret-name"] = rbdProvisionerSecretName
@ -761,7 +761,7 @@ func validateEncryptedPVCAndAppBinding(pvcPath, appPath, kms string, f *framewor
if err != nil {
Fail(err.Error())
}
rbdImageSpec := fmt.Sprintf("replicapool/%s", imageData.imageName)
rbdImageSpec := fmt.Sprintf("%s/%s", defaultRBDPool, imageData.imageName)
encryptedState, err := getImageMeta(rbdImageSpec, ".rbd.csi.ceph.com/encrypted", f)
if err != nil {
Fail(err.Error())
@ -903,7 +903,7 @@ func listRBDImages(f *framework.Framework) []string {
opt := metav1.ListOptions{
LabelSelector: "app=rook-ceph-tools",
}
stdout, stdErr := execCommandInPod(f, "rbd ls --pool=replicapool --format=json", rookNamespace, &opt)
stdout, stdErr := execCommandInPod(f, fmt.Sprintf("rbd ls --pool=%s --format=json", defaultRBDPool), rookNamespace, &opt)
Expect(stdErr).Should(BeEmpty())
var imgInfos []string
@ -973,7 +973,7 @@ func deleteBackingRBDImage(f *framework.Framework, pvc *v1.PersistentVolumeClaim
LabelSelector: "app=rook-ceph-tools",
}
cmd := fmt.Sprintf("rbd rm %s --pool=replicapool", imageData.imageName)
cmd := fmt.Sprintf("rbd rm %s --pool=%s", imageData.imageName, defaultRBDPool)
execCommandInPod(f, cmd, rookNamespace, &opt)
return nil
}
@ -1030,7 +1030,7 @@ func pvcDeleteWhenPoolNotFound(pvcPath string, cephfs bool, f *framework.Framewo
return err
}
// delete rbd pool
deletePool("replicapool", cephfs, f)
deletePool(defaultRBDPool, cephfs, f)
}
err = deletePVCAndValidatePV(f.ClientSet, pvc, deployTimeout)
return err