mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-05 04:55:22 +00:00
This commit introduces a deleteItemAction which writes a temporary configmap to record the snapshot info so that the controller can trigger repo manager to remove the snapshot This process is a bit chatty and we should consider to refactor the code so it's easier to connect to the repo directly in the DIA Signed-off-by: Daniel Jiang <jiangd@vmware.com>
71 lines
1.2 KiB
Go
71 lines
1.2 KiB
Go
package datamover
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestIsBuiltInUploader(t *testing.T) {
|
|
testcases := []struct {
|
|
name string
|
|
dataMover string
|
|
want bool
|
|
}{
|
|
{
|
|
name: "empty dataMover is builtin",
|
|
dataMover: "",
|
|
want: true,
|
|
},
|
|
{
|
|
name: "velero dataMover is builtin",
|
|
dataMover: "velero",
|
|
want: true,
|
|
},
|
|
{
|
|
name: "kopia dataMover is not builtin",
|
|
dataMover: "kopia",
|
|
want: false,
|
|
},
|
|
}
|
|
for _, tc := range testcases {
|
|
t.Run(tc.name, func(tt *testing.T) {
|
|
assert.Equal(tt, tc.want, IsBuiltInUploader(tc.dataMover))
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestGetUploaderType(t *testing.T) {
|
|
testcases := []struct {
|
|
name string
|
|
input string
|
|
want string
|
|
}{
|
|
{
|
|
name: "empty dataMover is kopia",
|
|
input: "",
|
|
want: "kopia",
|
|
},
|
|
{
|
|
name: "velero dataMover is kopia",
|
|
input: "velero",
|
|
want: "kopia",
|
|
},
|
|
{
|
|
name: "kopia dataMover is kopia",
|
|
input: "kopia",
|
|
want: "kopia",
|
|
},
|
|
{
|
|
name: "restic dataMover is restic",
|
|
input: "restic",
|
|
want: "restic",
|
|
},
|
|
}
|
|
for _, tc := range testcases {
|
|
t.Run(tc.name, func(tt *testing.T) {
|
|
assert.Equal(tt, tc.want, GetUploaderType(tc.input))
|
|
})
|
|
}
|
|
}
|