Skip to content

Commit

Permalink
Remove snapshot class from prepv test because it is not needed.
Browse files Browse the repository at this point in the history
Prepv snapshots only need to specify driver.
  • Loading branch information
Andi Li authored and jingxu97 committed Feb 19, 2021
1 parent f867a8f commit 74425b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 3 additions & 4 deletions test/e2e/storage/testsuites/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ func getPreProvisionedSnapshot(snapshotContentName, ns, snapshotHandle string) *

return snapshot
}
func getPreProvisionedSnapshotContent(snapshotName, snapshotNamespace, snapshotHandle, deletionPolicy, csiDriverName, volumeSnapshotClassName string) *unstructured.Unstructured {
func getPreProvisionedSnapshotContent(snapshotName, snapshotNamespace, snapshotHandle, deletionPolicy, csiDriverName string) *unstructured.Unstructured {
snapshotContent := &unstructured.Unstructured{
Object: map[string]interface{}{
"kind": "VolumeSnapshotContent",
Expand All @@ -608,9 +608,8 @@ func getPreProvisionedSnapshotContent(snapshotName, snapshotNamespace, snapshotH
"name": snapshotName,
"namespace": snapshotNamespace,
},
"driver": csiDriverName,
"deletionPolicy": deletionPolicy,
"volumeSnapshotClassName": volumeSnapshotClassName,
"driver": csiDriverName,
"deletionPolicy": deletionPolicy,
},
},
}
Expand Down
7 changes: 5 additions & 2 deletions test/e2e/storage/testsuites/snapshottable.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,10 @@ func (s *snapshottableTestSuite) DefineTests(driver TestDriver, pattern testpatt

// Check SnapshotContent properties
ginkgo.By("checking the SnapshotContent")
framework.ExpectEqual(snapshotContentSpec["volumeSnapshotClassName"], vsc.GetName())
// PreprovisionedCreatedSnapshot do not need to set volume snapshot class name
if pattern.SnapshotType != testpatterns.PreprovisionedCreatedSnapshot {
framework.ExpectEqual(snapshotContentSpec["volumeSnapshotClassName"], vsc.GetName())
}
framework.ExpectEqual(volumeSnapshotRef["name"], vs.GetName())
framework.ExpectEqual(volumeSnapshotRef["namespace"], vs.GetNamespace())

Expand Down Expand Up @@ -451,7 +454,7 @@ func CreateSnapshotResource(sDriver SnapshottableTestDriver, config *PerTestConf
framework.ExpectNoError(err)

ginkgo.By("creating a snapshot content with the snapshot handle")
r.Vscontent = getPreProvisionedSnapshotContent(getPreProvisionedSnapshotName(snapshotHandle), pvcNamespace, snapshotHandle, pattern.SnapshotDeletionPolicy.String(), csiDriverName, r.Vsclass.GetName())
r.Vscontent = getPreProvisionedSnapshotContent(getPreProvisionedSnapshotName(snapshotHandle), pvcNamespace, snapshotHandle, pattern.SnapshotDeletionPolicy.String(), csiDriverName)
r.Vscontent, err = dc.Resource(SnapshotContentGVR).Create(context.TODO(), r.Vscontent, metav1.CreateOptions{})
framework.ExpectNoError(err)

Expand Down

0 comments on commit 74425b8

Please sign in to comment.