mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-09 16:00:22 +00:00
Fix issues in E2E cleanup
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
0063727199
commit
4ed187eb3f
@ -36,6 +36,25 @@ func deployCephfsPlugin() {
|
||||
framework.RunKubectlOrDie("apply", "-f", cephfsDirPath+cephfsNodePluginRBAC)
|
||||
}
|
||||
|
||||
func deleteCephfsPlugin() {
|
||||
_, err := framework.RunKubectl("delete", "-f", cephfsDirPath+cephfsProvisioner)
|
||||
if err != nil {
|
||||
e2elog.Logf("failed to delete cephfs provisioner %v", err)
|
||||
}
|
||||
_, err = framework.RunKubectl("delete", "-f", cephfsDirPath+cephfsProvisionerRBAC)
|
||||
if err != nil {
|
||||
e2elog.Logf("failed to delete cephfs provisioner rbac %v", err)
|
||||
}
|
||||
_, err = framework.RunKubectl("delete", "-f", cephfsDirPath+cephfsNodePlugin)
|
||||
if err != nil {
|
||||
e2elog.Logf("failed to delete cephfs nodeplugin %v", err)
|
||||
}
|
||||
_, err = framework.RunKubectl("delete", "-f", cephfsDirPath+cephfsNodePluginRBAC)
|
||||
if err != nil {
|
||||
e2elog.Logf("failed to delete cephfs nodeplugin rbac %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
var _ = Describe("cephfs", func() {
|
||||
f := framework.NewDefaultFramework("cephfs")
|
||||
// deploy cephfs CSI
|
||||
@ -48,13 +67,8 @@ var _ = Describe("cephfs", func() {
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
cephfsFiles := getFilesinDirectory(cephfsDirPath)
|
||||
for _, file := range cephfsFiles {
|
||||
res, err := framework.RunKubectl("delete", "-f", cephfsDirPath+file.Name())
|
||||
if err != nil {
|
||||
e2elog.Logf("failed to delete resource in %s with err %v", res, err)
|
||||
}
|
||||
}
|
||||
deleteCephfsPlugin()
|
||||
deleteConfiMap(cephfsDirPath)
|
||||
deleteResource(cephfsExamplePath + "secret.yaml")
|
||||
deleteResource(cephfsExamplePath + "storageclass.yaml")
|
||||
deleteFileSystem()
|
||||
|
28
e2e/rbd.go
28
e2e/rbd.go
@ -38,6 +38,25 @@ func deployRBDPlugin() {
|
||||
framework.RunKubectlOrDie("apply", "-f", rbdDirPath+rbdNodePluginRBAC)
|
||||
}
|
||||
|
||||
func deleteRBDPlugin() {
|
||||
_, err := framework.RunKubectl("delete", "-f", rbdDirPath+rbdProvisioner)
|
||||
if err != nil {
|
||||
e2elog.Logf("failed to delete rbd provisioner %v", err)
|
||||
}
|
||||
_, err = framework.RunKubectl("delete", "-f", rbdDirPath+rbdProvisionerRBAC)
|
||||
if err != nil {
|
||||
e2elog.Logf("failed to delete provisioner rbac %v", err)
|
||||
}
|
||||
_, err = framework.RunKubectl("delete", "-f", rbdDirPath+rbdNodePlugin)
|
||||
if err != nil {
|
||||
e2elog.Logf("failed to delete nodeplugin %v", err)
|
||||
}
|
||||
_, err = framework.RunKubectl("delete", "-f", rbdDirPath+rbdNodePluginRBAC)
|
||||
if err != nil {
|
||||
e2elog.Logf("failed to delete nodeplugin rbac %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
var _ = Describe("RBD", func() {
|
||||
f := framework.NewDefaultFramework("rbd")
|
||||
// deploy RBD CSI
|
||||
@ -52,13 +71,8 @@ var _ = Describe("RBD", func() {
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
rbdFiles := getFilesinDirectory(rbdDirPath)
|
||||
for _, file := range rbdFiles {
|
||||
res, err := framework.RunKubectl("delete", "-f", rbdDirPath+file.Name())
|
||||
if err != nil {
|
||||
e2elog.Logf("failed to delete resource in %s with err %v", res, err)
|
||||
}
|
||||
}
|
||||
deleteRBDPlugin()
|
||||
deleteConfiMap(rbdDirPath)
|
||||
deleteRBDPool()
|
||||
deleteResource(rbdExamplePath + "secret.yaml")
|
||||
deleteResource(rbdExamplePath + "storageclass.yaml")
|
||||
|
17
e2e/utils.go
17
e2e/utils.go
@ -5,7 +5,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@ -30,14 +29,6 @@ import (
|
||||
testutils "k8s.io/kubernetes/test/utils"
|
||||
)
|
||||
|
||||
func getFilesinDirectory(path string) []os.FileInfo {
|
||||
files, err := ioutil.ReadDir(path)
|
||||
if err != nil {
|
||||
framework.ExpectNoError(err)
|
||||
}
|
||||
return files
|
||||
}
|
||||
|
||||
var poll = 2 * time.Second
|
||||
|
||||
type snapInfo struct {
|
||||
@ -263,6 +254,14 @@ func createRBDSnapshotClass(f *framework.Framework) {
|
||||
Expect(err).Should(BeNil())
|
||||
}
|
||||
|
||||
func deleteConfiMap(pluginPath string) {
|
||||
path := pluginPath + configMap
|
||||
_, err := framework.RunKubectl("delete", "-f", path)
|
||||
if err != nil {
|
||||
e2elog.Logf("failed to delete configmap %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func createConfigMap(pluginPath string, c kubernetes.Interface, f *framework.Framework) {
|
||||
path := pluginPath + configMap
|
||||
cm := v1.ConfigMap{}
|
||||
|
Loading…
Reference in New Issue
Block a user