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

Add E2E tests for rbd snapshot #431

merged 5 commits into from
Jun 23, 2019

Conversation

Madhu-1
Copy link
Collaborator

@Madhu-1 Madhu-1 commented Jun 14, 2019

This PR adds the E2E test cases for

  • create/delete snapshot class
  • create/delete of snapshot
  • cloning a pvc from a snapshot and bind it to an app
  • create/delete block PVC
  • create/delete app which uses block PVC

@Madhu-1
Copy link
Collaborator Author

Madhu-1 commented Jun 14, 2019

dependent on #429 and #427

CI will pass once we merge above mentioned PR

@Madhu-1
Copy link
Collaborator Author

Madhu-1 commented Jun 18, 2019

@humblec @ShyamsundarR @poornimag PTAL

@Madhu-1 Madhu-1 force-pushed the snap-e2e branch 3 times, most recently from 78f6228 to 25d7651 Compare June 18, 2019 08:40
@Madhu-1
Copy link
Collaborator Author

Madhu-1 commented Jun 18, 2019

CI passed locally

Jun 18 14:33:24.492: INFO: pod-with-raw-block-volume app  is  in Pending phase expected to be in Running  state (78 seconds elapsed)
Jun 18 14:33:26.495: INFO: pod-with-raw-block-volume app  is  in Pending phase expected to be in Running  state (80 seconds elapsed)
Jun 18 14:33:28.479: INFO: pod-with-raw-block-volume app  is  in Pending phase expected to be in Running  state (82 seconds elapsed)
Jun 18 14:33:30.482: INFO: pod-with-raw-block-volume app  is  in Pending phase expected to be in Running  state (84 seconds elapsed)
Jun 18 14:33:32.476: INFO: pod-with-raw-block-volume app  is  in Pending phase expected to be in Running  state (86 seconds elapsed)
Jun 18 14:33:34.481: INFO: pod-with-raw-block-volume app  is  in Pending phase expected to be in Running  state (88 seconds elapsed)
Jun 18 14:33:36.475: INFO: pod-with-raw-block-volume app  is  in Pending phase expected to be in Running  state (90 seconds elapsed)
Jun 18 14:33:38.483: INFO: pod-with-raw-block-volume app  is  in Pending phase expected to be in Running  state (92 seconds elapsed)
Jun 18 14:33:40.475: INFO: pod-with-raw-block-volume app  is  in Pending phase expected to be in Running  state (94 seconds elapsed)
Jun 18 14:33:42.485: INFO: pod-with-raw-block-volume app  is  in Pending phase expected to be in Running  state (96 seconds elapsed)
Jun 18 14:33:44.510: INFO: Waiting for pod pod-with-raw-block-volume to be deleted
Jun 18 14:33:44.576: INFO: pod-with-raw-block-volume app  to be deleted (0 seconds elapsed)
Jun 18 14:33:46.600: INFO: pod-with-raw-block-volume app  to be deleted (2 seconds elapsed)
Jun 18 14:33:48.579: INFO: pod-with-raw-block-volume app  to be deleted (4 seconds elapsed)
Jun 18 14:33:50.586: INFO: pod-with-raw-block-volume app  to be deleted (6 seconds elapsed)
Jun 18 14:33:52.592: INFO: pod-with-raw-block-volume app  to be deleted (8 seconds elapsed)
Jun 18 14:33:54.590: INFO: pod-with-raw-block-volume app  to be deleted (10 seconds elapsed)
Jun 18 14:33:56.598: INFO: pod-with-raw-block-volume app  to be deleted (12 seconds elapsed)
Jun 18 14:33:58.579: INFO: pod-with-raw-block-volume app  to be deleted (14 seconds elapsed)
Jun 18 14:34:00.579: INFO: pod-with-raw-block-volume app  to be deleted (16 seconds elapsed)
Jun 18 14:34:02.578: INFO: pod-with-raw-block-volume app  to be deleted (18 seconds elapsed)
Jun 18 14:34:04.604: INFO: pod-with-raw-block-volume app  to be deleted (20 seconds elapsed)
Jun 18 14:34:06.598: INFO: pod-with-raw-block-volume app  to be deleted (22 seconds elapsed)
Jun 18 14:34:08.581: INFO: pod-with-raw-block-volume app  to be deleted (24 seconds elapsed)
Jun 18 14:34:11.056: INFO: pod-with-raw-block-volume app  to be deleted (26 seconds elapsed)
Jun 18 14:34:12.595: INFO: pod-with-raw-block-volume app  to be deleted (28 seconds elapsed)
Jun 18 14:34:14.581: INFO: pod-with-raw-block-volume app  to be deleted (30 seconds elapsed)
Jun 18 14:34:16.597: INFO: pod-with-raw-block-volume app  to be deleted (32 seconds elapsed)
Jun 18 14:34:18.594: INFO: pod-with-raw-block-volume app  to be deleted (34 seconds elapsed)
Jun 18 14:34:20.608: INFO: pod-with-raw-block-volume app  to be deleted (36 seconds elapsed)
Jun 18 14:34:22.596: INFO: Deleting PersistentVolumeClaim raw-block-pvc on namespace rbd-6104
Jun 18 14:34:22.668: INFO: waiting for PVC raw-block-pvc in state &PersistentVolumeClaimStatus{Phase:Bound,AccessModes:[ReadWriteOnce],Capacity:ResourceList{storage: {{1073741824 0} {<nil>} 1Gi BinarySI},},Conditions:[],}  to be deleted (0 seconds elapsed)
Jun 18 14:34:24.685: INFO: waiting for PVC raw-block-pvc in state &PersistentVolumeClaimStatus{Phase:Bound,AccessModes:[ReadWriteOnce],Capacity:ResourceList{storage: {{1073741824 0} {<nil>} 1Gi BinarySI},},Conditions:[],}  to be deleted (2 seconds elapsed)
Jun 18 14:34:26.685: INFO: waiting for PVC raw-block-pvc in state &PersistentVolumeClaimStatus{Phase:,AccessModes:[],Capacity:ResourceList{},Conditions:[],}  to be deleted (4 seconds elapsed)
STEP: create/delete multiple PVC and App
Jun 18 14:34:26.755: INFO: Waiting up to &PersistentVolumeClaim{ObjectMeta:k8s_io_apimachinery_pkg_apis_meta_v1.ObjectMeta{Name:rbd-61040,GenerateName:,Namespace:rbd-6104,SelfLink:,UID:,ResourceVersion:,Generation:0,CreationTimestamp:0001-01-01 00:00:00 +0000 UTC,DeletionTimestamp:<nil>,DeletionGracePeriodSeconds:nil,Labels:map[string]string{},Annotations:map[string]string{},OwnerReferences:[],Finalizers:[],ClusterName:,Initializers:nil,ManagedFields:[],},Spec:PersistentVolumeClaimSpec{AccessModes:[ReadWriteOnce],Resources:ResourceRequirements{Limits:ResourceList{},Requests:ResourceList{storage: {{1073741824 0} {<nil>} 1Gi BinarySI},},},VolumeName:,Selector:nil,StorageClassName:*csi-rbd-sc,VolumeMode:*Block,DataSource:nil,},Status:PersistentVolumeClaimStatus{Phase:,AccessModes:[],Capacity:ResourceList{},Conditions:[],},} to be in Bound state

i will check why its failing in travis (may to due to rawblock mode of PVC)

@Madhu-1 Madhu-1 force-pushed the snap-e2e branch 2 times, most recently from 6cedde5 to 11b9919 Compare June 18, 2019 11:04
@humblec
Copy link
Collaborator

humblec commented Jun 18, 2019

i will check why its failing in travis (may to due to rawblock mode of PVC)

@Madhu-1 yep, please cross check

@Madhu-1
Copy link
Collaborator Author

Madhu-1 commented Jun 19, 2019

@humblec I will be skipping the block mode e2e now ( need some more debugging)
PTAL (taking this PR in will run E2E for snapshot and cloning)

Madhu-1 added 3 commits June 19, 2019 12:24
Adding extenal-provisoner will help us to
test snapshot functionality

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
tls.VersionTLS13 requires 1.12.x

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
e2e/cephfs.go Outdated
validateNormalUserPVCAccess(pvcPath, f)
})

By("create/delete multiple PVC and App", func() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

PVCs

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

validateNormalUserPVCAccess(pvcPath, f)
})

By("create/delete multiple PVC and App", 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

e2e/rbd.go Outdated
if err != nil {
Fail(err.Error())
}
snapList, err := listSnapshots(f, "replicapool", images[0])
Copy link
Collaborator

Choose a reason for hiding this comment

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

The pool name can be variable for later use.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

e2e/rbd.go Outdated
// validatePVCAndAppBinding(rawPvcPath, rawAppPath, f)
// })

By("create/delete multiple PVC and App", func() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@Madhu-1 what about making this function of creation more generic in util ? so that cephfs and rbd can just call that instead of repeating it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the functionality includes 3 different validation

  • PVC create and bind it to app
  • validate backend rbd images (doesnot apply for cephfs)
  • delete app and PVC
    IMO combining both create and delete operation is not a good option

apierrs "k8s.io/apimachinery/pkg/api/errors"

"github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
snapClient "github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/typed/volumesnapshot/v1alpha1"
Copy link
Collaborator

Choose a reason for hiding this comment

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

@Madhu-1 somehow I feel that we are not using the correct package import above. Is this the correct reference for the client?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Madhu-1 added 2 commits June 19, 2019 18:40
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
@Madhu-1
Copy link
Collaborator Author

Madhu-1 commented Jun 19, 2019

@humblec @ShyamsundarR @poornimag PTAL

@Madhu-1
Copy link
Collaborator Author

Madhu-1 commented Jun 21, 2019

@humblec @ShyamsundarR @poornimag can you guys review this, I would like to take this patch in to catch some earlier bugs in the code.

@humblec
Copy link
Collaborator

humblec commented Jun 21, 2019

@Madhu-1 did you plan to squash the commits ? or would like to keep 5 ? The patch looks good to me.

@Madhu-1
Copy link
Collaborator Author

Madhu-1 commented Jun 21, 2019

@humblec each commit is independent I would like to keep it as it is.

@Madhu-1
Copy link
Collaborator Author

Madhu-1 commented Jun 21, 2019

I would like to revert back c8d120f commit once I figure out why block mode is failing in Travis (this will be in follow up PR)

@humblec
Copy link
Collaborator

humblec commented Jun 22, 2019

@ShyamsundarR @poornimag PTAL.

Copy link
Contributor

@ShyamsundarR ShyamsundarR left a comment

Choose a reason for hiding this comment

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

Other than the Source.Name and Source.Kind comment here this is good to go.

Marking this as approved, as the above, if possible, can be corrected subsequently.

}
snap := getSnapshot(snapshotPath)
snap.Namespace = f.UniqueName
snap.Spec.Source.Name = pvc.Name
Copy link
Contributor

Choose a reason for hiding this comment

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

Source.Name and Source.Kind should already be what we need? IOW, the examples are interlinked and should not need to specialize these fields. Looks like extra code for the moment, and will not catch deviation of the Name and Kind if changed in a commit in the examples (between pvc and snapshot).

framework.Logf("backend image count %d expected image count %d", len(images), 1)
Fail("validate backend image failed")
}
snap := getSnapshot(snapshotPath)
Copy link
Contributor

Choose a reason for hiding this comment

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

(nit) This should be loadSnapshot like loadPVC et. al.

@@ -68,15 +81,113 @@ var _ = Describe("RBD", func() {
}

By("create a PVC and Bind it to an app", func() {
Copy link
Contributor

Choose a reason for hiding this comment

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

The narrative here creates the PVC twice once for normal PVC testing and once for the snapshot testing (and later a different one for 2 PVC/App create test). A shorter but similar end result narrative for the tests would be to use the PVC created in the step here for the snapshot test, and later create an additional one for the 2 PVC test.

Something to consider in the future if the CI time is longer, would be to create the above narrative to be more efficient in testing the flow.

NOTE: As per my understanding Ginkgo runs the BeforeEach and AfterEach for each It block and not each By block, if it is the latter then the above narrative is not feasible.

@mergify mergify bot merged commit b3b181f into ceph:master Jun 23, 2019
Nikhil-Ladha pushed a commit to Nikhil-Ladha/ceph-csi that referenced this pull request Dec 13, 2024
Syncing latest changes from upstream devel for ceph-csi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants