Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use mockery generate mock in clusterresource pkg #6243

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions flyteadmin/pkg/clusterresource/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func TestPopulateDefaultTemplateValues(t *testing.T) {

func TestGetCustomTemplateValues(t *testing.T) {
adminDataProvider := mocks.FlyteAdminDataProvider{}
adminDataProvider.OnGetClusterResourceAttributesMatch(mock.Anything, proj, domain).Return(&admin.ClusterResourceAttributes{
adminDataProvider.EXPECT().GetClusterResourceAttributes(mock.Anything, mock.Anything, mock.Anything).Return(&admin.ClusterResourceAttributes{
Attributes: map[string]string{
"var1": "val1",
"var2": "val2",
Expand All @@ -148,7 +148,7 @@ func TestGetCustomTemplateValues(t *testing.T) {

func TestGetCustomTemplateValues_NothingToOverride(t *testing.T) {
adminDataProvider := mocks.FlyteAdminDataProvider{}
adminDataProvider.OnGetClusterResourceAttributesMatch(mock.Anything, proj, domain).Return(
adminDataProvider.EXPECT().GetClusterResourceAttributes(mock.Anything, mock.Anything, mock.Anything).Return(
nil, errors.NewFlyteAdminError(codes.NotFound, "foo"))
testController := controller{
adminDataProvider: &adminDataProvider,
Expand Down Expand Up @@ -332,7 +332,7 @@ imagePullSecrets:
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
adminDataProvider := mocks.FlyteAdminDataProvider{}
adminDataProvider.OnGetClusterResourceAttributesMatch(mock.Anything, mock.Anything, mock.Anything).Return(&admin.ClusterResourceAttributes{}, nil)
adminDataProvider.EXPECT().GetClusterResourceAttributes(mock.Anything, mock.Anything, mock.Anything).Return(&admin.ClusterResourceAttributes{}, nil)
mockPromScope := mockScope.NewTestScope()

c := NewClusterResourceController(&adminDataProvider, &execClusterMocks.ListTargetsInterface{}, mockPromScope)
Expand Down
2 changes: 1 addition & 1 deletion flyteadmin/pkg/clusterresource/interfaces/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin"
)

//go:generate mockery -name FlyteAdminDataProvider -output=../mocks -case=underscore
//go:generate mockery-v2 --name=FlyteAdminDataProvider --output=../mocks --case=underscore --with-expecter

type FlyteAdminDataProvider interface {
GetClusterResourceAttributes(ctx context.Context, project, domain string) (*admin.ClusterResourceAttributes, error)
Expand Down
110 changes: 84 additions & 26 deletions flyteadmin/pkg/clusterresource/mocks/flyte_admin_data_provider.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading