-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
109 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package k8s | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/stretchr/testify/mock" | ||
"github.com/vdaas/vald/internal/k8s/client" | ||
|
||
"k8s.io/apimachinery/pkg/labels" | ||
"k8s.io/apimachinery/pkg/selection" | ||
"k8s.io/apimachinery/pkg/watch" | ||
crclient "sigs.k8s.io/controller-runtime/pkg/client" | ||
) | ||
|
||
type ValdK8sClientMock struct { | ||
mock.Mock | ||
} | ||
|
||
var _ client.Client = (*ValdK8sClientMock)(nil) | ||
|
||
func (m *ValdK8sClientMock) Get(ctx context.Context, name string, namespace string, obj client.Object, opts ...crclient.GetOption) error { | ||
args := m.Called(ctx, name, namespace, obj, opts) | ||
return args.Error(0) | ||
} | ||
|
||
func (m *ValdK8sClientMock) List(ctx context.Context, list crclient.ObjectList, opts ...client.ListOption) error { | ||
args := m.Called(ctx, list, opts) | ||
return args.Error(0) | ||
} | ||
|
||
func (m *ValdK8sClientMock) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error { | ||
args := m.Called(ctx, obj, opts) | ||
return args.Error(0) | ||
} | ||
|
||
func (m *ValdK8sClientMock) Delete(ctx context.Context, obj client.Object, opts ...crclient.DeleteOption) error { | ||
args := m.Called(ctx, obj, opts) | ||
return args.Error(0) | ||
} | ||
|
||
func (m *ValdK8sClientMock) Update(ctx context.Context, obj client.Object, opts ...crclient.UpdateOption) error { | ||
args := m.Called(ctx, obj, opts) | ||
return args.Error(0) | ||
} | ||
|
||
func (m *ValdK8sClientMock) Patch(ctx context.Context, obj client.Object, patch crclient.Patch, opts ...crclient.PatchOption) error { | ||
args := m.Called(ctx, obj, patch, opts) | ||
return args.Error(0) | ||
} | ||
|
||
func (m *ValdK8sClientMock) Watch(ctx context.Context, obj crclient.ObjectList, opts ...client.ListOption) (watch.Interface, error) { | ||
args := m.Called(ctx, obj, opts) | ||
return args.Get(0).(watch.Interface), args.Error(1) | ||
} | ||
|
||
func (m *ValdK8sClientMock) LabelSelector(key string, op selection.Operator, vals []string) (labels.Selector, error) { | ||
args := m.Called(key, op, vals) | ||
return args.Get(0).(labels.Selector), args.Error(1) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters