Add UT for pkg/cmd/cli/backup (#6400)

Signed-off-by: danfengl <danfengl@vmware.com>
This commit is contained in:
danfengliu
2023-06-21 11:10:13 +08:00
committed by GitHub
parent 6f3adcf728
commit ef443fece0
33 changed files with 2984 additions and 32 deletions
+7
View File
@@ -24,6 +24,8 @@ import (
"testing"
"time"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"k8s.io/apimachinery/pkg/api/equality"
@@ -118,3 +120,8 @@ func AssertErrorMatches(t *testing.T, expected string, actual error) bool {
return assert.NoError(t, actual)
}
func CompareSlice(x, y []string) bool {
less := func(a, b string) bool { return a < b }
return cmp.Diff(x, y, cmpopts.SortSlices(less)) == ""
}