-
Notifications
You must be signed in to change notification settings - Fork 813
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 import snapshot e2e tests #674
Conversation
Hi @AndyXiangLi. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Pull Request Test Coverage Report for Build 1415
💛 - Coveralls |
Unknown CLA label state. Rechecking for CLA labels. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job! A couple comments. Also can you add how you tested these changes? Did you run them?
/ok-to-test
tests/e2e/pre_provsioning.go
Outdated
@@ -38,7 +39,8 @@ const ( | |||
|
|||
awsAvailabilityZonesEnv = "AWS_AVAILABILITY_ZONES" | |||
|
|||
dummyVolumeName = "pre-provisioned" | |||
dummyVolumeName = "pre-provisioned" | |||
dummySnapshotName = "pre-provisioned snapshot" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pre-provisioned-snapshot
defer tvsc.DeleteVolumeSnapshotContent(tvolumeSnapshotContent) | ||
defer tvsc.DeleteSnapshot(tvs) | ||
|
||
t.Pod.Volumes[0].DataSource = &DataSource{Name: tvs.Name} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should check add a check and fail early here: if len(t.Pod.Volumes) < 1
binding := storagev1.VolumeBindingWaitForFirstConsumer | ||
t.Pod.Volumes[0].VolumeBindingMode = &binding | ||
tPod := NewTestPod(client, namespace, t.Pod.Cmd) | ||
volume := t.Pod.Volumes[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can move this above line 50 and use it throughout.
By("deploying a second pod with a volume restored from the snapshot") | ||
tPod.Create() | ||
defer tPod.Cleanup() | ||
By("checking that the pods command exits with no error") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How are we verifying that we restored the correct snapshot(ie data)?
tests/e2e/testsuites/testsuites.go
Outdated
func (t *TestVolumeSnapshotClass) DeleteVolumeSnapshotContent(vsc *v1beta1.VolumeSnapshotContent) { | ||
By("deleting a VolumeSnapshotContent " + vsc.Name) | ||
err := snapshotclientset.New(t.client).SnapshotV1beta1().VolumeSnapshotContents().Delete(vsc.Name, &metav1.DeleteOptions{}) | ||
//framework.ExpectNoError(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete or uncomment please :)
tests/e2e/testsuites/testsuites.go
Outdated
@@ -334,7 +423,7 @@ func (t *TestPersistentVolumeClaim) Cleanup() { | |||
// attempts may fail, as the volume is still attached to a node because | |||
// kubelet is slowly cleaning up the previous pod, however it should succeed | |||
// in a couple of minutes. | |||
if t.persistentVolume.Spec.PersistentVolumeReclaimPolicy == v1.PersistentVolumeReclaimDelete { | |||
if t.persistentVolume != nil && t.persistentVolume.Spec.PersistentVolumeReclaimPolicy == v1.PersistentVolumeReclaimDelete { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm curious, did you get a panic because of the missing check here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, PV is nil in this case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I hope we're not hiding a "should not happen" case here. I'll take another look later. Should be fine for now.
@@ -0,0 +1,16 @@ | |||
apiVersion: v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also update the aws-ebs-csi-driver/examples/kubernetes/snapshot/README
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, as the import snapshot is a different test case, should I put them in one README or separate it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we had different use cases on that README. Up to you.
@@ -8,6 +8,7 @@ spec: | |||
name: static-snapshot-demo | |||
namespace: default | |||
source: | |||
snapshotHandle: snap-0fba4d7649d765c50 | |||
snapshotHandle: snap-0644009a49add11ac |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not necessary, It is just for my testing.. I will change it back, good catch
tests/e2e/pre_provsioning.go
Outdated
@@ -17,6 +17,7 @@ package e2e | |||
import ( | |||
"context" | |||
"fmt" | |||
restclientset "k8s.io/client-go/rest" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd use a more descriptive name. Maybe k8srestclient
?
v1 "k8s.io/api/core/v1" | ||
storagev1 "k8s.io/api/storage/v1" | ||
clientset "k8s.io/client-go/kubernetes" | ||
restclientset "k8s.io/client-go/rest" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simiarly here too :)
04bb6ff
to
ea88ab9
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: AndyXiangLi The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Is this a bug fix or adding new feature?
Adding e2e test for import snapshot scenario
What is this PR about? / Why do we need it?
What testing is done?
#317