Skip to content

Commit

Permalink
Copy VolumeSnapshotContent annotations in snapshottable.go test
Browse files Browse the repository at this point in the history
  • Loading branch information
mauriciopoppe committed Oct 5, 2021
1 parent 6e21f33 commit 63ed25f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions test/e2e/storage/framework/snapshot_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,13 @@ func CreateSnapshotResource(sDriver SnapshottableTestDriver, config *PerTestConf
r.Vscontent, err = dc.Resource(utils.SnapshotContentGVR).Update(context.TODO(), r.Vscontent, metav1.UpdateOptions{})
framework.ExpectNoError(err)

ginkgo.By("recording the volume handle and snapshotHandle")
ginkgo.By("recording properties of the preprovisioned snapshot")
snapshotHandle := r.Vscontent.Object["status"].(map[string]interface{})["snapshotHandle"].(string)
framework.Logf("Recording snapshot handle: %s", snapshotHandle)
framework.Logf("Recording snapshot content handle: %s", snapshotHandle)
snapshotContentAnnotations := r.Vscontent.GetAnnotations()
framework.Logf("Recording snapshot content annotations: %v", snapshotContentAnnotations)
csiDriverName := r.Vsclass.Object["driver"].(string)
framework.Logf("Recording snapshot driver: %s", csiDriverName)

// If the deletion policy is retain on vscontent:
// when vs is deleted vscontent will not be deleted
Expand Down Expand Up @@ -140,7 +143,7 @@ func CreateSnapshotResource(sDriver SnapshottableTestDriver, config *PerTestConf
snapName := getPreProvisionedSnapshotName(uuid)
snapcontentName := getPreProvisionedSnapshotContentName(uuid)

r.Vscontent = getPreProvisionedSnapshotContent(snapcontentName, snapName, pvcNamespace, snapshotHandle, pattern.SnapshotDeletionPolicy.String(), csiDriverName)
r.Vscontent = getPreProvisionedSnapshotContent(snapcontentName, snapshotContentAnnotations, snapName, pvcNamespace, snapshotHandle, pattern.SnapshotDeletionPolicy.String(), csiDriverName)
r.Vscontent, err = dc.Resource(utils.SnapshotContentGVR).Create(context.TODO(), r.Vscontent, metav1.CreateOptions{})
framework.ExpectNoError(err)

Expand Down Expand Up @@ -299,13 +302,14 @@ func getPreProvisionedSnapshot(snapName, ns, snapshotContentName string) *unstru

return snapshot
}
func getPreProvisionedSnapshotContent(snapcontentName, snapshotName, snapshotNamespace, snapshotHandle, deletionPolicy, csiDriverName string) *unstructured.Unstructured {
func getPreProvisionedSnapshotContent(snapcontentName string, snapshotContentAnnotations map[string]string, snapshotName, snapshotNamespace, snapshotHandle, deletionPolicy, csiDriverName string) *unstructured.Unstructured {
snapshotContent := &unstructured.Unstructured{
Object: map[string]interface{}{
"kind": "VolumeSnapshotContent",
"apiVersion": utils.SnapshotAPIVersion,
"metadata": map[string]interface{}{
"name": snapcontentName,
"name": snapcontentName,
"annotations": snapshotContentAnnotations,
},
"spec": map[string]interface{}{
"source": map[string]interface{}{
Expand Down

0 comments on commit 63ed25f

Please sign in to comment.