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 support for standalone snapshot creation and cloning support #693

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 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
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
---
# need for docker build
sudo: true
dist: xenial
dist: bionic
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, this is already done? Does the branch need a rebase on master?


addons:
apt:
packages:
- realpath
- ruby
services:
- docker
Expand Down
110 changes: 60 additions & 50 deletions e2e/rbd.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,31 @@ var _ = Describe("RBD", func() {
deleteConfigMap(rbdDirPath)
deleteResource(rbdExamplePath + "secret.yaml")
deleteResource(rbdExamplePath + "storageclass.yaml")
<<<<<<< HEAD
Copy link
Member

Choose a reason for hiding this comment

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

defintely not correct.

Please explain in the commit message why the revert is needed. No need to mention that it is a revert in the subject, just point to the commit in the message.

// deleteResource(rbdExamplePath + "snapshotclass.yaml")
deleteVault()
=======
deleteResource(rbdExamplePath + "snapshotclass.yaml")
>>>>>>> parent of 90fef919d... Skip snapshot testing in CI
})

Context("Test RBD CSI", func() {
It("Test RBD CSI", func() {
pvcPath := rbdExamplePath + "pvc.yaml"
appPath := rbdExamplePath + "pod.yaml"
<<<<<<< HEAD
rawPvcPath := rbdExamplePath + "raw-block-pvc.yaml"
rawAppPath := rbdExamplePath + "raw-block-pod.yaml"
// pvcClonePath := rbdExamplePath + "pvc-restore.yaml"
// appClonePath := rbdExamplePath + "pod-restore.yaml"
// snapshotPath := rbdExamplePath + "snapshot.yaml"
=======
// rawPvcPath := rbdExamplePath + "raw-block-pvc.yaml"
// rawAppPath := rbdExamplePath + "raw-block-pod.yaml"
pvcClonePath := rbdExamplePath + "pvc-restore.yaml"
appClonePath := rbdExamplePath + "pod-restore.yaml"
snapshotPath := rbdExamplePath + "snapshot.yaml"
>>>>>>> parent of 90fef919d... Skip snapshot testing in CI

By("checking provisioner deployment is running")
var err error
Expand Down Expand Up @@ -154,56 +166,54 @@ var _ = Describe("RBD", func() {
createRBDStorageClass(f.ClientSet, f, make(map[string]string))
})

// skipping snapshot testing

// By("create a PVC clone and Bind it to an app", func() {
// createRBDSnapshotClass(f)
// pvc, err := loadPVC(pvcPath)
// if err != nil {
// Fail(err.Error())
// }

// pvc.Namespace = f.UniqueName
// e2elog.Logf("The PVC template %+v", pvc)
// err = createPVCAndvalidatePV(f.ClientSet, pvc, deployTimeout)
// if err != nil {
// Fail(err.Error())
// }
// // validate created backend rbd images
// images := listRBDImages(f)
// if len(images) != 1 {
// e2elog.Logf("backend image count %d expected image count %d", len(images), 1)
// Fail("validate backend image failed")
// }
// snap := getSnapshot(snapshotPath)
// snap.Namespace = f.UniqueName
// snap.Spec.Source.Name = pvc.Name
// snap.Spec.Source.Kind = "PersistentVolumeClaim"
// err = createSnapshot(&snap, deployTimeout)
// if err != nil {
// Fail(err.Error())
// }
// pool := "replicapool"
// snapList, err := listSnapshots(f, pool, images[0])
// if err != nil {
// Fail(err.Error())
// }
// if len(snapList) != 1 {
// e2elog.Logf("backend snapshot not matching kube snap count,snap count = % kube snap count %d", len(snapList), 1)
// Fail("validate backend snapshot failed")
// }

// validatePVCAndAppBinding(pvcClonePath, appClonePath, f)

// err = deleteSnapshot(&snap, deployTimeout)
// if err != nil {
// Fail(err.Error())
// }
// err = deletePVCAndValidatePV(f.ClientSet, pvc, deployTimeout)
// if err != nil {
// Fail(err.Error())
// }
// })
By("create a PVC clone and Bind it to an app", func() {
createRBDSnapshotClass(f)
pvc, err := loadPVC(pvcPath)
if err != nil {
Fail(err.Error())
}

pvc.Namespace = f.UniqueName
e2elog.Logf("The PVC template %+v", pvc)
err = createPVCAndvalidatePV(f.ClientSet, pvc, deployTimeout)
if err != nil {
Fail(err.Error())
}
// validate created backend rbd images
images := listRBDImages(f)
if len(images) != 1 {
e2elog.Logf("backend image count %d expected image count %d", len(images), 1)
Fail("validate backend image failed")
}
snap := getSnapshot(snapshotPath)
snap.Namespace = f.UniqueName
snap.Spec.Source.Name = pvc.Name
snap.Spec.Source.Kind = "PersistentVolumeClaim"
err = createSnapshot(&snap, deployTimeout)
if err != nil {
Fail(err.Error())
}
pool := "replicapool"
snapList, err := listSnapshots(f, pool, images[0])
if err != nil {
Fail(err.Error())
}
if len(snapList) != 1 {
e2elog.Logf("backend snapshot not matching kube snap count,snap count = % kube snap count %d", len(snapList), 1)
Fail("validate backend snapshot failed")
}

validatePVCAndAppBinding(pvcClonePath, appClonePath, f)

err = deleteSnapshot(&snap, deployTimeout)
if err != nil {
Fail(err.Error())
}
err = deletePVCAndValidatePV(f.ClientSet, pvc, deployTimeout)
if err != nil {
Fail(err.Error())
}
})

By("create a block type PVC and Bind it to an app", func() {
validatePVCAndAppBinding(rawPvcPath, rawAppPath, f)
Expand Down
Loading