Change:
_, err := cs.CoreV1().PersistentVolumes().Get(context.TODO(), pvc.Spec.VolumeName, metav1.GetOptions{}) framework.ExpectNoError(err) <del> // Get new copy of the snapshot ginkgo.By("checking the snapshot") vs, err = dc.Resource(storageutils.SnapshotGVR).Namespace(vs.GetNamespace()).Get(context.TODO(), vs.GetName(), metav1.GetOptions{}) framework.ExpectNoError(err) // Get the bound snapshotContent snapshotStatus := vs.Object["status"].(map[string]interface{}) snapshotContentName := snapshotStatus["boundVolumeSnapshotContentName"].(string) vscontent, err := dc.Resource(storageutils.SnapshotContentGVR).Get(context.TODO(), snapshotContentName, metav1.GetOptions{}) framework.ExpectNoError(err) snapshotContentSpec := vscontent.Object["spec"].(map[string]interface{}) volumeSnapshotRef := snapshotContentSpec["volumeSnapshotRef"].(map[string]interface{}) </del> <ins> vs := sr.Vs // get the snapshot and check SnapshotContent properties vscontent := checkSnapshot(dc, sr, pattern) </ins> var restoredPVC *v1.PersistentVolumeClaim var restoredPod *v1.Pod <del> // Check SnapshotContent properties ginkgo.By("checking the SnapshotContent") // PreprovisionedCreatedSnapshot do not need to set volume snapshot class name if pattern.SnapshotType != storageframework.PreprovisionedCreatedSnapshot { framework.ExpectEqual(snapshotContentSpec["volumeSnapshotClassName"], vsc.GetName()) } framework.ExpectEqual(volumeSnapshotRef["name"], vs.GetName()) framework.ExpectEqual(volumeSnapshotRef["namespace"], vs.GetNamespace()) </del> ginkgo.By("creating a pvc from the snapshot") restoredPVC = e2epv.MakePersistentVolumeClaim(e2epv.PersistentVolumeClaimConfig{ ClaimSize:        claimSize,

Discussion:
The changes to support snapshot tests for Generic Ephemeral Volumes generated some duplicated code in the file as commented here: , it'd be great to create functions that are reused in both and tests. Things that are needed: A kubernetes dev cluster (I follow to create a GCE cluster) Knowledge about how to /sig storage /area testing /good-first-issue Improve readability of the storage VolumeSnapshot tests
This request has been marked as suitable for new contributors. Please ensure that the issue body includes answers to the following questions: Why are we solving this issue? To address this issue, are there any code changes? If there are code changes, what needs to be done in the code and what places can the assignee treat as reference points? Does this issue have zero to low barrier of entry? How can the assignee reach out to you for help? For more details on the requirements of such an issue, please see and ensure that they are met. If this request no longer meets these requirements, the label can be removed by commenting with the command. <detailsIn response to : ### What would you like to be ? /area testing /good-first-issue Instructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
The label(s) cannot be applied, because the repository doesn't have them. <detailsIn response to : ### What would you like to be ? /area testing /good-first-issue Instructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the label and provide further guidance. The label can be by org members by writing in a comment. <detailsInstructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
/assign
Hi Could you please give me some more details about what needs to be done in this issue?
I modified the description, it's all about making changes in a single file creating functions that reduce the duplicated code following the thread also linked in the description.
Thanks!

Hi, I'm currently in the process of working on this issue. I'm adding the functions to the file.
is this issue solved because now I am unable to see the duplication which I saw day before yesterday.
Hi When I try to run the snapshottable tests using and I get 8 of the following failures: I have setup and as their documentation suggested, but seem to not be able to run the tests. Do you have an idea why this happens? Thanks!
what was the command that you used? The csi-hostpath driver is embedded into the kubernetes codebase so you don't need to add anything else to your kind? cluster.
The command I used to run the snapshottable tests in a local kind cluster is: . Does that seem OK?
do you have an idea about why this happens? Thanks!
hey sorry for the late response and thanks for the reminder, I always run my tests with and with a GCE cluster (not a kind cluster) for example following . The VolumeSnapshot feature requires a CSI Driver, in our e2e tests we use a CSI Driver that's embedded in the kubernetes codebase called csi-hostpath, from the logs I saw that it used csi-hostpath which I think it's ok, ideally we should test it with a real CSI Driver like PD CSI Driver but that's going to provision storage in GCP. Have you tried with ? I think that there's more info in that page about kubetest than kubetest2
Yes, I tried , but got the same errors as well. Do you think it's maybe a problem with ?
/assign
/assign
hey and you guys have solved this issues or still working on it, because i'm considering to solve this issue if you haven't solved it
/assign
thank you for signing up for this task, I believe should work, we're waiting for additional review