Skip to content

Commit

Permalink
Expose VSC SourceVolumeMode
Browse files Browse the repository at this point in the history
Add changelog and unittest

Signed-off-by: Michael Fruchtman <[email protected]>
  • Loading branch information
msfrucht committed Oct 3, 2024
1 parent 42de654 commit e988745
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelogs/unreleased/8261-msfrucht
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Expose VSC SourceVolumeMode
1 change: 1 addition & 0 deletions pkg/exposer/csi_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ func (e *csiSnapshotExposer) createBackupVSC(ctx context.Context, ownerObject co
DeletionPolicy: snapshotv1api.VolumeSnapshotContentDelete,
Driver: snapshotVSC.Spec.Driver,
VolumeSnapshotClassName: snapshotVSC.Spec.VolumeSnapshotClassName,
SourceVolumeMode: snapshotVSC.Spec.SourceVolumeMode,
},
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/exposer/csi_snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ func TestExpose(t *testing.T) {
}

snapshotHandle := "fake-handle"
sourceVolumeMode := corev1.PersistentVolumeFilesystem
vscObj := &snapshotv1api.VolumeSnapshotContent{
ObjectMeta: metav1.ObjectMeta{
Name: vscName,
Expand All @@ -121,6 +122,7 @@ func TestExpose(t *testing.T) {
DeletionPolicy: snapshotv1api.VolumeSnapshotContentDelete,
Driver: "fake-driver",
VolumeSnapshotClassName: &snapshotClass,
SourceVolumeMode: &sourceVolumeMode,
},
Status: &snapshotv1api.VolumeSnapshotContentStatus{
RestoreSize: &restoreSize,
Expand Down Expand Up @@ -522,6 +524,7 @@ func TestExpose(t *testing.T) {
assert.Equal(t, expectedVSC.Spec.DeletionPolicy, vscObj.Spec.DeletionPolicy)
assert.Equal(t, expectedVSC.Spec.Driver, vscObj.Spec.Driver)
assert.Equal(t, *expectedVSC.Spec.VolumeSnapshotClassName, *vscObj.Spec.VolumeSnapshotClassName)
assert.Equal(t, *expectedVSC.Spec.SourceVolumeMode, *vscObj.Spec.SourceVolumeMode)

if test.expectedVolumeSize != nil {
assert.Equal(t, *test.expectedVolumeSize, backupPVC.Spec.Resources.Requests[corev1.ResourceStorage])
Expand Down

0 comments on commit e988745

Please sign in to comment.