mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-07-31 12:32:44 +00:00
Remove CSI VolumeSnapshot listter and the informer. Add download the VolumeInfos metadata for backup. Signed-off-by: Xun Jiang <jxun@vmware.com>
56 lines
1.4 KiB
Go
56 lines
1.4 KiB
Go
package backup
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestSummary(t *testing.T) {
|
|
tracker := NewSkipPVTracker()
|
|
tracker.Track("pv5", "", "skipped due to policy")
|
|
tracker.Track("pv3", podVolumeApproach, "it's set to opt-out")
|
|
tracker.Track("pv3", csiSnapshotApproach, "not applicable for CSI ")
|
|
// shouldn't be added
|
|
tracker.Track("", podVolumeApproach, "pvc3 is set to be skipped")
|
|
tracker.Track("pv10", volumeSnapshotApproach, "added by mistake")
|
|
tracker.Untrack("pv10")
|
|
expected := []SkippedPV{
|
|
{
|
|
Name: "pv3",
|
|
Reasons: []PVSkipReason{
|
|
{
|
|
Approach: csiSnapshotApproach,
|
|
Reason: "not applicable for CSI ",
|
|
},
|
|
{
|
|
Approach: podVolumeApproach,
|
|
Reason: "it's set to opt-out",
|
|
},
|
|
},
|
|
},
|
|
{
|
|
Name: "pv5",
|
|
Reasons: []PVSkipReason{
|
|
{
|
|
Approach: anyApproach,
|
|
Reason: "skipped due to policy",
|
|
},
|
|
},
|
|
},
|
|
}
|
|
assert.Equal(t, expected, tracker.Summary())
|
|
}
|
|
|
|
func TestSerializeSkipReasons(t *testing.T) {
|
|
tracker := NewSkipPVTracker()
|
|
//tracker.Track("pv5", "", "skipped due to policy")
|
|
tracker.Track("pv3", podVolumeApproach, "it's set to opt-out")
|
|
tracker.Track("pv3", csiSnapshotApproach, "not applicable for CSI ")
|
|
|
|
for _, skippedPV := range tracker.Summary() {
|
|
require.Equal(t, "csiSnapshot: not applicable for CSI ;podvolume: it's set to opt-out;", skippedPV.SerializeSkipReasons())
|
|
}
|
|
}
|