mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-09 01:26:30 +00:00
Remove dependency of the legacy client code from pkg/cmd directory.
Signed-off-by: Xun Jiang <jxun@vmware.com>
This commit is contained in:
@@ -26,14 +26,11 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/mock"
|
||||
|
||||
"sigs.k8s.io/controller-runtime/pkg/client/fake"
|
||||
|
||||
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
|
||||
factorymocks "github.com/vmware-tanzu/velero/pkg/client/mocks"
|
||||
"github.com/vmware-tanzu/velero/pkg/cmd/cli"
|
||||
cmdtest "github.com/vmware-tanzu/velero/pkg/cmd/test"
|
||||
versionedmocks "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/mocks"
|
||||
"github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/scheme"
|
||||
velerotest "github.com/vmware-tanzu/velero/pkg/test"
|
||||
veleroexec "github.com/vmware-tanzu/velero/pkg/util/exec"
|
||||
)
|
||||
|
||||
@@ -41,9 +38,7 @@ func TestNewDeleteCommand(t *testing.T) {
|
||||
|
||||
// create a factory
|
||||
f := &factorymocks.Factory{}
|
||||
client := &versionedmocks.Interface{}
|
||||
kbclient := fake.NewClientBuilder().WithScheme(scheme.Scheme).Build()
|
||||
f.On("Client").Return(client, nil)
|
||||
kbclient := velerotest.NewFakeControllerRuntimeClient(t)
|
||||
f.On("Namespace").Return(mock.Anything)
|
||||
f.On("KubebuilderClient").Return(kbclient, nil)
|
||||
|
||||
@@ -86,9 +81,7 @@ func TestDeleteFunctions(t *testing.T) {
|
||||
//t.Run("create the other create command with fromSchedule option for Run() other branches", func(t *testing.T) {
|
||||
// create a factory
|
||||
f := &factorymocks.Factory{}
|
||||
client := &versionedmocks.Interface{}
|
||||
kbclient := fake.NewClientBuilder().WithScheme(scheme.Scheme).Build()
|
||||
f.On("Client").Return(client, nil)
|
||||
kbclient := velerotest.NewFakeControllerRuntimeClient(t)
|
||||
f.On("Namespace").Return(mock.Anything)
|
||||
f.On("KubebuilderClient").Return(kbclient, nil)
|
||||
|
||||
|
||||
@@ -24,11 +24,10 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/mock"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client/fake"
|
||||
|
||||
factorymocks "github.com/vmware-tanzu/velero/pkg/client/mocks"
|
||||
cmdtest "github.com/vmware-tanzu/velero/pkg/cmd/test"
|
||||
"github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/scheme"
|
||||
velerotest "github.com/vmware-tanzu/velero/pkg/test"
|
||||
veleroexec "github.com/vmware-tanzu/velero/pkg/util/exec"
|
||||
)
|
||||
|
||||
@@ -36,7 +35,7 @@ func TestNewGetCommand(t *testing.T) {
|
||||
bkList := []string{"b1", "b2"}
|
||||
|
||||
f := &factorymocks.Factory{}
|
||||
kbclient := fake.NewClientBuilder().WithScheme(scheme.Scheme).Build()
|
||||
kbclient := velerotest.NewFakeControllerRuntimeClient(t)
|
||||
f.On("Namespace").Return(mock.Anything)
|
||||
f.On("KubebuilderClient").Return(kbclient, nil)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user