Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add E2E tests for rbd snapshot #431

Merged
merged 5 commits into from
Jun 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ branches:
- csi-v0.3
- master

go: 1.11.x
go: 1.12.x

env:
global:
Expand Down
76 changes: 45 additions & 31 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
name = "google.golang.org/grpc"
version = "1.10.0"

[[constraint]]
[[override]]
version = "kubernetes-1.14.2"
name = "k8s.io/apimachinery"

Expand All @@ -39,10 +39,14 @@
name = "github.com/golang/protobuf"
version = "1.1.0"

[[constraint]]
[[override]]
name = "k8s.io/client-go"
version = "kubernetes-1.14.2"

[[override]]
name = "github.com/kubernetes-csi/external-snapshotter"
version = "v1.1.0"

[[override]]
name = "k8s.io/apiextensions-apiserver"
version = "kubernetes-1.14.2"
Expand All @@ -55,3 +59,8 @@
go-tests = true
non-go = true
unused-packages = true

# Prevent dep from pruning
[[prune.project]]
name = "github.com/kubernetes-csi/external-snapshotter"
non-go = false
51 changes: 45 additions & 6 deletions e2e/cephfs.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package e2e

import (
"fmt"
"time"

. "github.com/onsi/ginkgo" // nolint
Expand Down Expand Up @@ -43,15 +44,19 @@ var _ = Describe("cephfs", func() {
cephfsFiles := getFilesinDirectory(cephfsDirPath)
for _, file := range cephfsFiles {
res, err := framework.RunKubectl("delete", "-f", cephfsDirPath+file.Name())
framework.Logf("failed to delete resource in %s with err %v", res, err)
if err != nil {
framework.Logf("failed to delete resource in %s with err %v", res, err)
}
}
deleteSecret(cephfsExamplePath + "secret.yaml")
deleteStorageClass(cephfsExamplePath + "storageclass.yaml")
deleteResource(cephfsExamplePath + "secret.yaml")
deleteResource(cephfsExamplePath + "storageclass.yaml")
deleteFileSystem()
})

Context("Test cephfs CSI", func() {
It("Test cephfs CSI", func() {
pvcPath := cephfsExamplePath + "pvc.yaml"
appPath := cephfsExamplePath + "pod.yaml"
By("checking provisioner statefulset is running")
timeout := time.Duration(deployTimeout) * time.Minute
err := framework.WaitForStatefulSetReplicasReady(cephfsDeploymentName, namespace, f.ClientSet, 1*time.Second, timeout)
Expand All @@ -67,17 +72,51 @@ var _ = Describe("cephfs", func() {

By("create and delete a PVC", func() {
By("create a PVC and Bind it to an app", func() {
pvcPath := cephfsExamplePath + "pvc.yaml"
appPath := cephfsExamplePath + "pod.yaml"
validatePVCAndAppBinding(pvcPath, appPath, f)

})

By("create a PVC and Bind it to an app with normal user", func() {
pvcPath := cephfsExamplePath + "pvc.yaml"
validateNormalUserPVCAccess(pvcPath, f)
})

By("create/delete multiple PVCs and Apps", func() {
totalCount := 2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may be make it as a variable at global level.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to limit the scope of value within this context, if required maybe we can have different variable bound to a particular context to create a different number of PVC's

pvc, err := loadPVC(pvcPath)
if err != nil {
Fail(err.Error())
}
pvc.Namespace = f.UniqueName

app, err := loadApp(appPath)
if err != nil {
Fail(err.Error())
}
app.Namespace = f.UniqueName
// create pvc and app
for i := 0; i < totalCount; i++ {
name := fmt.Sprintf("%s%d", f.UniqueName, i)
err := createPVCAndApp(name, f, pvc, app)
if err != nil {
Fail(err.Error())
}

}
// TODO add cephfs backend validation

// delete pvc and app
for i := 0; i < totalCount; i++ {
name := fmt.Sprintf("%s%d", f.UniqueName, i)
err := deletePVCAndApp(name, f, pvc, app)
if err != nil {
Fail(err.Error())
}

}
})

})

})
})

Expand Down
Loading