mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-23 21:40:20 +00:00
fc529f4831
deploys rook deploy cephfs plugin deploy rbd plugin create PVC/POD to test cephfs create PVC/POD to test rbd Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
80 lines
2.1 KiB
Go
80 lines
2.1 KiB
Go
package e2e
|
|
|
|
import (
|
|
"time"
|
|
|
|
. "github.com/onsi/ginkgo" // nolint
|
|
|
|
"k8s.io/kubernetes/test/e2e/framework"
|
|
)
|
|
|
|
var (
|
|
rbdProvisioner = "csi-rbdplugin-provisioner.yaml"
|
|
rbdProvisionerRBAC = "csi-provisioner-rbac.yaml"
|
|
rbdNodePlugin = "csi-rbdplugin.yaml"
|
|
rbdNodePluginRBAC = "csi-nodeplugin-rbac.yaml"
|
|
rbdConfigMap = "csi-config-map.yaml"
|
|
)
|
|
|
|
var (
|
|
rbdDirPath = "../deploy/rbd/kubernetes/"
|
|
|
|
rbdExamplePath = "../examples/rbd/"
|
|
)
|
|
|
|
func deployRBDPlugin() {
|
|
// deploy provisioner
|
|
framework.RunKubectlOrDie("create", "-f", rbdDirPath+rbdProvisioner)
|
|
framework.RunKubectlOrDie("apply", "-f", rbdDirPath+rbdProvisionerRBAC)
|
|
//deploy nodeplugin
|
|
framework.RunKubectlOrDie("create", "-f", rbdDirPath+rbdNodePlugin)
|
|
framework.RunKubectlOrDie("apply", "-f", rbdDirPath+rbdNodePluginRBAC)
|
|
}
|
|
|
|
var _ = Describe("RBD", func() {
|
|
f := framework.NewDefaultFramework("rbd")
|
|
//deploy RBD CSI
|
|
BeforeEach(func() {
|
|
createRBDPool()
|
|
createRBDConfigMap(f.ClientSet, f)
|
|
deployRBDPlugin()
|
|
createRBDStorageClass(f.ClientSet, f)
|
|
createRBDSecret(f.ClientSet, f)
|
|
})
|
|
|
|
AfterEach(func() {
|
|
rbdFiles := getFilesinDirectory(rbdDirPath)
|
|
for _, file := range rbdFiles {
|
|
res, err := framework.RunKubectl("delete", "-f", rbdDirPath+file.Name())
|
|
framework.Logf("failed to delete resource in %s with err %v", res, err)
|
|
}
|
|
deleteRBDPool()
|
|
deleteSecret(rbdExamplePath + "secret.yaml")
|
|
deleteStorageClass(rbdExamplePath + "storageclass.yaml")
|
|
})
|
|
|
|
Context("Test RBD CSI", func() {
|
|
It("Test RBD CSI", func() {
|
|
By("checking provisioner statefulset is running")
|
|
timeout := time.Duration(deployTimeout) * time.Minute
|
|
err := framework.WaitForStatefulSetReplicasReady("csi-rbdplugin-provisioner", "default", f.ClientSet, 1*time.Second, timeout)
|
|
if err != nil {
|
|
Fail(err.Error())
|
|
}
|
|
|
|
By("checking nodeplugin deamonsets is running")
|
|
err = waitForDaemonSets("csi-rbdplugin", "default", f.ClientSet, deployTimeout)
|
|
if err != nil {
|
|
Fail(err.Error())
|
|
}
|
|
|
|
By("create a PVC and Bind it to an app", func() {
|
|
pvcPath := rbdExamplePath + "pvc.yaml"
|
|
appPath := rbdExamplePath + "pod.yaml"
|
|
validatePVCAndAppBinding(pvcPath, appPath, f)
|
|
})
|
|
})
|
|
})
|
|
|
|
})
|