mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 11:00:25 +00:00
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:
parent
76a55350aa
commit
f0b3cee94a
@ -22,6 +22,7 @@ var (
|
|||||||
rbdExamplePath = "../examples/rbd/"
|
rbdExamplePath = "../examples/rbd/"
|
||||||
rbdDeploymentName = "csi-rbdplugin-provisioner"
|
rbdDeploymentName = "csi-rbdplugin-provisioner"
|
||||||
rbdDaemonsetName = "csi-rbdplugin"
|
rbdDaemonsetName = "csi-rbdplugin"
|
||||||
|
defaultRBDPool = "replicapool"
|
||||||
// Topology related variables
|
// Topology related variables
|
||||||
nodeRegionLabel = "test.failure-domain/region"
|
nodeRegionLabel = "test.failure-domain/region"
|
||||||
regionValue = "testregion"
|
regionValue = "testregion"
|
||||||
@ -267,7 +268,7 @@ var _ = Describe("RBD", func() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
Fail(err.Error())
|
Fail(err.Error())
|
||||||
}
|
}
|
||||||
pool := "replicapool"
|
pool := defaultRBDPool
|
||||||
snapList, err := listSnapshots(f, pool, images[0])
|
snapList, err := listSnapshots(f, pool, images[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Fail(err.Error())
|
Fail(err.Error())
|
||||||
|
@ -103,7 +103,7 @@ func validateRBDStaticPV(f *framework.Framework, appPath string, isBlock bool) e
|
|||||||
fsID = strings.Trim(fsID, "\n")
|
fsID = strings.Trim(fsID, "\n")
|
||||||
size := "4Gi"
|
size := "4Gi"
|
||||||
// create rbd image
|
// 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)
|
_, e = execCommandInPod(f, cmd, rookNamespace, &listOpt)
|
||||||
if e != "" {
|
if e != "" {
|
||||||
@ -111,7 +111,7 @@ func validateRBDStaticPV(f *framework.Framework, appPath string, isBlock bool) e
|
|||||||
}
|
}
|
||||||
opt["clusterID"] = fsID
|
opt["clusterID"] = fsID
|
||||||
opt["imageFeatures"] = "layering"
|
opt["imageFeatures"] = "layering"
|
||||||
opt["pool"] = "replicapool"
|
opt["pool"] = defaultRBDPool
|
||||||
opt["staticVolume"] = "true"
|
opt["staticVolume"] = "true"
|
||||||
|
|
||||||
pv := getStaticPV(pvName, rbdImageName, size, "csi-rbd-secret", cephCSINamespace, sc, "rbd.csi.ceph.com", isBlock, opt)
|
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
|
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)
|
execCommandInPod(f, cmd, rookNamespace, &listOpt)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
10
e2e/utils.go
10
e2e/utils.go
@ -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) {
|
func createRBDStorageClass(c kubernetes.Interface, f *framework.Framework, scOptions, parameters map[string]string) {
|
||||||
scPath := fmt.Sprintf("%s/%s", rbdExamplePath, "storageclass.yaml")
|
scPath := fmt.Sprintf("%s/%s", rbdExamplePath, "storageclass.yaml")
|
||||||
sc := getStorageClass(scPath)
|
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-namespace"] = rookNamespace
|
||||||
sc.Parameters["csi.storage.k8s.io/provisioner-secret-name"] = rbdProvisionerSecretName
|
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 {
|
if err != nil {
|
||||||
Fail(err.Error())
|
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)
|
encryptedState, err := getImageMeta(rbdImageSpec, ".rbd.csi.ceph.com/encrypted", f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Fail(err.Error())
|
Fail(err.Error())
|
||||||
@ -903,7 +903,7 @@ func listRBDImages(f *framework.Framework) []string {
|
|||||||
opt := metav1.ListOptions{
|
opt := metav1.ListOptions{
|
||||||
LabelSelector: "app=rook-ceph-tools",
|
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())
|
Expect(stdErr).Should(BeEmpty())
|
||||||
var imgInfos []string
|
var imgInfos []string
|
||||||
|
|
||||||
@ -973,7 +973,7 @@ func deleteBackingRBDImage(f *framework.Framework, pvc *v1.PersistentVolumeClaim
|
|||||||
LabelSelector: "app=rook-ceph-tools",
|
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)
|
execCommandInPod(f, cmd, rookNamespace, &opt)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -1030,7 +1030,7 @@ func pvcDeleteWhenPoolNotFound(pvcPath string, cephfs bool, f *framework.Framewo
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// delete rbd pool
|
// delete rbd pool
|
||||||
deletePool("replicapool", cephfs, f)
|
deletePool(defaultRBDPool, cephfs, f)
|
||||||
}
|
}
|
||||||
err = deletePVCAndValidatePV(f.ClientSet, pvc, deployTimeout)
|
err = deletePVCAndValidatePV(f.ClientSet, pvc, deployTimeout)
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user