Skip to content

Commit

Permalink
CSI clone and Cloning from snapshot source functional tests
Browse files Browse the repository at this point in the history
Signed-off-by: Ido Aharon <iaharon@redhat.com>
  • Loading branch information
ido106 committed Mar 2, 2023
1 parent 3f19b15 commit a6f59bf
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/cloner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,20 @@ var _ = Describe("all clone tests", func() {
DescribeTable("[test_id:1355]Should clone data across different namespaces", func(targetSize string) {
pvcDef := utils.NewPVCDefinition(sourcePVCName, "1Gi", nil, nil)
pvcDef.Namespace = f.Namespace.Name

pvcDef.Labels = map[string]string{"test-label-1": "test-label-key-1"}
pvcDef.Annotations = map[string]string{"test-annotation-1": "test-annotation-key-1"}

sourcePvc = f.CreateAndPopulateSourcePVC(pvcDef, sourcePodFillerName, fillCommand+testFile+"; chmod 660 "+testBaseDir+testFile)
targetNs, err := f.CreateNamespace(f.NsPrefix, map[string]string{
framework.NsPrefixLabel: f.NsPrefix,
})
Expect(err).NotTo(HaveOccurred())

// All labels and annotations passed
Expect(sourcePvc.Labels["test-label-1"]).To(Equal("test-label-key-1"))
Expect(sourcePvc.Annotations["test-annotation-1"]).To(Equal("test-annotation-key-1"))

f.AddNamespaceToDelete(targetNs)
doFileBasedCloneTest(f, pvcDef, targetNs, "target-dv", targetSize)
},
Expand Down Expand Up @@ -2610,6 +2619,14 @@ var _ = Describe("all clone tests", func() {
size := "1Gi"
createSnapshot(size, nil, volumeMode)

dataVolume := utils.NewDataVolumeForCloningFromSnapshot("pass-all-labels-and-annotations-test", size, snapshot.Namespace, snapshot.Name, nil, &volumeMode)
dataVolume.Labels = map[string]string{"test-label-1": "test-label-value-1"}
dataVolume.Annotations = map[string]string{"test-annotation-1": "test-annotation-value-1"}
dataVolume, err = utils.CreateDataVolumeFromDefinition(f.CdiClient, targetNs.Name, dataVolume)
// All labels and annotations passed
Expect(dataVolume.Labels["test-label-1"]).To(Equal("test-label-value-1"))
Expect(dataVolume.Annotations["test-annotation-1"]).To(Equal("test-annotation-value-1"))

for i = 0; i < repeat; i++ {
dataVolume := utils.NewDataVolumeForCloningFromSnapshot(fmt.Sprintf("clone-from-snap-%d", i), size, snapshot.Namespace, snapshot.Name, nil, &volumeMode)
By(fmt.Sprintf("Create new datavolume %s which will clone from volumesnapshot", dataVolume.Name))
Expand Down

0 comments on commit a6f59bf

Please sign in to comment.