Skip to content

Commit

Permalink
use mockery generate mock (#6243)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Wu <[email protected]>
  • Loading branch information
popojk authored Feb 14, 2025
1 parent 0634811 commit c1e5830
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 30 deletions.
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.

0 comments on commit c1e5830

Please sign in to comment.