generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove finalizer from workload controller and added test
- Loading branch information
Showing
6 changed files
with
205 additions
and
10 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
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
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
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
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
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,80 @@ | ||
package util | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/stretchr/testify/mock" | ||
"k8s.io/apimachinery/pkg/api/meta" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
) | ||
|
||
type MockClient struct { | ||
mock.Mock | ||
} | ||
|
||
func (m *MockClient) Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error { | ||
args := m.Called(ctx, key, obj, opts) | ||
return args.Error(0) | ||
} | ||
|
||
func (m *MockClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error { | ||
args := m.Called(ctx, obj, opts) | ||
return args.Error(0) | ||
} | ||
|
||
func (m *MockClient) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error { | ||
args := m.Called(ctx, obj, opts) | ||
return args.Error(0) | ||
} | ||
|
||
func (m *MockClient) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error { | ||
args := m.Called(ctx, obj, opts) | ||
return args.Error(0) | ||
} | ||
|
||
func (m *MockClient) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error { | ||
args := m.Called(ctx, list, opts) | ||
return args.Error(0) | ||
} | ||
|
||
func (m *MockClient) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error { | ||
args := m.Called(ctx, obj, patch, opts) | ||
return args.Error(0) | ||
} | ||
|
||
func (m *MockClient) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error { | ||
args := m.Called(ctx, obj, opts) | ||
return args.Error(0) | ||
} | ||
|
||
func (m *MockClient) Status() client.StatusWriter { | ||
args := m.Called() | ||
return args.Get(0).(client.StatusWriter) | ||
} | ||
|
||
func (m *MockClient) Scheme() *runtime.Scheme { | ||
args := m.Called() | ||
return args.Get(0).(*runtime.Scheme) | ||
} | ||
|
||
func (m *MockClient) RESTMapper() meta.RESTMapper { | ||
args := m.Called() | ||
return args.Get(0).(meta.RESTMapper) | ||
} | ||
|
||
func (m *MockClient) GroupVersionKindFor(obj runtime.Object) (gvk schema.GroupVersionKind, err error) { | ||
args := m.Called(obj) | ||
return args.Get(0).(schema.GroupVersionKind), args.Error(1) | ||
} | ||
|
||
func (m *MockClient) IsObjectNamespaced(obj runtime.Object) (isNamespaced bool, err error) { | ||
args := m.Called(obj) | ||
return args.Get(0).(bool), args.Error(1) | ||
} | ||
|
||
func (m *MockClient) SubResource(subResource string) client.SubResourceClient { | ||
args := m.Called(subResource) | ||
return args.Get(0).(client.SubResourceClient) | ||
} |