From 275261a16a3d541796c8a474d0c6951010ed744e Mon Sep 17 00:00:00 2001 From: Jeremy Shih Date: Sat, 12 Oct 2024 10:34:25 +0800 Subject: [PATCH] feat(run): run logging data list by credit owner API --- go.mod | 2 +- go.sum | 4 +- pkg/datamodel/modelrun.go | 1 + pkg/handler/mock_service_test.go | 15 + pkg/handler/public.go | 47 + pkg/mock/ray_mock.gen.go | 331 ++-- pkg/mock/repository_mock.gen.go | 2710 ++++++++++++++++++++++------- pkg/repository/repository.go | 60 +- pkg/repository/repository_test.go | 123 +- pkg/service/service.go | 86 +- pkg/service/service_test.go | 2 +- pkg/service/utils.go | 28 + 12 files changed, 2620 insertions(+), 789 deletions(-) diff --git a/go.mod b/go.mod index 1e6c23e5..61f75d37 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 github.com/grpc-ecosystem/grpc-gateway/v2 v2.21.0 github.com/iancoleman/strcase v0.3.0 - github.com/instill-ai/protogen-go v0.3.3-alpha.0.20240902051229-d15d37e2778e + github.com/instill-ai/protogen-go v0.3.3-alpha.0.20241012090311-e872dc0b511d github.com/instill-ai/usage-client v0.3.0-alpha github.com/instill-ai/x v0.4.0-alpha.0.20240923052503-fd243919e005 github.com/jackc/pgx/v5 v5.6.0 diff --git a/go.sum b/go.sum index ada6f178..5cb478c4 100644 --- a/go.sum +++ b/go.sum @@ -229,8 +229,8 @@ github.com/hjson/hjson-go/v4 v4.0.0 h1:wlm6IYYqHjOdXH1gHev4VoXCaW20HdQAGCxdOEEg2 github.com/hjson/hjson-go/v4 v4.0.0/go.mod h1:KaYt3bTw3zhBjYqnXkYywcYctk0A2nxeEFTse3rH13E= github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= -github.com/instill-ai/protogen-go v0.3.3-alpha.0.20240902051229-d15d37e2778e h1:vOhL04/gbXioWBY0fkbOwL9/E6DTIkOnNMQEIKZv3iM= -github.com/instill-ai/protogen-go v0.3.3-alpha.0.20240902051229-d15d37e2778e/go.mod h1:2blmpUwiTwxIDnrjIqT6FhR5ewshZZF554wzjXFvKpQ= +github.com/instill-ai/protogen-go v0.3.3-alpha.0.20241012090311-e872dc0b511d h1:jf2RQtRFNxnPMkjTD0AAqXDXO8lHYOrWU3Hrr+yGEzY= +github.com/instill-ai/protogen-go v0.3.3-alpha.0.20241012090311-e872dc0b511d/go.mod h1:rf0UY7VpEgpaLudYEcjx5rnbuwlBaaLyD4FQmWLtgAY= github.com/instill-ai/usage-client v0.3.0-alpha h1:yY5eNn5zINqy8wpOogiNmrVYzJKnd1KMnMxlYBpr7Tk= github.com/instill-ai/usage-client v0.3.0-alpha/go.mod h1:8lvtZulkhQ7t8alttb2KkLKYoCp5u4oatzDbfFlEld0= github.com/instill-ai/x v0.4.0-alpha.0.20240923052503-fd243919e005 h1:6iUpJs545Ivvv2joJCQoawRPr2YRPjux22k7t+gWg6s= diff --git a/pkg/datamodel/modelrun.go b/pkg/datamodel/modelrun.go index 704bf5a2..488d2906 100644 --- a/pkg/datamodel/modelrun.go +++ b/pkg/datamodel/modelrun.go @@ -46,6 +46,7 @@ type ModelRun struct { InputReferenceID string OutputReferenceID null.String Error null.String + Model Model `gorm:"foreignKey:ModelUID;references:UID"` } func (*ModelRun) TableName() string { diff --git a/pkg/handler/mock_service_test.go b/pkg/handler/mock_service_test.go index d5754b5f..a21bbea2 100644 --- a/pkg/handler/mock_service_test.go +++ b/pkg/handler/mock_service_test.go @@ -477,6 +477,21 @@ func (mr *MockServiceMockRecorder) ListModelRuns(arg0, arg1, arg2 interface{}) * return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListModelRuns", reflect.TypeOf((*MockService)(nil).ListModelRuns), arg0, arg1, arg2) } +// ListModelRunsByCreditOwner mocks base method. +func (m *MockService) ListModelRunsByCreditOwner(arg0 context.Context, arg1 *modelv1alpha.ListModelRunsByCreditOwnerRequest, arg2 filtering.Filter) (*modelv1alpha.ListModelRunsByCreditOwnerResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListModelRunsByCreditOwner", arg0, arg1, arg2) + ret0, _ := ret[0].(*modelv1alpha.ListModelRunsByCreditOwnerResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListModelRunsByCreditOwner indicates an expected call of ListModelRunsByCreditOwner. +func (mr *MockServiceMockRecorder) ListModelRunsByCreditOwner(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListModelRunsByCreditOwner", reflect.TypeOf((*MockService)(nil).ListModelRunsByCreditOwner), arg0, arg1, arg2) +} + // ListModels mocks base method. func (m *MockService) ListModels(arg0 context.Context, arg1 int32, arg2 string, arg3 modelv1alpha.View, arg4 *modelv1alpha.Model_Visibility, arg5 filtering.Filter, arg6 bool, arg7 ordering.OrderBy) ([]*modelv1alpha.Model, int32, string, error) { m.ctrl.T.Helper() diff --git a/pkg/handler/public.go b/pkg/handler/public.go index 2c67eba7..19653d85 100644 --- a/pkg/handler/public.go +++ b/pkg/handler/public.go @@ -1141,3 +1141,50 @@ func (h *PublicHandler) ListModelRuns(ctx context.Context, req *modelpb.ListMode return resp, nil } + +func (h *PublicHandler) ListModelRunsByCreditOwner(ctx context.Context, req *modelpb.ListModelRunsByCreditOwnerRequest) (*modelpb.ListModelRunsByCreditOwnerResponse, error) { + + eventName := "ListModelRunsByCreditOwner" + + ctx, span := tracer.Start(ctx, eventName, + trace.WithSpanKind(trace.SpanKindServer)) + defer span.End() + + logger, _ := custom_logger.GetZapLogger(ctx) + + if err := authenticateUser(ctx, true); err != nil { + span.SetStatus(1, err.Error()) + return nil, err + } + + declarations, err := filtering.NewDeclarations([]filtering.DeclarationOption{ + filtering.DeclareStandardFunctions(), + filtering.DeclareIdent("status", filtering.TypeString), + filtering.DeclareIdent("source", filtering.TypeString), + }...) + if err != nil { + return nil, err + } + + filter, err := filtering.ParseFilter(req, declarations) + if err != nil { + return nil, err + } + + resp, err := h.service.ListModelRunsByCreditOwner(ctx, req, filter) + if err != nil { + span.SetStatus(1, err.Error()) + return nil, err + } + + logUUID, _ := uuid.NewV4() + logger.Info(string(custom_otel.NewLogMessage( + ctx, + span, + logUUID.String(), + eventName, + custom_otel.SetEventMessage(fmt.Sprintf("%s done", eventName)), + ))) + + return resp, nil +} diff --git a/pkg/mock/ray_mock.gen.go b/pkg/mock/ray_mock.gen.go index 0d944358..6588bf57 100644 --- a/pkg/mock/ray_mock.gen.go +++ b/pkg/mock/ray_mock.gen.go @@ -1,4 +1,4 @@ -// Code generated by http://github.com/gojuno/minimock (v3.3.13). DO NOT EDIT. +// Code generated by http://github.com/gojuno/minimock (v3.4.0). DO NOT EDIT. package mock @@ -15,49 +15,55 @@ import ( modelpb "github.com/instill-ai/protogen-go/model/model/v1alpha" ) -// RayMock implements ray.Ray +// RayMock implements mm_ray.Ray type RayMock struct { t minimock.Tester finishOnce sync.Once funcClose func() + funcCloseOrigin string inspectFuncClose func() afterCloseCounter uint64 beforeCloseCounter uint64 CloseMock mRayMockClose funcInit func() + funcInitOrigin string inspectFuncInit func() afterInitCounter uint64 beforeInitCounter uint64 InitMock mRayMockInit funcIsRayServerReady func(ctx context.Context) (b1 bool) + funcIsRayServerReadyOrigin string inspectFuncIsRayServerReady func(ctx context.Context) afterIsRayServerReadyCounter uint64 beforeIsRayServerReadyCounter uint64 IsRayServerReadyMock mRayMockIsRayServerReady funcModelInferRequest func(ctx context.Context, task commonpb.Task, req *modelpb.TriggerNamespaceModelRequest, modelName string, version string) (cp1 *rayserver.CallResponse, err error) + funcModelInferRequestOrigin string inspectFuncModelInferRequest func(ctx context.Context, task commonpb.Task, req *modelpb.TriggerNamespaceModelRequest, modelName string, version string) afterModelInferRequestCounter uint64 beforeModelInferRequestCounter uint64 ModelInferRequestMock mRayMockModelInferRequest funcModelReady func(ctx context.Context, modelName string, version string) (sp1 *modelpb.State, s1 string, i1 int, err error) + funcModelReadyOrigin string inspectFuncModelReady func(ctx context.Context, modelName string, version string) afterModelReadyCounter uint64 beforeModelReadyCounter uint64 ModelReadyMock mRayMockModelReady funcUpdateContainerizedModel func(ctx context.Context, modelName string, userID string, imageName string, version string, hardware string, action mm_ray.Action, scalingConfig []string) (err error) + funcUpdateContainerizedModelOrigin string inspectFuncUpdateContainerizedModel func(ctx context.Context, modelName string, userID string, imageName string, version string, hardware string, action mm_ray.Action, scalingConfig []string) afterUpdateContainerizedModelCounter uint64 beforeUpdateContainerizedModelCounter uint64 UpdateContainerizedModelMock mRayMockUpdateContainerizedModel } -// NewRayMock returns a mock for ray.Ray +// NewRayMock returns a mock for mm_ray.Ray func NewRayMock(t minimock.Tester) *RayMock { m := &RayMock{t: t} @@ -92,14 +98,16 @@ type mRayMockClose struct { defaultExpectation *RayMockCloseExpectation expectations []*RayMockCloseExpectation - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RayMockCloseExpectation specifies expectation struct of the Ray.Close type RayMockCloseExpectation struct { mock *RayMock - Counter uint64 + returnOrigin string + Counter uint64 } // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning @@ -146,6 +154,7 @@ func (mmClose *mRayMockClose) Return() *RayMock { mmClose.defaultExpectation = &RayMockCloseExpectation{mock: mmClose.mock} } + mmClose.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmClose.mock } @@ -160,6 +169,7 @@ func (mmClose *mRayMockClose) Set(f func()) *RayMock { } mmClose.mock.funcClose = f + mmClose.mock.funcCloseOrigin = minimock.CallerInfo(1) return mmClose.mock } @@ -169,6 +179,7 @@ func (mmClose *mRayMockClose) Times(n uint64) *mRayMockClose { mmClose.mock.t.Fatalf("Times of RayMock.Close mock can not be zero") } mm_atomic.StoreUint64(&mmClose.expectedInvocations, n) + mmClose.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmClose } @@ -183,11 +194,13 @@ func (mmClose *mRayMockClose) invocationsDone() bool { return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// Close implements ray.Ray +// Close implements mm_ray.Ray func (mmClose *RayMock) Close() { mm_atomic.AddUint64(&mmClose.beforeCloseCounter, 1) defer mm_atomic.AddUint64(&mmClose.afterCloseCounter, 1) + mmClose.t.Helper() + if mmClose.inspectFuncClose != nil { mmClose.inspectFuncClose() } @@ -244,16 +257,16 @@ func (m *RayMock) MinimockCloseInspect() { afterCloseCounter := mm_atomic.LoadUint64(&m.afterCloseCounter) // if default expectation was set then invocations count should be greater than zero if m.CloseMock.defaultExpectation != nil && afterCloseCounter < 1 { - m.t.Error("Expected call to RayMock.Close") + m.t.Errorf("Expected call to RayMock.Close at\n%s", m.CloseMock.defaultExpectation.returnOrigin) } // if func was set then invocations count should be greater than zero if m.funcClose != nil && afterCloseCounter < 1 { - m.t.Error("Expected call to RayMock.Close") + m.t.Errorf("Expected call to RayMock.Close at\n%s", m.funcCloseOrigin) } if !m.CloseMock.invocationsDone() && afterCloseCounter > 0 { - m.t.Errorf("Expected %d calls to RayMock.Close but found %d calls", - mm_atomic.LoadUint64(&m.CloseMock.expectedInvocations), afterCloseCounter) + m.t.Errorf("Expected %d calls to RayMock.Close at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.CloseMock.expectedInvocations), m.CloseMock.expectedInvocationsOrigin, afterCloseCounter) } } @@ -263,14 +276,16 @@ type mRayMockInit struct { defaultExpectation *RayMockInitExpectation expectations []*RayMockInitExpectation - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RayMockInitExpectation specifies expectation struct of the Ray.Init type RayMockInitExpectation struct { mock *RayMock - Counter uint64 + returnOrigin string + Counter uint64 } // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning @@ -317,6 +332,7 @@ func (mmInit *mRayMockInit) Return() *RayMock { mmInit.defaultExpectation = &RayMockInitExpectation{mock: mmInit.mock} } + mmInit.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmInit.mock } @@ -331,6 +347,7 @@ func (mmInit *mRayMockInit) Set(f func()) *RayMock { } mmInit.mock.funcInit = f + mmInit.mock.funcInitOrigin = minimock.CallerInfo(1) return mmInit.mock } @@ -340,6 +357,7 @@ func (mmInit *mRayMockInit) Times(n uint64) *mRayMockInit { mmInit.mock.t.Fatalf("Times of RayMock.Init mock can not be zero") } mm_atomic.StoreUint64(&mmInit.expectedInvocations, n) + mmInit.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmInit } @@ -354,11 +372,13 @@ func (mmInit *mRayMockInit) invocationsDone() bool { return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// Init implements ray.Ray +// Init implements mm_ray.Ray func (mmInit *RayMock) Init() { mm_atomic.AddUint64(&mmInit.beforeInitCounter, 1) defer mm_atomic.AddUint64(&mmInit.afterInitCounter, 1) + mmInit.t.Helper() + if mmInit.inspectFuncInit != nil { mmInit.inspectFuncInit() } @@ -415,16 +435,16 @@ func (m *RayMock) MinimockInitInspect() { afterInitCounter := mm_atomic.LoadUint64(&m.afterInitCounter) // if default expectation was set then invocations count should be greater than zero if m.InitMock.defaultExpectation != nil && afterInitCounter < 1 { - m.t.Error("Expected call to RayMock.Init") + m.t.Errorf("Expected call to RayMock.Init at\n%s", m.InitMock.defaultExpectation.returnOrigin) } // if func was set then invocations count should be greater than zero if m.funcInit != nil && afterInitCounter < 1 { - m.t.Error("Expected call to RayMock.Init") + m.t.Errorf("Expected call to RayMock.Init at\n%s", m.funcInitOrigin) } if !m.InitMock.invocationsDone() && afterInitCounter > 0 { - m.t.Errorf("Expected %d calls to RayMock.Init but found %d calls", - mm_atomic.LoadUint64(&m.InitMock.expectedInvocations), afterInitCounter) + m.t.Errorf("Expected %d calls to RayMock.Init at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.InitMock.expectedInvocations), m.InitMock.expectedInvocationsOrigin, afterInitCounter) } } @@ -437,16 +457,19 @@ type mRayMockIsRayServerReady struct { callArgs []*RayMockIsRayServerReadyParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RayMockIsRayServerReadyExpectation specifies expectation struct of the Ray.IsRayServerReady type RayMockIsRayServerReadyExpectation struct { - mock *RayMock - params *RayMockIsRayServerReadyParams - paramPtrs *RayMockIsRayServerReadyParamPtrs - results *RayMockIsRayServerReadyResults - Counter uint64 + mock *RayMock + params *RayMockIsRayServerReadyParams + paramPtrs *RayMockIsRayServerReadyParamPtrs + expectationOrigins RayMockIsRayServerReadyExpectationOrigins + results *RayMockIsRayServerReadyResults + returnOrigin string + Counter uint64 } // RayMockIsRayServerReadyParams contains parameters of the Ray.IsRayServerReady @@ -464,6 +487,12 @@ type RayMockIsRayServerReadyResults struct { b1 bool } +// RayMockIsRayServerReadyOrigins contains origins of expectations of the Ray.IsRayServerReady +type RayMockIsRayServerReadyExpectationOrigins struct { + origin string + originCtx string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -489,6 +518,7 @@ func (mmIsRayServerReady *mRayMockIsRayServerReady) Expect(ctx context.Context) } mmIsRayServerReady.defaultExpectation.params = &RayMockIsRayServerReadyParams{ctx} + mmIsRayServerReady.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmIsRayServerReady.expectations { if minimock.Equal(e.params, mmIsRayServerReady.defaultExpectation.params) { mmIsRayServerReady.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmIsRayServerReady.defaultExpectation.params) @@ -516,6 +546,7 @@ func (mmIsRayServerReady *mRayMockIsRayServerReady) ExpectCtxParam1(ctx context. mmIsRayServerReady.defaultExpectation.paramPtrs = &RayMockIsRayServerReadyParamPtrs{} } mmIsRayServerReady.defaultExpectation.paramPtrs.ctx = &ctx + mmIsRayServerReady.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmIsRayServerReady } @@ -541,6 +572,7 @@ func (mmIsRayServerReady *mRayMockIsRayServerReady) Return(b1 bool) *RayMock { mmIsRayServerReady.defaultExpectation = &RayMockIsRayServerReadyExpectation{mock: mmIsRayServerReady.mock} } mmIsRayServerReady.defaultExpectation.results = &RayMockIsRayServerReadyResults{b1} + mmIsRayServerReady.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmIsRayServerReady.mock } @@ -555,6 +587,7 @@ func (mmIsRayServerReady *mRayMockIsRayServerReady) Set(f func(ctx context.Conte } mmIsRayServerReady.mock.funcIsRayServerReady = f + mmIsRayServerReady.mock.funcIsRayServerReadyOrigin = minimock.CallerInfo(1) return mmIsRayServerReady.mock } @@ -566,8 +599,9 @@ func (mmIsRayServerReady *mRayMockIsRayServerReady) When(ctx context.Context) *R } expectation := &RayMockIsRayServerReadyExpectation{ - mock: mmIsRayServerReady.mock, - params: &RayMockIsRayServerReadyParams{ctx}, + mock: mmIsRayServerReady.mock, + params: &RayMockIsRayServerReadyParams{ctx}, + expectationOrigins: RayMockIsRayServerReadyExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmIsRayServerReady.expectations = append(mmIsRayServerReady.expectations, expectation) return expectation @@ -585,6 +619,7 @@ func (mmIsRayServerReady *mRayMockIsRayServerReady) Times(n uint64) *mRayMockIsR mmIsRayServerReady.mock.t.Fatalf("Times of RayMock.IsRayServerReady mock can not be zero") } mm_atomic.StoreUint64(&mmIsRayServerReady.expectedInvocations, n) + mmIsRayServerReady.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmIsRayServerReady } @@ -599,11 +634,13 @@ func (mmIsRayServerReady *mRayMockIsRayServerReady) invocationsDone() bool { return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// IsRayServerReady implements ray.Ray +// IsRayServerReady implements mm_ray.Ray func (mmIsRayServerReady *RayMock) IsRayServerReady(ctx context.Context) (b1 bool) { mm_atomic.AddUint64(&mmIsRayServerReady.beforeIsRayServerReadyCounter, 1) defer mm_atomic.AddUint64(&mmIsRayServerReady.afterIsRayServerReadyCounter, 1) + mmIsRayServerReady.t.Helper() + if mmIsRayServerReady.inspectFuncIsRayServerReady != nil { mmIsRayServerReady.inspectFuncIsRayServerReady(ctx) } @@ -632,11 +669,13 @@ func (mmIsRayServerReady *RayMock) IsRayServerReady(ctx context.Context) (b1 boo if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmIsRayServerReady.t.Errorf("RayMock.IsRayServerReady got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmIsRayServerReady.t.Errorf("RayMock.IsRayServerReady got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmIsRayServerReady.IsRayServerReadyMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmIsRayServerReady.t.Errorf("RayMock.IsRayServerReady got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmIsRayServerReady.t.Errorf("RayMock.IsRayServerReady got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmIsRayServerReady.IsRayServerReadyMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmIsRayServerReady.IsRayServerReadyMock.defaultExpectation.results @@ -696,7 +735,7 @@ func (m *RayMock) MinimockIsRayServerReadyDone() bool { func (m *RayMock) MinimockIsRayServerReadyInspect() { for _, e := range m.IsRayServerReadyMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RayMock.IsRayServerReady with params: %#v", *e.params) + m.t.Errorf("Expected call to RayMock.IsRayServerReady at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -704,19 +743,19 @@ func (m *RayMock) MinimockIsRayServerReadyInspect() { // if default expectation was set then invocations count should be greater than zero if m.IsRayServerReadyMock.defaultExpectation != nil && afterIsRayServerReadyCounter < 1 { if m.IsRayServerReadyMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RayMock.IsRayServerReady") + m.t.Errorf("Expected call to RayMock.IsRayServerReady at\n%s", m.IsRayServerReadyMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RayMock.IsRayServerReady with params: %#v", *m.IsRayServerReadyMock.defaultExpectation.params) + m.t.Errorf("Expected call to RayMock.IsRayServerReady at\n%s with params: %#v", m.IsRayServerReadyMock.defaultExpectation.expectationOrigins.origin, *m.IsRayServerReadyMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcIsRayServerReady != nil && afterIsRayServerReadyCounter < 1 { - m.t.Error("Expected call to RayMock.IsRayServerReady") + m.t.Errorf("Expected call to RayMock.IsRayServerReady at\n%s", m.funcIsRayServerReadyOrigin) } if !m.IsRayServerReadyMock.invocationsDone() && afterIsRayServerReadyCounter > 0 { - m.t.Errorf("Expected %d calls to RayMock.IsRayServerReady but found %d calls", - mm_atomic.LoadUint64(&m.IsRayServerReadyMock.expectedInvocations), afterIsRayServerReadyCounter) + m.t.Errorf("Expected %d calls to RayMock.IsRayServerReady at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.IsRayServerReadyMock.expectedInvocations), m.IsRayServerReadyMock.expectedInvocationsOrigin, afterIsRayServerReadyCounter) } } @@ -729,16 +768,19 @@ type mRayMockModelInferRequest struct { callArgs []*RayMockModelInferRequestParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RayMockModelInferRequestExpectation specifies expectation struct of the Ray.ModelInferRequest type RayMockModelInferRequestExpectation struct { - mock *RayMock - params *RayMockModelInferRequestParams - paramPtrs *RayMockModelInferRequestParamPtrs - results *RayMockModelInferRequestResults - Counter uint64 + mock *RayMock + params *RayMockModelInferRequestParams + paramPtrs *RayMockModelInferRequestParamPtrs + expectationOrigins RayMockModelInferRequestExpectationOrigins + results *RayMockModelInferRequestResults + returnOrigin string + Counter uint64 } // RayMockModelInferRequestParams contains parameters of the Ray.ModelInferRequest @@ -765,6 +807,16 @@ type RayMockModelInferRequestResults struct { err error } +// RayMockModelInferRequestOrigins contains origins of expectations of the Ray.ModelInferRequest +type RayMockModelInferRequestExpectationOrigins struct { + origin string + originCtx string + originTask string + originReq string + originModelName string + originVersion string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -790,6 +842,7 @@ func (mmModelInferRequest *mRayMockModelInferRequest) Expect(ctx context.Context } mmModelInferRequest.defaultExpectation.params = &RayMockModelInferRequestParams{ctx, task, req, modelName, version} + mmModelInferRequest.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmModelInferRequest.expectations { if minimock.Equal(e.params, mmModelInferRequest.defaultExpectation.params) { mmModelInferRequest.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmModelInferRequest.defaultExpectation.params) @@ -817,6 +870,7 @@ func (mmModelInferRequest *mRayMockModelInferRequest) ExpectCtxParam1(ctx contex mmModelInferRequest.defaultExpectation.paramPtrs = &RayMockModelInferRequestParamPtrs{} } mmModelInferRequest.defaultExpectation.paramPtrs.ctx = &ctx + mmModelInferRequest.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmModelInferRequest } @@ -839,6 +893,7 @@ func (mmModelInferRequest *mRayMockModelInferRequest) ExpectTaskParam2(task comm mmModelInferRequest.defaultExpectation.paramPtrs = &RayMockModelInferRequestParamPtrs{} } mmModelInferRequest.defaultExpectation.paramPtrs.task = &task + mmModelInferRequest.defaultExpectation.expectationOrigins.originTask = minimock.CallerInfo(1) return mmModelInferRequest } @@ -861,6 +916,7 @@ func (mmModelInferRequest *mRayMockModelInferRequest) ExpectReqParam3(req *model mmModelInferRequest.defaultExpectation.paramPtrs = &RayMockModelInferRequestParamPtrs{} } mmModelInferRequest.defaultExpectation.paramPtrs.req = &req + mmModelInferRequest.defaultExpectation.expectationOrigins.originReq = minimock.CallerInfo(1) return mmModelInferRequest } @@ -883,6 +939,7 @@ func (mmModelInferRequest *mRayMockModelInferRequest) ExpectModelNameParam4(mode mmModelInferRequest.defaultExpectation.paramPtrs = &RayMockModelInferRequestParamPtrs{} } mmModelInferRequest.defaultExpectation.paramPtrs.modelName = &modelName + mmModelInferRequest.defaultExpectation.expectationOrigins.originModelName = minimock.CallerInfo(1) return mmModelInferRequest } @@ -905,6 +962,7 @@ func (mmModelInferRequest *mRayMockModelInferRequest) ExpectVersionParam5(versio mmModelInferRequest.defaultExpectation.paramPtrs = &RayMockModelInferRequestParamPtrs{} } mmModelInferRequest.defaultExpectation.paramPtrs.version = &version + mmModelInferRequest.defaultExpectation.expectationOrigins.originVersion = minimock.CallerInfo(1) return mmModelInferRequest } @@ -930,6 +988,7 @@ func (mmModelInferRequest *mRayMockModelInferRequest) Return(cp1 *rayserver.Call mmModelInferRequest.defaultExpectation = &RayMockModelInferRequestExpectation{mock: mmModelInferRequest.mock} } mmModelInferRequest.defaultExpectation.results = &RayMockModelInferRequestResults{cp1, err} + mmModelInferRequest.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmModelInferRequest.mock } @@ -944,6 +1003,7 @@ func (mmModelInferRequest *mRayMockModelInferRequest) Set(f func(ctx context.Con } mmModelInferRequest.mock.funcModelInferRequest = f + mmModelInferRequest.mock.funcModelInferRequestOrigin = minimock.CallerInfo(1) return mmModelInferRequest.mock } @@ -955,8 +1015,9 @@ func (mmModelInferRequest *mRayMockModelInferRequest) When(ctx context.Context, } expectation := &RayMockModelInferRequestExpectation{ - mock: mmModelInferRequest.mock, - params: &RayMockModelInferRequestParams{ctx, task, req, modelName, version}, + mock: mmModelInferRequest.mock, + params: &RayMockModelInferRequestParams{ctx, task, req, modelName, version}, + expectationOrigins: RayMockModelInferRequestExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmModelInferRequest.expectations = append(mmModelInferRequest.expectations, expectation) return expectation @@ -974,6 +1035,7 @@ func (mmModelInferRequest *mRayMockModelInferRequest) Times(n uint64) *mRayMockM mmModelInferRequest.mock.t.Fatalf("Times of RayMock.ModelInferRequest mock can not be zero") } mm_atomic.StoreUint64(&mmModelInferRequest.expectedInvocations, n) + mmModelInferRequest.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmModelInferRequest } @@ -988,11 +1050,13 @@ func (mmModelInferRequest *mRayMockModelInferRequest) invocationsDone() bool { return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// ModelInferRequest implements ray.Ray +// ModelInferRequest implements mm_ray.Ray func (mmModelInferRequest *RayMock) ModelInferRequest(ctx context.Context, task commonpb.Task, req *modelpb.TriggerNamespaceModelRequest, modelName string, version string) (cp1 *rayserver.CallResponse, err error) { mm_atomic.AddUint64(&mmModelInferRequest.beforeModelInferRequestCounter, 1) defer mm_atomic.AddUint64(&mmModelInferRequest.afterModelInferRequestCounter, 1) + mmModelInferRequest.t.Helper() + if mmModelInferRequest.inspectFuncModelInferRequest != nil { mmModelInferRequest.inspectFuncModelInferRequest(ctx, task, req, modelName, version) } @@ -1021,27 +1085,33 @@ func (mmModelInferRequest *RayMock) ModelInferRequest(ctx context.Context, task if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmModelInferRequest.t.Errorf("RayMock.ModelInferRequest got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmModelInferRequest.t.Errorf("RayMock.ModelInferRequest got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmModelInferRequest.ModelInferRequestMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.task != nil && !minimock.Equal(*mm_want_ptrs.task, mm_got.task) { - mmModelInferRequest.t.Errorf("RayMock.ModelInferRequest got unexpected parameter task, want: %#v, got: %#v%s\n", *mm_want_ptrs.task, mm_got.task, minimock.Diff(*mm_want_ptrs.task, mm_got.task)) + mmModelInferRequest.t.Errorf("RayMock.ModelInferRequest got unexpected parameter task, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmModelInferRequest.ModelInferRequestMock.defaultExpectation.expectationOrigins.originTask, *mm_want_ptrs.task, mm_got.task, minimock.Diff(*mm_want_ptrs.task, mm_got.task)) } if mm_want_ptrs.req != nil && !minimock.Equal(*mm_want_ptrs.req, mm_got.req) { - mmModelInferRequest.t.Errorf("RayMock.ModelInferRequest got unexpected parameter req, want: %#v, got: %#v%s\n", *mm_want_ptrs.req, mm_got.req, minimock.Diff(*mm_want_ptrs.req, mm_got.req)) + mmModelInferRequest.t.Errorf("RayMock.ModelInferRequest got unexpected parameter req, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmModelInferRequest.ModelInferRequestMock.defaultExpectation.expectationOrigins.originReq, *mm_want_ptrs.req, mm_got.req, minimock.Diff(*mm_want_ptrs.req, mm_got.req)) } if mm_want_ptrs.modelName != nil && !minimock.Equal(*mm_want_ptrs.modelName, mm_got.modelName) { - mmModelInferRequest.t.Errorf("RayMock.ModelInferRequest got unexpected parameter modelName, want: %#v, got: %#v%s\n", *mm_want_ptrs.modelName, mm_got.modelName, minimock.Diff(*mm_want_ptrs.modelName, mm_got.modelName)) + mmModelInferRequest.t.Errorf("RayMock.ModelInferRequest got unexpected parameter modelName, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmModelInferRequest.ModelInferRequestMock.defaultExpectation.expectationOrigins.originModelName, *mm_want_ptrs.modelName, mm_got.modelName, minimock.Diff(*mm_want_ptrs.modelName, mm_got.modelName)) } if mm_want_ptrs.version != nil && !minimock.Equal(*mm_want_ptrs.version, mm_got.version) { - mmModelInferRequest.t.Errorf("RayMock.ModelInferRequest got unexpected parameter version, want: %#v, got: %#v%s\n", *mm_want_ptrs.version, mm_got.version, minimock.Diff(*mm_want_ptrs.version, mm_got.version)) + mmModelInferRequest.t.Errorf("RayMock.ModelInferRequest got unexpected parameter version, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmModelInferRequest.ModelInferRequestMock.defaultExpectation.expectationOrigins.originVersion, *mm_want_ptrs.version, mm_got.version, minimock.Diff(*mm_want_ptrs.version, mm_got.version)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmModelInferRequest.t.Errorf("RayMock.ModelInferRequest got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmModelInferRequest.t.Errorf("RayMock.ModelInferRequest got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmModelInferRequest.ModelInferRequestMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmModelInferRequest.ModelInferRequestMock.defaultExpectation.results @@ -1101,7 +1171,7 @@ func (m *RayMock) MinimockModelInferRequestDone() bool { func (m *RayMock) MinimockModelInferRequestInspect() { for _, e := range m.ModelInferRequestMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RayMock.ModelInferRequest with params: %#v", *e.params) + m.t.Errorf("Expected call to RayMock.ModelInferRequest at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -1109,19 +1179,19 @@ func (m *RayMock) MinimockModelInferRequestInspect() { // if default expectation was set then invocations count should be greater than zero if m.ModelInferRequestMock.defaultExpectation != nil && afterModelInferRequestCounter < 1 { if m.ModelInferRequestMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RayMock.ModelInferRequest") + m.t.Errorf("Expected call to RayMock.ModelInferRequest at\n%s", m.ModelInferRequestMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RayMock.ModelInferRequest with params: %#v", *m.ModelInferRequestMock.defaultExpectation.params) + m.t.Errorf("Expected call to RayMock.ModelInferRequest at\n%s with params: %#v", m.ModelInferRequestMock.defaultExpectation.expectationOrigins.origin, *m.ModelInferRequestMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcModelInferRequest != nil && afterModelInferRequestCounter < 1 { - m.t.Error("Expected call to RayMock.ModelInferRequest") + m.t.Errorf("Expected call to RayMock.ModelInferRequest at\n%s", m.funcModelInferRequestOrigin) } if !m.ModelInferRequestMock.invocationsDone() && afterModelInferRequestCounter > 0 { - m.t.Errorf("Expected %d calls to RayMock.ModelInferRequest but found %d calls", - mm_atomic.LoadUint64(&m.ModelInferRequestMock.expectedInvocations), afterModelInferRequestCounter) + m.t.Errorf("Expected %d calls to RayMock.ModelInferRequest at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.ModelInferRequestMock.expectedInvocations), m.ModelInferRequestMock.expectedInvocationsOrigin, afterModelInferRequestCounter) } } @@ -1134,16 +1204,19 @@ type mRayMockModelReady struct { callArgs []*RayMockModelReadyParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RayMockModelReadyExpectation specifies expectation struct of the Ray.ModelReady type RayMockModelReadyExpectation struct { - mock *RayMock - params *RayMockModelReadyParams - paramPtrs *RayMockModelReadyParamPtrs - results *RayMockModelReadyResults - Counter uint64 + mock *RayMock + params *RayMockModelReadyParams + paramPtrs *RayMockModelReadyParamPtrs + expectationOrigins RayMockModelReadyExpectationOrigins + results *RayMockModelReadyResults + returnOrigin string + Counter uint64 } // RayMockModelReadyParams contains parameters of the Ray.ModelReady @@ -1168,6 +1241,14 @@ type RayMockModelReadyResults struct { err error } +// RayMockModelReadyOrigins contains origins of expectations of the Ray.ModelReady +type RayMockModelReadyExpectationOrigins struct { + origin string + originCtx string + originModelName string + originVersion string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -1193,6 +1274,7 @@ func (mmModelReady *mRayMockModelReady) Expect(ctx context.Context, modelName st } mmModelReady.defaultExpectation.params = &RayMockModelReadyParams{ctx, modelName, version} + mmModelReady.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmModelReady.expectations { if minimock.Equal(e.params, mmModelReady.defaultExpectation.params) { mmModelReady.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmModelReady.defaultExpectation.params) @@ -1220,6 +1302,7 @@ func (mmModelReady *mRayMockModelReady) ExpectCtxParam1(ctx context.Context) *mR mmModelReady.defaultExpectation.paramPtrs = &RayMockModelReadyParamPtrs{} } mmModelReady.defaultExpectation.paramPtrs.ctx = &ctx + mmModelReady.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmModelReady } @@ -1242,6 +1325,7 @@ func (mmModelReady *mRayMockModelReady) ExpectModelNameParam2(modelName string) mmModelReady.defaultExpectation.paramPtrs = &RayMockModelReadyParamPtrs{} } mmModelReady.defaultExpectation.paramPtrs.modelName = &modelName + mmModelReady.defaultExpectation.expectationOrigins.originModelName = minimock.CallerInfo(1) return mmModelReady } @@ -1264,6 +1348,7 @@ func (mmModelReady *mRayMockModelReady) ExpectVersionParam3(version string) *mRa mmModelReady.defaultExpectation.paramPtrs = &RayMockModelReadyParamPtrs{} } mmModelReady.defaultExpectation.paramPtrs.version = &version + mmModelReady.defaultExpectation.expectationOrigins.originVersion = minimock.CallerInfo(1) return mmModelReady } @@ -1289,6 +1374,7 @@ func (mmModelReady *mRayMockModelReady) Return(sp1 *modelpb.State, s1 string, i1 mmModelReady.defaultExpectation = &RayMockModelReadyExpectation{mock: mmModelReady.mock} } mmModelReady.defaultExpectation.results = &RayMockModelReadyResults{sp1, s1, i1, err} + mmModelReady.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmModelReady.mock } @@ -1303,6 +1389,7 @@ func (mmModelReady *mRayMockModelReady) Set(f func(ctx context.Context, modelNam } mmModelReady.mock.funcModelReady = f + mmModelReady.mock.funcModelReadyOrigin = minimock.CallerInfo(1) return mmModelReady.mock } @@ -1314,8 +1401,9 @@ func (mmModelReady *mRayMockModelReady) When(ctx context.Context, modelName stri } expectation := &RayMockModelReadyExpectation{ - mock: mmModelReady.mock, - params: &RayMockModelReadyParams{ctx, modelName, version}, + mock: mmModelReady.mock, + params: &RayMockModelReadyParams{ctx, modelName, version}, + expectationOrigins: RayMockModelReadyExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmModelReady.expectations = append(mmModelReady.expectations, expectation) return expectation @@ -1333,6 +1421,7 @@ func (mmModelReady *mRayMockModelReady) Times(n uint64) *mRayMockModelReady { mmModelReady.mock.t.Fatalf("Times of RayMock.ModelReady mock can not be zero") } mm_atomic.StoreUint64(&mmModelReady.expectedInvocations, n) + mmModelReady.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmModelReady } @@ -1347,11 +1436,13 @@ func (mmModelReady *mRayMockModelReady) invocationsDone() bool { return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// ModelReady implements ray.Ray +// ModelReady implements mm_ray.Ray func (mmModelReady *RayMock) ModelReady(ctx context.Context, modelName string, version string) (sp1 *modelpb.State, s1 string, i1 int, err error) { mm_atomic.AddUint64(&mmModelReady.beforeModelReadyCounter, 1) defer mm_atomic.AddUint64(&mmModelReady.afterModelReadyCounter, 1) + mmModelReady.t.Helper() + if mmModelReady.inspectFuncModelReady != nil { mmModelReady.inspectFuncModelReady(ctx, modelName, version) } @@ -1380,19 +1471,23 @@ func (mmModelReady *RayMock) ModelReady(ctx context.Context, modelName string, v if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmModelReady.t.Errorf("RayMock.ModelReady got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmModelReady.t.Errorf("RayMock.ModelReady got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmModelReady.ModelReadyMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.modelName != nil && !minimock.Equal(*mm_want_ptrs.modelName, mm_got.modelName) { - mmModelReady.t.Errorf("RayMock.ModelReady got unexpected parameter modelName, want: %#v, got: %#v%s\n", *mm_want_ptrs.modelName, mm_got.modelName, minimock.Diff(*mm_want_ptrs.modelName, mm_got.modelName)) + mmModelReady.t.Errorf("RayMock.ModelReady got unexpected parameter modelName, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmModelReady.ModelReadyMock.defaultExpectation.expectationOrigins.originModelName, *mm_want_ptrs.modelName, mm_got.modelName, minimock.Diff(*mm_want_ptrs.modelName, mm_got.modelName)) } if mm_want_ptrs.version != nil && !minimock.Equal(*mm_want_ptrs.version, mm_got.version) { - mmModelReady.t.Errorf("RayMock.ModelReady got unexpected parameter version, want: %#v, got: %#v%s\n", *mm_want_ptrs.version, mm_got.version, minimock.Diff(*mm_want_ptrs.version, mm_got.version)) + mmModelReady.t.Errorf("RayMock.ModelReady got unexpected parameter version, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmModelReady.ModelReadyMock.defaultExpectation.expectationOrigins.originVersion, *mm_want_ptrs.version, mm_got.version, minimock.Diff(*mm_want_ptrs.version, mm_got.version)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmModelReady.t.Errorf("RayMock.ModelReady got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmModelReady.t.Errorf("RayMock.ModelReady got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmModelReady.ModelReadyMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmModelReady.ModelReadyMock.defaultExpectation.results @@ -1452,7 +1547,7 @@ func (m *RayMock) MinimockModelReadyDone() bool { func (m *RayMock) MinimockModelReadyInspect() { for _, e := range m.ModelReadyMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RayMock.ModelReady with params: %#v", *e.params) + m.t.Errorf("Expected call to RayMock.ModelReady at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -1460,19 +1555,19 @@ func (m *RayMock) MinimockModelReadyInspect() { // if default expectation was set then invocations count should be greater than zero if m.ModelReadyMock.defaultExpectation != nil && afterModelReadyCounter < 1 { if m.ModelReadyMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RayMock.ModelReady") + m.t.Errorf("Expected call to RayMock.ModelReady at\n%s", m.ModelReadyMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RayMock.ModelReady with params: %#v", *m.ModelReadyMock.defaultExpectation.params) + m.t.Errorf("Expected call to RayMock.ModelReady at\n%s with params: %#v", m.ModelReadyMock.defaultExpectation.expectationOrigins.origin, *m.ModelReadyMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcModelReady != nil && afterModelReadyCounter < 1 { - m.t.Error("Expected call to RayMock.ModelReady") + m.t.Errorf("Expected call to RayMock.ModelReady at\n%s", m.funcModelReadyOrigin) } if !m.ModelReadyMock.invocationsDone() && afterModelReadyCounter > 0 { - m.t.Errorf("Expected %d calls to RayMock.ModelReady but found %d calls", - mm_atomic.LoadUint64(&m.ModelReadyMock.expectedInvocations), afterModelReadyCounter) + m.t.Errorf("Expected %d calls to RayMock.ModelReady at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.ModelReadyMock.expectedInvocations), m.ModelReadyMock.expectedInvocationsOrigin, afterModelReadyCounter) } } @@ -1485,16 +1580,19 @@ type mRayMockUpdateContainerizedModel struct { callArgs []*RayMockUpdateContainerizedModelParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RayMockUpdateContainerizedModelExpectation specifies expectation struct of the Ray.UpdateContainerizedModel type RayMockUpdateContainerizedModelExpectation struct { - mock *RayMock - params *RayMockUpdateContainerizedModelParams - paramPtrs *RayMockUpdateContainerizedModelParamPtrs - results *RayMockUpdateContainerizedModelResults - Counter uint64 + mock *RayMock + params *RayMockUpdateContainerizedModelParams + paramPtrs *RayMockUpdateContainerizedModelParamPtrs + expectationOrigins RayMockUpdateContainerizedModelExpectationOrigins + results *RayMockUpdateContainerizedModelResults + returnOrigin string + Counter uint64 } // RayMockUpdateContainerizedModelParams contains parameters of the Ray.UpdateContainerizedModel @@ -1526,6 +1624,19 @@ type RayMockUpdateContainerizedModelResults struct { err error } +// RayMockUpdateContainerizedModelOrigins contains origins of expectations of the Ray.UpdateContainerizedModel +type RayMockUpdateContainerizedModelExpectationOrigins struct { + origin string + originCtx string + originModelName string + originUserID string + originImageName string + originVersion string + originHardware string + originAction string + originScalingConfig string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -1551,6 +1662,7 @@ func (mmUpdateContainerizedModel *mRayMockUpdateContainerizedModel) Expect(ctx c } mmUpdateContainerizedModel.defaultExpectation.params = &RayMockUpdateContainerizedModelParams{ctx, modelName, userID, imageName, version, hardware, action, scalingConfig} + mmUpdateContainerizedModel.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmUpdateContainerizedModel.expectations { if minimock.Equal(e.params, mmUpdateContainerizedModel.defaultExpectation.params) { mmUpdateContainerizedModel.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmUpdateContainerizedModel.defaultExpectation.params) @@ -1578,6 +1690,7 @@ func (mmUpdateContainerizedModel *mRayMockUpdateContainerizedModel) ExpectCtxPar mmUpdateContainerizedModel.defaultExpectation.paramPtrs = &RayMockUpdateContainerizedModelParamPtrs{} } mmUpdateContainerizedModel.defaultExpectation.paramPtrs.ctx = &ctx + mmUpdateContainerizedModel.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmUpdateContainerizedModel } @@ -1600,6 +1713,7 @@ func (mmUpdateContainerizedModel *mRayMockUpdateContainerizedModel) ExpectModelN mmUpdateContainerizedModel.defaultExpectation.paramPtrs = &RayMockUpdateContainerizedModelParamPtrs{} } mmUpdateContainerizedModel.defaultExpectation.paramPtrs.modelName = &modelName + mmUpdateContainerizedModel.defaultExpectation.expectationOrigins.originModelName = minimock.CallerInfo(1) return mmUpdateContainerizedModel } @@ -1622,6 +1736,7 @@ func (mmUpdateContainerizedModel *mRayMockUpdateContainerizedModel) ExpectUserID mmUpdateContainerizedModel.defaultExpectation.paramPtrs = &RayMockUpdateContainerizedModelParamPtrs{} } mmUpdateContainerizedModel.defaultExpectation.paramPtrs.userID = &userID + mmUpdateContainerizedModel.defaultExpectation.expectationOrigins.originUserID = minimock.CallerInfo(1) return mmUpdateContainerizedModel } @@ -1644,6 +1759,7 @@ func (mmUpdateContainerizedModel *mRayMockUpdateContainerizedModel) ExpectImageN mmUpdateContainerizedModel.defaultExpectation.paramPtrs = &RayMockUpdateContainerizedModelParamPtrs{} } mmUpdateContainerizedModel.defaultExpectation.paramPtrs.imageName = &imageName + mmUpdateContainerizedModel.defaultExpectation.expectationOrigins.originImageName = minimock.CallerInfo(1) return mmUpdateContainerizedModel } @@ -1666,6 +1782,7 @@ func (mmUpdateContainerizedModel *mRayMockUpdateContainerizedModel) ExpectVersio mmUpdateContainerizedModel.defaultExpectation.paramPtrs = &RayMockUpdateContainerizedModelParamPtrs{} } mmUpdateContainerizedModel.defaultExpectation.paramPtrs.version = &version + mmUpdateContainerizedModel.defaultExpectation.expectationOrigins.originVersion = minimock.CallerInfo(1) return mmUpdateContainerizedModel } @@ -1688,6 +1805,7 @@ func (mmUpdateContainerizedModel *mRayMockUpdateContainerizedModel) ExpectHardwa mmUpdateContainerizedModel.defaultExpectation.paramPtrs = &RayMockUpdateContainerizedModelParamPtrs{} } mmUpdateContainerizedModel.defaultExpectation.paramPtrs.hardware = &hardware + mmUpdateContainerizedModel.defaultExpectation.expectationOrigins.originHardware = minimock.CallerInfo(1) return mmUpdateContainerizedModel } @@ -1710,6 +1828,7 @@ func (mmUpdateContainerizedModel *mRayMockUpdateContainerizedModel) ExpectAction mmUpdateContainerizedModel.defaultExpectation.paramPtrs = &RayMockUpdateContainerizedModelParamPtrs{} } mmUpdateContainerizedModel.defaultExpectation.paramPtrs.action = &action + mmUpdateContainerizedModel.defaultExpectation.expectationOrigins.originAction = minimock.CallerInfo(1) return mmUpdateContainerizedModel } @@ -1732,6 +1851,7 @@ func (mmUpdateContainerizedModel *mRayMockUpdateContainerizedModel) ExpectScalin mmUpdateContainerizedModel.defaultExpectation.paramPtrs = &RayMockUpdateContainerizedModelParamPtrs{} } mmUpdateContainerizedModel.defaultExpectation.paramPtrs.scalingConfig = &scalingConfig + mmUpdateContainerizedModel.defaultExpectation.expectationOrigins.originScalingConfig = minimock.CallerInfo(1) return mmUpdateContainerizedModel } @@ -1757,6 +1877,7 @@ func (mmUpdateContainerizedModel *mRayMockUpdateContainerizedModel) Return(err e mmUpdateContainerizedModel.defaultExpectation = &RayMockUpdateContainerizedModelExpectation{mock: mmUpdateContainerizedModel.mock} } mmUpdateContainerizedModel.defaultExpectation.results = &RayMockUpdateContainerizedModelResults{err} + mmUpdateContainerizedModel.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmUpdateContainerizedModel.mock } @@ -1771,6 +1892,7 @@ func (mmUpdateContainerizedModel *mRayMockUpdateContainerizedModel) Set(f func(c } mmUpdateContainerizedModel.mock.funcUpdateContainerizedModel = f + mmUpdateContainerizedModel.mock.funcUpdateContainerizedModelOrigin = minimock.CallerInfo(1) return mmUpdateContainerizedModel.mock } @@ -1782,8 +1904,9 @@ func (mmUpdateContainerizedModel *mRayMockUpdateContainerizedModel) When(ctx con } expectation := &RayMockUpdateContainerizedModelExpectation{ - mock: mmUpdateContainerizedModel.mock, - params: &RayMockUpdateContainerizedModelParams{ctx, modelName, userID, imageName, version, hardware, action, scalingConfig}, + mock: mmUpdateContainerizedModel.mock, + params: &RayMockUpdateContainerizedModelParams{ctx, modelName, userID, imageName, version, hardware, action, scalingConfig}, + expectationOrigins: RayMockUpdateContainerizedModelExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmUpdateContainerizedModel.expectations = append(mmUpdateContainerizedModel.expectations, expectation) return expectation @@ -1801,6 +1924,7 @@ func (mmUpdateContainerizedModel *mRayMockUpdateContainerizedModel) Times(n uint mmUpdateContainerizedModel.mock.t.Fatalf("Times of RayMock.UpdateContainerizedModel mock can not be zero") } mm_atomic.StoreUint64(&mmUpdateContainerizedModel.expectedInvocations, n) + mmUpdateContainerizedModel.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmUpdateContainerizedModel } @@ -1815,11 +1939,13 @@ func (mmUpdateContainerizedModel *mRayMockUpdateContainerizedModel) invocationsD return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// UpdateContainerizedModel implements ray.Ray +// UpdateContainerizedModel implements mm_ray.Ray func (mmUpdateContainerizedModel *RayMock) UpdateContainerizedModel(ctx context.Context, modelName string, userID string, imageName string, version string, hardware string, action mm_ray.Action, scalingConfig []string) (err error) { mm_atomic.AddUint64(&mmUpdateContainerizedModel.beforeUpdateContainerizedModelCounter, 1) defer mm_atomic.AddUint64(&mmUpdateContainerizedModel.afterUpdateContainerizedModelCounter, 1) + mmUpdateContainerizedModel.t.Helper() + if mmUpdateContainerizedModel.inspectFuncUpdateContainerizedModel != nil { mmUpdateContainerizedModel.inspectFuncUpdateContainerizedModel(ctx, modelName, userID, imageName, version, hardware, action, scalingConfig) } @@ -1848,39 +1974,48 @@ func (mmUpdateContainerizedModel *RayMock) UpdateContainerizedModel(ctx context. if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmUpdateContainerizedModel.t.Errorf("RayMock.UpdateContainerizedModel got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmUpdateContainerizedModel.t.Errorf("RayMock.UpdateContainerizedModel got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmUpdateContainerizedModel.UpdateContainerizedModelMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.modelName != nil && !minimock.Equal(*mm_want_ptrs.modelName, mm_got.modelName) { - mmUpdateContainerizedModel.t.Errorf("RayMock.UpdateContainerizedModel got unexpected parameter modelName, want: %#v, got: %#v%s\n", *mm_want_ptrs.modelName, mm_got.modelName, minimock.Diff(*mm_want_ptrs.modelName, mm_got.modelName)) + mmUpdateContainerizedModel.t.Errorf("RayMock.UpdateContainerizedModel got unexpected parameter modelName, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmUpdateContainerizedModel.UpdateContainerizedModelMock.defaultExpectation.expectationOrigins.originModelName, *mm_want_ptrs.modelName, mm_got.modelName, minimock.Diff(*mm_want_ptrs.modelName, mm_got.modelName)) } if mm_want_ptrs.userID != nil && !minimock.Equal(*mm_want_ptrs.userID, mm_got.userID) { - mmUpdateContainerizedModel.t.Errorf("RayMock.UpdateContainerizedModel got unexpected parameter userID, want: %#v, got: %#v%s\n", *mm_want_ptrs.userID, mm_got.userID, minimock.Diff(*mm_want_ptrs.userID, mm_got.userID)) + mmUpdateContainerizedModel.t.Errorf("RayMock.UpdateContainerizedModel got unexpected parameter userID, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmUpdateContainerizedModel.UpdateContainerizedModelMock.defaultExpectation.expectationOrigins.originUserID, *mm_want_ptrs.userID, mm_got.userID, minimock.Diff(*mm_want_ptrs.userID, mm_got.userID)) } if mm_want_ptrs.imageName != nil && !minimock.Equal(*mm_want_ptrs.imageName, mm_got.imageName) { - mmUpdateContainerizedModel.t.Errorf("RayMock.UpdateContainerizedModel got unexpected parameter imageName, want: %#v, got: %#v%s\n", *mm_want_ptrs.imageName, mm_got.imageName, minimock.Diff(*mm_want_ptrs.imageName, mm_got.imageName)) + mmUpdateContainerizedModel.t.Errorf("RayMock.UpdateContainerizedModel got unexpected parameter imageName, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmUpdateContainerizedModel.UpdateContainerizedModelMock.defaultExpectation.expectationOrigins.originImageName, *mm_want_ptrs.imageName, mm_got.imageName, minimock.Diff(*mm_want_ptrs.imageName, mm_got.imageName)) } if mm_want_ptrs.version != nil && !minimock.Equal(*mm_want_ptrs.version, mm_got.version) { - mmUpdateContainerizedModel.t.Errorf("RayMock.UpdateContainerizedModel got unexpected parameter version, want: %#v, got: %#v%s\n", *mm_want_ptrs.version, mm_got.version, minimock.Diff(*mm_want_ptrs.version, mm_got.version)) + mmUpdateContainerizedModel.t.Errorf("RayMock.UpdateContainerizedModel got unexpected parameter version, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmUpdateContainerizedModel.UpdateContainerizedModelMock.defaultExpectation.expectationOrigins.originVersion, *mm_want_ptrs.version, mm_got.version, minimock.Diff(*mm_want_ptrs.version, mm_got.version)) } if mm_want_ptrs.hardware != nil && !minimock.Equal(*mm_want_ptrs.hardware, mm_got.hardware) { - mmUpdateContainerizedModel.t.Errorf("RayMock.UpdateContainerizedModel got unexpected parameter hardware, want: %#v, got: %#v%s\n", *mm_want_ptrs.hardware, mm_got.hardware, minimock.Diff(*mm_want_ptrs.hardware, mm_got.hardware)) + mmUpdateContainerizedModel.t.Errorf("RayMock.UpdateContainerizedModel got unexpected parameter hardware, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmUpdateContainerizedModel.UpdateContainerizedModelMock.defaultExpectation.expectationOrigins.originHardware, *mm_want_ptrs.hardware, mm_got.hardware, minimock.Diff(*mm_want_ptrs.hardware, mm_got.hardware)) } if mm_want_ptrs.action != nil && !minimock.Equal(*mm_want_ptrs.action, mm_got.action) { - mmUpdateContainerizedModel.t.Errorf("RayMock.UpdateContainerizedModel got unexpected parameter action, want: %#v, got: %#v%s\n", *mm_want_ptrs.action, mm_got.action, minimock.Diff(*mm_want_ptrs.action, mm_got.action)) + mmUpdateContainerizedModel.t.Errorf("RayMock.UpdateContainerizedModel got unexpected parameter action, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmUpdateContainerizedModel.UpdateContainerizedModelMock.defaultExpectation.expectationOrigins.originAction, *mm_want_ptrs.action, mm_got.action, minimock.Diff(*mm_want_ptrs.action, mm_got.action)) } if mm_want_ptrs.scalingConfig != nil && !minimock.Equal(*mm_want_ptrs.scalingConfig, mm_got.scalingConfig) { - mmUpdateContainerizedModel.t.Errorf("RayMock.UpdateContainerizedModel got unexpected parameter scalingConfig, want: %#v, got: %#v%s\n", *mm_want_ptrs.scalingConfig, mm_got.scalingConfig, minimock.Diff(*mm_want_ptrs.scalingConfig, mm_got.scalingConfig)) + mmUpdateContainerizedModel.t.Errorf("RayMock.UpdateContainerizedModel got unexpected parameter scalingConfig, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmUpdateContainerizedModel.UpdateContainerizedModelMock.defaultExpectation.expectationOrigins.originScalingConfig, *mm_want_ptrs.scalingConfig, mm_got.scalingConfig, minimock.Diff(*mm_want_ptrs.scalingConfig, mm_got.scalingConfig)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmUpdateContainerizedModel.t.Errorf("RayMock.UpdateContainerizedModel got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmUpdateContainerizedModel.t.Errorf("RayMock.UpdateContainerizedModel got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmUpdateContainerizedModel.UpdateContainerizedModelMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmUpdateContainerizedModel.UpdateContainerizedModelMock.defaultExpectation.results @@ -1940,7 +2075,7 @@ func (m *RayMock) MinimockUpdateContainerizedModelDone() bool { func (m *RayMock) MinimockUpdateContainerizedModelInspect() { for _, e := range m.UpdateContainerizedModelMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RayMock.UpdateContainerizedModel with params: %#v", *e.params) + m.t.Errorf("Expected call to RayMock.UpdateContainerizedModel at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -1948,19 +2083,19 @@ func (m *RayMock) MinimockUpdateContainerizedModelInspect() { // if default expectation was set then invocations count should be greater than zero if m.UpdateContainerizedModelMock.defaultExpectation != nil && afterUpdateContainerizedModelCounter < 1 { if m.UpdateContainerizedModelMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RayMock.UpdateContainerizedModel") + m.t.Errorf("Expected call to RayMock.UpdateContainerizedModel at\n%s", m.UpdateContainerizedModelMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RayMock.UpdateContainerizedModel with params: %#v", *m.UpdateContainerizedModelMock.defaultExpectation.params) + m.t.Errorf("Expected call to RayMock.UpdateContainerizedModel at\n%s with params: %#v", m.UpdateContainerizedModelMock.defaultExpectation.expectationOrigins.origin, *m.UpdateContainerizedModelMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcUpdateContainerizedModel != nil && afterUpdateContainerizedModelCounter < 1 { - m.t.Error("Expected call to RayMock.UpdateContainerizedModel") + m.t.Errorf("Expected call to RayMock.UpdateContainerizedModel at\n%s", m.funcUpdateContainerizedModelOrigin) } if !m.UpdateContainerizedModelMock.invocationsDone() && afterUpdateContainerizedModelCounter > 0 { - m.t.Errorf("Expected %d calls to RayMock.UpdateContainerizedModel but found %d calls", - mm_atomic.LoadUint64(&m.UpdateContainerizedModelMock.expectedInvocations), afterUpdateContainerizedModelCounter) + m.t.Errorf("Expected %d calls to RayMock.UpdateContainerizedModel at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.UpdateContainerizedModelMock.expectedInvocations), m.UpdateContainerizedModelMock.expectedInvocationsOrigin, afterUpdateContainerizedModelCounter) } } diff --git a/pkg/mock/repository_mock.gen.go b/pkg/mock/repository_mock.gen.go index da747c3b..a16c4030 100644 --- a/pkg/mock/repository_mock.gen.go +++ b/pkg/mock/repository_mock.gen.go @@ -1,4 +1,4 @@ -// Code generated by http://github.com/gojuno/minimock (v3.3.13). DO NOT EDIT. +// Code generated by http://github.com/gojuno/minimock (v3.4.0). DO NOT EDIT. package mock @@ -6,6 +6,7 @@ import ( "context" "sync" mm_atomic "sync/atomic" + "time" mm_time "time" "github.com/gofrs/uuid" @@ -17,205 +18,244 @@ import ( "gorm.io/gorm" ) -// RepositoryMock implements repository.Repository +// RepositoryMock implements mm_repository.Repository type RepositoryMock struct { t minimock.Tester finishOnce sync.Once funcCheckPinnedUser func(ctx context.Context, db *gorm.DB, table string) (dp1 *gorm.DB) + funcCheckPinnedUserOrigin string inspectFuncCheckPinnedUser func(ctx context.Context, db *gorm.DB, table string) afterCheckPinnedUserCounter uint64 beforeCheckPinnedUserCounter uint64 CheckPinnedUserMock mRepositoryMockCheckPinnedUser funcCreateModelRun func(ctx context.Context, modelRun *datamodel.ModelRun) (mp1 *datamodel.ModelRun, err error) + funcCreateModelRunOrigin string inspectFuncCreateModelRun func(ctx context.Context, modelRun *datamodel.ModelRun) afterCreateModelRunCounter uint64 beforeCreateModelRunCounter uint64 CreateModelRunMock mRepositoryMockCreateModelRun funcCreateModelTags func(ctx context.Context, modelUID uuid.UUID, tagNames []string) (err error) + funcCreateModelTagsOrigin string inspectFuncCreateModelTags func(ctx context.Context, modelUID uuid.UUID, tagNames []string) afterCreateModelTagsCounter uint64 beforeCreateModelTagsCounter uint64 CreateModelTagsMock mRepositoryMockCreateModelTags funcCreateModelVersion func(ctx context.Context, ownerPermalink string, version *datamodel.ModelVersion) (err error) + funcCreateModelVersionOrigin string inspectFuncCreateModelVersion func(ctx context.Context, ownerPermalink string, version *datamodel.ModelVersion) afterCreateModelVersionCounter uint64 beforeCreateModelVersionCounter uint64 CreateModelVersionMock mRepositoryMockCreateModelVersion funcCreateNamespaceModel func(ctx context.Context, ownerPermalink string, model *datamodel.Model) (err error) + funcCreateNamespaceModelOrigin string inspectFuncCreateNamespaceModel func(ctx context.Context, ownerPermalink string, model *datamodel.Model) afterCreateNamespaceModelCounter uint64 beforeCreateNamespaceModelCounter uint64 CreateNamespaceModelMock mRepositoryMockCreateNamespaceModel funcDeleteModelTags func(ctx context.Context, modelUID uuid.UUID, tagNames []string) (err error) + funcDeleteModelTagsOrigin string inspectFuncDeleteModelTags func(ctx context.Context, modelUID uuid.UUID, tagNames []string) afterDeleteModelTagsCounter uint64 beforeDeleteModelTagsCounter uint64 DeleteModelTagsMock mRepositoryMockDeleteModelTags funcDeleteModelVersionByDigest func(ctx context.Context, modelUID uuid.UUID, digest string) (err error) + funcDeleteModelVersionByDigestOrigin string inspectFuncDeleteModelVersionByDigest func(ctx context.Context, modelUID uuid.UUID, digest string) afterDeleteModelVersionByDigestCounter uint64 beforeDeleteModelVersionByDigestCounter uint64 DeleteModelVersionByDigestMock mRepositoryMockDeleteModelVersionByDigest funcDeleteModelVersionByID func(ctx context.Context, modelUID uuid.UUID, versionID string) (err error) + funcDeleteModelVersionByIDOrigin string inspectFuncDeleteModelVersionByID func(ctx context.Context, modelUID uuid.UUID, versionID string) afterDeleteModelVersionByIDCounter uint64 beforeDeleteModelVersionByIDCounter uint64 DeleteModelVersionByIDMock mRepositoryMockDeleteModelVersionByID funcDeleteNamespaceModelByID func(ctx context.Context, ownerPermalink string, id string) (err error) + funcDeleteNamespaceModelByIDOrigin string inspectFuncDeleteNamespaceModelByID func(ctx context.Context, ownerPermalink string, id string) afterDeleteNamespaceModelByIDCounter uint64 beforeDeleteNamespaceModelByIDCounter uint64 DeleteNamespaceModelByIDMock mRepositoryMockDeleteNamespaceModelByID funcGetLatestModelRunByModelUID func(ctx context.Context, userUID string, modelUID string) (modelRun *datamodel.ModelRun, err error) + funcGetLatestModelRunByModelUIDOrigin string inspectFuncGetLatestModelRunByModelUID func(ctx context.Context, userUID string, modelUID string) afterGetLatestModelRunByModelUIDCounter uint64 beforeGetLatestModelRunByModelUIDCounter uint64 GetLatestModelRunByModelUIDMock mRepositoryMockGetLatestModelRunByModelUID funcGetLatestModelVersionByModelUID func(ctx context.Context, modelUID uuid.UUID) (version *datamodel.ModelVersion, err error) + funcGetLatestModelVersionByModelUIDOrigin string inspectFuncGetLatestModelVersionByModelUID func(ctx context.Context, modelUID uuid.UUID) afterGetLatestModelVersionByModelUIDCounter uint64 beforeGetLatestModelVersionByModelUIDCounter uint64 GetLatestModelVersionByModelUIDMock mRepositoryMockGetLatestModelVersionByModelUID funcGetLatestModelVersionRunByModelUID func(ctx context.Context, userUID string, modelUID string, version string) (modelRun *datamodel.ModelRun, err error) + funcGetLatestModelVersionRunByModelUIDOrigin string inspectFuncGetLatestModelVersionRunByModelUID func(ctx context.Context, userUID string, modelUID string, version string) afterGetLatestModelVersionRunByModelUIDCounter uint64 beforeGetLatestModelVersionRunByModelUIDCounter uint64 GetLatestModelVersionRunByModelUIDMock mRepositoryMockGetLatestModelVersionRunByModelUID funcGetModelByUID func(ctx context.Context, uid uuid.UUID, isBasicView bool, includeAvatar bool) (mp1 *datamodel.Model, err error) + funcGetModelByUIDOrigin string inspectFuncGetModelByUID func(ctx context.Context, uid uuid.UUID, isBasicView bool, includeAvatar bool) afterGetModelByUIDCounter uint64 beforeGetModelByUIDCounter uint64 GetModelByUIDMock mRepositoryMockGetModelByUID funcGetModelByUIDAdmin func(ctx context.Context, uid uuid.UUID, isBasicView bool, includeAvatar bool) (mp1 *datamodel.Model, err error) + funcGetModelByUIDAdminOrigin string inspectFuncGetModelByUIDAdmin func(ctx context.Context, uid uuid.UUID, isBasicView bool, includeAvatar bool) afterGetModelByUIDAdminCounter uint64 beforeGetModelByUIDAdminCounter uint64 GetModelByUIDAdminMock mRepositoryMockGetModelByUIDAdmin funcGetModelDefinition func(id string) (mp1 *datamodel.ModelDefinition, err error) + funcGetModelDefinitionOrigin string inspectFuncGetModelDefinition func(id string) afterGetModelDefinitionCounter uint64 beforeGetModelDefinitionCounter uint64 GetModelDefinitionMock mRepositoryMockGetModelDefinition funcGetModelDefinitionByUID func(uid uuid.UUID) (mp1 *datamodel.ModelDefinition, err error) + funcGetModelDefinitionByUIDOrigin string inspectFuncGetModelDefinitionByUID func(uid uuid.UUID) afterGetModelDefinitionByUIDCounter uint64 beforeGetModelDefinitionByUIDCounter uint64 GetModelDefinitionByUIDMock mRepositoryMockGetModelDefinitionByUID funcGetModelRunByUID func(ctx context.Context, triggerUID string) (modelRun *datamodel.ModelRun, err error) + funcGetModelRunByUIDOrigin string inspectFuncGetModelRunByUID func(ctx context.Context, triggerUID string) afterGetModelRunByUIDCounter uint64 beforeGetModelRunByUIDCounter uint64 GetModelRunByUIDMock mRepositoryMockGetModelRunByUID funcGetModelVersionByID func(ctx context.Context, modelUID uuid.UUID, versionID string) (version *datamodel.ModelVersion, err error) + funcGetModelVersionByIDOrigin string inspectFuncGetModelVersionByID func(ctx context.Context, modelUID uuid.UUID, versionID string) afterGetModelVersionByIDCounter uint64 beforeGetModelVersionByIDCounter uint64 GetModelVersionByIDMock mRepositoryMockGetModelVersionByID funcGetNamespaceModelByID func(ctx context.Context, ownerPermalink string, id string, isBasicView bool, includeAvatar bool) (mp1 *datamodel.Model, err error) + funcGetNamespaceModelByIDOrigin string inspectFuncGetNamespaceModelByID func(ctx context.Context, ownerPermalink string, id string, isBasicView bool, includeAvatar bool) afterGetNamespaceModelByIDCounter uint64 beforeGetNamespaceModelByIDCounter uint64 GetNamespaceModelByIDMock mRepositoryMockGetNamespaceModelByID funcListModelDefinitions func(view modelpb.View, pageSize int64, pageToken string) (definitions []*datamodel.ModelDefinition, nextPageToken string, totalSize int64, err error) + funcListModelDefinitionsOrigin string inspectFuncListModelDefinitions func(view modelpb.View, pageSize int64, pageToken string) afterListModelDefinitionsCounter uint64 beforeListModelDefinitionsCounter uint64 ListModelDefinitionsMock mRepositoryMockListModelDefinitions - funcListModelRuns func(ctx context.Context, pageSize int64, page int64, filter filtering.Filter, order ordering.OrderBy, requesterUID string, isOwner bool, modelUID string) (modelTriggers []*datamodel.ModelRun, totalSize int64, err error) + funcListModelRuns func(ctx context.Context, pageSize int64, page int64, filter filtering.Filter, order ordering.OrderBy, requesterUID string, isOwner bool, modelUID string) (modelRuns []*datamodel.ModelRun, totalSize int64, err error) + funcListModelRunsOrigin string inspectFuncListModelRuns func(ctx context.Context, pageSize int64, page int64, filter filtering.Filter, order ordering.OrderBy, requesterUID string, isOwner bool, modelUID string) afterListModelRunsCounter uint64 beforeListModelRunsCounter uint64 ListModelRunsMock mRepositoryMockListModelRuns + funcListModelRunsByCreditOwner func(ctx context.Context, pageSize int64, page int64, filter filtering.Filter, order ordering.OrderBy, requesterUID string, startedTimeBegin time.Time, startedTimeEnd time.Time) (modelTriggers []*datamodel.ModelRun, totalSize int64, err error) + funcListModelRunsByCreditOwnerOrigin string + inspectFuncListModelRunsByCreditOwner func(ctx context.Context, pageSize int64, page int64, filter filtering.Filter, order ordering.OrderBy, requesterUID string, startedTimeBegin time.Time, startedTimeEnd time.Time) + afterListModelRunsByCreditOwnerCounter uint64 + beforeListModelRunsByCreditOwnerCounter uint64 + ListModelRunsByCreditOwnerMock mRepositoryMockListModelRunsByCreditOwner + funcListModelTags func(ctx context.Context, modelUID uuid.UUID) (ma1 []datamodel.ModelTag, err error) + funcListModelTagsOrigin string inspectFuncListModelTags func(ctx context.Context, modelUID uuid.UUID) afterListModelTagsCounter uint64 beforeListModelTagsCounter uint64 ListModelTagsMock mRepositoryMockListModelTags funcListModelVersions func(ctx context.Context, modelUID uuid.UUID, groupDigest bool) (versions []*datamodel.ModelVersion, err error) + funcListModelVersionsOrigin string inspectFuncListModelVersions func(ctx context.Context, modelUID uuid.UUID, groupDigest bool) afterListModelVersionsCounter uint64 beforeListModelVersionsCounter uint64 ListModelVersionsMock mRepositoryMockListModelVersions funcListModelVersionsByDigest func(ctx context.Context, modelUID uuid.UUID, digest string) (versions []*datamodel.ModelVersion, err error) + funcListModelVersionsByDigestOrigin string inspectFuncListModelVersionsByDigest func(ctx context.Context, modelUID uuid.UUID, digest string) afterListModelVersionsByDigestCounter uint64 beforeListModelVersionsByDigestCounter uint64 ListModelVersionsByDigestMock mRepositoryMockListModelVersionsByDigest funcListModels func(ctx context.Context, pageSize int64, pageToken string, isBasicView bool, filter filtering.Filter, uidAllowList []uuid.UUID, showDeleted bool, order ordering.OrderBy, visibility *modelpb.Model_Visibility) (models []*datamodel.Model, totalSize int64, nextPageToken string, err error) + funcListModelsOrigin string inspectFuncListModels func(ctx context.Context, pageSize int64, pageToken string, isBasicView bool, filter filtering.Filter, uidAllowList []uuid.UUID, showDeleted bool, order ordering.OrderBy, visibility *modelpb.Model_Visibility) afterListModelsCounter uint64 beforeListModelsCounter uint64 ListModelsMock mRepositoryMockListModels funcListModelsAdmin func(ctx context.Context, pageSize int64, pageToken string, isBasicView bool, filter filtering.Filter, showDeleted bool) (mpa1 []*datamodel.Model, i1 int64, s1 string, err error) + funcListModelsAdminOrigin string inspectFuncListModelsAdmin func(ctx context.Context, pageSize int64, pageToken string, isBasicView bool, filter filtering.Filter, showDeleted bool) afterListModelsAdminCounter uint64 beforeListModelsAdminCounter uint64 ListModelsAdminMock mRepositoryMockListModelsAdmin funcListNamespaceModels func(ctx context.Context, ownerPermalink string, pageSize int64, pageToken string, isBasicView bool, filter filtering.Filter, uidAllowList []uuid.UUID, showDeleted bool, order ordering.OrderBy, visibility *modelpb.Model_Visibility) (models []*datamodel.Model, totalSize int64, nextPageToken string, err error) + funcListNamespaceModelsOrigin string inspectFuncListNamespaceModels func(ctx context.Context, ownerPermalink string, pageSize int64, pageToken string, isBasicView bool, filter filtering.Filter, uidAllowList []uuid.UUID, showDeleted bool, order ordering.OrderBy, visibility *modelpb.Model_Visibility) afterListNamespaceModelsCounter uint64 beforeListNamespaceModelsCounter uint64 ListNamespaceModelsMock mRepositoryMockListNamespaceModels funcPinUser func(ctx context.Context, table string) + funcPinUserOrigin string inspectFuncPinUser func(ctx context.Context, table string) afterPinUserCounter uint64 beforePinUserCounter uint64 PinUserMock mRepositoryMockPinUser funcUpdateModelRun func(ctx context.Context, modelRun *datamodel.ModelRun) (err error) + funcUpdateModelRunOrigin string inspectFuncUpdateModelRun func(ctx context.Context, modelRun *datamodel.ModelRun) afterUpdateModelRunCounter uint64 beforeUpdateModelRunCounter uint64 UpdateModelRunMock mRepositoryMockUpdateModelRun funcUpdateModelVersionDigestByID func(ctx context.Context, modelUID uuid.UUID, versionID string, digest string) (err error) + funcUpdateModelVersionDigestByIDOrigin string inspectFuncUpdateModelVersionDigestByID func(ctx context.Context, modelUID uuid.UUID, versionID string, digest string) afterUpdateModelVersionDigestByIDCounter uint64 beforeUpdateModelVersionDigestByIDCounter uint64 UpdateModelVersionDigestByIDMock mRepositoryMockUpdateModelVersionDigestByID funcUpdateNamespaceModelByID func(ctx context.Context, ownerPermalink string, id string, model *datamodel.Model) (err error) + funcUpdateNamespaceModelByIDOrigin string inspectFuncUpdateNamespaceModelByID func(ctx context.Context, ownerPermalink string, id string, model *datamodel.Model) afterUpdateNamespaceModelByIDCounter uint64 beforeUpdateNamespaceModelByIDCounter uint64 UpdateNamespaceModelByIDMock mRepositoryMockUpdateNamespaceModelByID funcUpdateNamespaceModelIDByID func(ctx context.Context, ownerPermalink string, id string, newID string) (err error) + funcUpdateNamespaceModelIDByIDOrigin string inspectFuncUpdateNamespaceModelIDByID func(ctx context.Context, ownerPermalink string, id string, newID string) afterUpdateNamespaceModelIDByIDCounter uint64 beforeUpdateNamespaceModelIDByIDCounter uint64 UpdateNamespaceModelIDByIDMock mRepositoryMockUpdateNamespaceModelIDByID } -// NewRepositoryMock returns a mock for repository.Repository +// NewRepositoryMock returns a mock for mm_repository.Repository func NewRepositoryMock(t minimock.Tester) *RepositoryMock { m := &RepositoryMock{t: t} @@ -286,6 +326,9 @@ func NewRepositoryMock(t minimock.Tester) *RepositoryMock { m.ListModelRunsMock = mRepositoryMockListModelRuns{mock: m} m.ListModelRunsMock.callArgs = []*RepositoryMockListModelRunsParams{} + m.ListModelRunsByCreditOwnerMock = mRepositoryMockListModelRunsByCreditOwner{mock: m} + m.ListModelRunsByCreditOwnerMock.callArgs = []*RepositoryMockListModelRunsByCreditOwnerParams{} + m.ListModelTagsMock = mRepositoryMockListModelTags{mock: m} m.ListModelTagsMock.callArgs = []*RepositoryMockListModelTagsParams{} @@ -333,16 +376,19 @@ type mRepositoryMockCheckPinnedUser struct { callArgs []*RepositoryMockCheckPinnedUserParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockCheckPinnedUserExpectation specifies expectation struct of the Repository.CheckPinnedUser type RepositoryMockCheckPinnedUserExpectation struct { - mock *RepositoryMock - params *RepositoryMockCheckPinnedUserParams - paramPtrs *RepositoryMockCheckPinnedUserParamPtrs - results *RepositoryMockCheckPinnedUserResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockCheckPinnedUserParams + paramPtrs *RepositoryMockCheckPinnedUserParamPtrs + expectationOrigins RepositoryMockCheckPinnedUserExpectationOrigins + results *RepositoryMockCheckPinnedUserResults + returnOrigin string + Counter uint64 } // RepositoryMockCheckPinnedUserParams contains parameters of the Repository.CheckPinnedUser @@ -364,6 +410,14 @@ type RepositoryMockCheckPinnedUserResults struct { dp1 *gorm.DB } +// RepositoryMockCheckPinnedUserOrigins contains origins of expectations of the Repository.CheckPinnedUser +type RepositoryMockCheckPinnedUserExpectationOrigins struct { + origin string + originCtx string + originDb string + originTable string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -389,6 +443,7 @@ func (mmCheckPinnedUser *mRepositoryMockCheckPinnedUser) Expect(ctx context.Cont } mmCheckPinnedUser.defaultExpectation.params = &RepositoryMockCheckPinnedUserParams{ctx, db, table} + mmCheckPinnedUser.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmCheckPinnedUser.expectations { if minimock.Equal(e.params, mmCheckPinnedUser.defaultExpectation.params) { mmCheckPinnedUser.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmCheckPinnedUser.defaultExpectation.params) @@ -416,6 +471,7 @@ func (mmCheckPinnedUser *mRepositoryMockCheckPinnedUser) ExpectCtxParam1(ctx con mmCheckPinnedUser.defaultExpectation.paramPtrs = &RepositoryMockCheckPinnedUserParamPtrs{} } mmCheckPinnedUser.defaultExpectation.paramPtrs.ctx = &ctx + mmCheckPinnedUser.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmCheckPinnedUser } @@ -438,6 +494,7 @@ func (mmCheckPinnedUser *mRepositoryMockCheckPinnedUser) ExpectDbParam2(db *gorm mmCheckPinnedUser.defaultExpectation.paramPtrs = &RepositoryMockCheckPinnedUserParamPtrs{} } mmCheckPinnedUser.defaultExpectation.paramPtrs.db = &db + mmCheckPinnedUser.defaultExpectation.expectationOrigins.originDb = minimock.CallerInfo(1) return mmCheckPinnedUser } @@ -460,6 +517,7 @@ func (mmCheckPinnedUser *mRepositoryMockCheckPinnedUser) ExpectTableParam3(table mmCheckPinnedUser.defaultExpectation.paramPtrs = &RepositoryMockCheckPinnedUserParamPtrs{} } mmCheckPinnedUser.defaultExpectation.paramPtrs.table = &table + mmCheckPinnedUser.defaultExpectation.expectationOrigins.originTable = minimock.CallerInfo(1) return mmCheckPinnedUser } @@ -485,6 +543,7 @@ func (mmCheckPinnedUser *mRepositoryMockCheckPinnedUser) Return(dp1 *gorm.DB) *R mmCheckPinnedUser.defaultExpectation = &RepositoryMockCheckPinnedUserExpectation{mock: mmCheckPinnedUser.mock} } mmCheckPinnedUser.defaultExpectation.results = &RepositoryMockCheckPinnedUserResults{dp1} + mmCheckPinnedUser.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmCheckPinnedUser.mock } @@ -499,6 +558,7 @@ func (mmCheckPinnedUser *mRepositoryMockCheckPinnedUser) Set(f func(ctx context. } mmCheckPinnedUser.mock.funcCheckPinnedUser = f + mmCheckPinnedUser.mock.funcCheckPinnedUserOrigin = minimock.CallerInfo(1) return mmCheckPinnedUser.mock } @@ -510,8 +570,9 @@ func (mmCheckPinnedUser *mRepositoryMockCheckPinnedUser) When(ctx context.Contex } expectation := &RepositoryMockCheckPinnedUserExpectation{ - mock: mmCheckPinnedUser.mock, - params: &RepositoryMockCheckPinnedUserParams{ctx, db, table}, + mock: mmCheckPinnedUser.mock, + params: &RepositoryMockCheckPinnedUserParams{ctx, db, table}, + expectationOrigins: RepositoryMockCheckPinnedUserExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmCheckPinnedUser.expectations = append(mmCheckPinnedUser.expectations, expectation) return expectation @@ -529,6 +590,7 @@ func (mmCheckPinnedUser *mRepositoryMockCheckPinnedUser) Times(n uint64) *mRepos mmCheckPinnedUser.mock.t.Fatalf("Times of RepositoryMock.CheckPinnedUser mock can not be zero") } mm_atomic.StoreUint64(&mmCheckPinnedUser.expectedInvocations, n) + mmCheckPinnedUser.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmCheckPinnedUser } @@ -543,11 +605,13 @@ func (mmCheckPinnedUser *mRepositoryMockCheckPinnedUser) invocationsDone() bool return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// CheckPinnedUser implements repository.Repository +// CheckPinnedUser implements mm_repository.Repository func (mmCheckPinnedUser *RepositoryMock) CheckPinnedUser(ctx context.Context, db *gorm.DB, table string) (dp1 *gorm.DB) { mm_atomic.AddUint64(&mmCheckPinnedUser.beforeCheckPinnedUserCounter, 1) defer mm_atomic.AddUint64(&mmCheckPinnedUser.afterCheckPinnedUserCounter, 1) + mmCheckPinnedUser.t.Helper() + if mmCheckPinnedUser.inspectFuncCheckPinnedUser != nil { mmCheckPinnedUser.inspectFuncCheckPinnedUser(ctx, db, table) } @@ -576,19 +640,23 @@ func (mmCheckPinnedUser *RepositoryMock) CheckPinnedUser(ctx context.Context, db if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmCheckPinnedUser.t.Errorf("RepositoryMock.CheckPinnedUser got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmCheckPinnedUser.t.Errorf("RepositoryMock.CheckPinnedUser got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmCheckPinnedUser.CheckPinnedUserMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.db != nil && !minimock.Equal(*mm_want_ptrs.db, mm_got.db) { - mmCheckPinnedUser.t.Errorf("RepositoryMock.CheckPinnedUser got unexpected parameter db, want: %#v, got: %#v%s\n", *mm_want_ptrs.db, mm_got.db, minimock.Diff(*mm_want_ptrs.db, mm_got.db)) + mmCheckPinnedUser.t.Errorf("RepositoryMock.CheckPinnedUser got unexpected parameter db, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmCheckPinnedUser.CheckPinnedUserMock.defaultExpectation.expectationOrigins.originDb, *mm_want_ptrs.db, mm_got.db, minimock.Diff(*mm_want_ptrs.db, mm_got.db)) } if mm_want_ptrs.table != nil && !minimock.Equal(*mm_want_ptrs.table, mm_got.table) { - mmCheckPinnedUser.t.Errorf("RepositoryMock.CheckPinnedUser got unexpected parameter table, want: %#v, got: %#v%s\n", *mm_want_ptrs.table, mm_got.table, minimock.Diff(*mm_want_ptrs.table, mm_got.table)) + mmCheckPinnedUser.t.Errorf("RepositoryMock.CheckPinnedUser got unexpected parameter table, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmCheckPinnedUser.CheckPinnedUserMock.defaultExpectation.expectationOrigins.originTable, *mm_want_ptrs.table, mm_got.table, minimock.Diff(*mm_want_ptrs.table, mm_got.table)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmCheckPinnedUser.t.Errorf("RepositoryMock.CheckPinnedUser got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmCheckPinnedUser.t.Errorf("RepositoryMock.CheckPinnedUser got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmCheckPinnedUser.CheckPinnedUserMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmCheckPinnedUser.CheckPinnedUserMock.defaultExpectation.results @@ -648,7 +716,7 @@ func (m *RepositoryMock) MinimockCheckPinnedUserDone() bool { func (m *RepositoryMock) MinimockCheckPinnedUserInspect() { for _, e := range m.CheckPinnedUserMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.CheckPinnedUser with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.CheckPinnedUser at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -656,19 +724,19 @@ func (m *RepositoryMock) MinimockCheckPinnedUserInspect() { // if default expectation was set then invocations count should be greater than zero if m.CheckPinnedUserMock.defaultExpectation != nil && afterCheckPinnedUserCounter < 1 { if m.CheckPinnedUserMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.CheckPinnedUser") + m.t.Errorf("Expected call to RepositoryMock.CheckPinnedUser at\n%s", m.CheckPinnedUserMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.CheckPinnedUser with params: %#v", *m.CheckPinnedUserMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.CheckPinnedUser at\n%s with params: %#v", m.CheckPinnedUserMock.defaultExpectation.expectationOrigins.origin, *m.CheckPinnedUserMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcCheckPinnedUser != nil && afterCheckPinnedUserCounter < 1 { - m.t.Error("Expected call to RepositoryMock.CheckPinnedUser") + m.t.Errorf("Expected call to RepositoryMock.CheckPinnedUser at\n%s", m.funcCheckPinnedUserOrigin) } if !m.CheckPinnedUserMock.invocationsDone() && afterCheckPinnedUserCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.CheckPinnedUser but found %d calls", - mm_atomic.LoadUint64(&m.CheckPinnedUserMock.expectedInvocations), afterCheckPinnedUserCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.CheckPinnedUser at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.CheckPinnedUserMock.expectedInvocations), m.CheckPinnedUserMock.expectedInvocationsOrigin, afterCheckPinnedUserCounter) } } @@ -681,16 +749,19 @@ type mRepositoryMockCreateModelRun struct { callArgs []*RepositoryMockCreateModelRunParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockCreateModelRunExpectation specifies expectation struct of the Repository.CreateModelRun type RepositoryMockCreateModelRunExpectation struct { - mock *RepositoryMock - params *RepositoryMockCreateModelRunParams - paramPtrs *RepositoryMockCreateModelRunParamPtrs - results *RepositoryMockCreateModelRunResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockCreateModelRunParams + paramPtrs *RepositoryMockCreateModelRunParamPtrs + expectationOrigins RepositoryMockCreateModelRunExpectationOrigins + results *RepositoryMockCreateModelRunResults + returnOrigin string + Counter uint64 } // RepositoryMockCreateModelRunParams contains parameters of the Repository.CreateModelRun @@ -711,6 +782,13 @@ type RepositoryMockCreateModelRunResults struct { err error } +// RepositoryMockCreateModelRunOrigins contains origins of expectations of the Repository.CreateModelRun +type RepositoryMockCreateModelRunExpectationOrigins struct { + origin string + originCtx string + originModelRun string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -736,6 +814,7 @@ func (mmCreateModelRun *mRepositoryMockCreateModelRun) Expect(ctx context.Contex } mmCreateModelRun.defaultExpectation.params = &RepositoryMockCreateModelRunParams{ctx, modelRun} + mmCreateModelRun.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmCreateModelRun.expectations { if minimock.Equal(e.params, mmCreateModelRun.defaultExpectation.params) { mmCreateModelRun.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmCreateModelRun.defaultExpectation.params) @@ -763,6 +842,7 @@ func (mmCreateModelRun *mRepositoryMockCreateModelRun) ExpectCtxParam1(ctx conte mmCreateModelRun.defaultExpectation.paramPtrs = &RepositoryMockCreateModelRunParamPtrs{} } mmCreateModelRun.defaultExpectation.paramPtrs.ctx = &ctx + mmCreateModelRun.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmCreateModelRun } @@ -785,6 +865,7 @@ func (mmCreateModelRun *mRepositoryMockCreateModelRun) ExpectModelRunParam2(mode mmCreateModelRun.defaultExpectation.paramPtrs = &RepositoryMockCreateModelRunParamPtrs{} } mmCreateModelRun.defaultExpectation.paramPtrs.modelRun = &modelRun + mmCreateModelRun.defaultExpectation.expectationOrigins.originModelRun = minimock.CallerInfo(1) return mmCreateModelRun } @@ -810,6 +891,7 @@ func (mmCreateModelRun *mRepositoryMockCreateModelRun) Return(mp1 *datamodel.Mod mmCreateModelRun.defaultExpectation = &RepositoryMockCreateModelRunExpectation{mock: mmCreateModelRun.mock} } mmCreateModelRun.defaultExpectation.results = &RepositoryMockCreateModelRunResults{mp1, err} + mmCreateModelRun.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmCreateModelRun.mock } @@ -824,6 +906,7 @@ func (mmCreateModelRun *mRepositoryMockCreateModelRun) Set(f func(ctx context.Co } mmCreateModelRun.mock.funcCreateModelRun = f + mmCreateModelRun.mock.funcCreateModelRunOrigin = minimock.CallerInfo(1) return mmCreateModelRun.mock } @@ -835,8 +918,9 @@ func (mmCreateModelRun *mRepositoryMockCreateModelRun) When(ctx context.Context, } expectation := &RepositoryMockCreateModelRunExpectation{ - mock: mmCreateModelRun.mock, - params: &RepositoryMockCreateModelRunParams{ctx, modelRun}, + mock: mmCreateModelRun.mock, + params: &RepositoryMockCreateModelRunParams{ctx, modelRun}, + expectationOrigins: RepositoryMockCreateModelRunExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmCreateModelRun.expectations = append(mmCreateModelRun.expectations, expectation) return expectation @@ -854,6 +938,7 @@ func (mmCreateModelRun *mRepositoryMockCreateModelRun) Times(n uint64) *mReposit mmCreateModelRun.mock.t.Fatalf("Times of RepositoryMock.CreateModelRun mock can not be zero") } mm_atomic.StoreUint64(&mmCreateModelRun.expectedInvocations, n) + mmCreateModelRun.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmCreateModelRun } @@ -868,11 +953,13 @@ func (mmCreateModelRun *mRepositoryMockCreateModelRun) invocationsDone() bool { return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// CreateModelRun implements repository.Repository +// CreateModelRun implements mm_repository.Repository func (mmCreateModelRun *RepositoryMock) CreateModelRun(ctx context.Context, modelRun *datamodel.ModelRun) (mp1 *datamodel.ModelRun, err error) { mm_atomic.AddUint64(&mmCreateModelRun.beforeCreateModelRunCounter, 1) defer mm_atomic.AddUint64(&mmCreateModelRun.afterCreateModelRunCounter, 1) + mmCreateModelRun.t.Helper() + if mmCreateModelRun.inspectFuncCreateModelRun != nil { mmCreateModelRun.inspectFuncCreateModelRun(ctx, modelRun) } @@ -901,15 +988,18 @@ func (mmCreateModelRun *RepositoryMock) CreateModelRun(ctx context.Context, mode if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmCreateModelRun.t.Errorf("RepositoryMock.CreateModelRun got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmCreateModelRun.t.Errorf("RepositoryMock.CreateModelRun got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmCreateModelRun.CreateModelRunMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.modelRun != nil && !minimock.Equal(*mm_want_ptrs.modelRun, mm_got.modelRun) { - mmCreateModelRun.t.Errorf("RepositoryMock.CreateModelRun got unexpected parameter modelRun, want: %#v, got: %#v%s\n", *mm_want_ptrs.modelRun, mm_got.modelRun, minimock.Diff(*mm_want_ptrs.modelRun, mm_got.modelRun)) + mmCreateModelRun.t.Errorf("RepositoryMock.CreateModelRun got unexpected parameter modelRun, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmCreateModelRun.CreateModelRunMock.defaultExpectation.expectationOrigins.originModelRun, *mm_want_ptrs.modelRun, mm_got.modelRun, minimock.Diff(*mm_want_ptrs.modelRun, mm_got.modelRun)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmCreateModelRun.t.Errorf("RepositoryMock.CreateModelRun got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmCreateModelRun.t.Errorf("RepositoryMock.CreateModelRun got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmCreateModelRun.CreateModelRunMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmCreateModelRun.CreateModelRunMock.defaultExpectation.results @@ -969,7 +1059,7 @@ func (m *RepositoryMock) MinimockCreateModelRunDone() bool { func (m *RepositoryMock) MinimockCreateModelRunInspect() { for _, e := range m.CreateModelRunMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.CreateModelRun with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.CreateModelRun at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -977,19 +1067,19 @@ func (m *RepositoryMock) MinimockCreateModelRunInspect() { // if default expectation was set then invocations count should be greater than zero if m.CreateModelRunMock.defaultExpectation != nil && afterCreateModelRunCounter < 1 { if m.CreateModelRunMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.CreateModelRun") + m.t.Errorf("Expected call to RepositoryMock.CreateModelRun at\n%s", m.CreateModelRunMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.CreateModelRun with params: %#v", *m.CreateModelRunMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.CreateModelRun at\n%s with params: %#v", m.CreateModelRunMock.defaultExpectation.expectationOrigins.origin, *m.CreateModelRunMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcCreateModelRun != nil && afterCreateModelRunCounter < 1 { - m.t.Error("Expected call to RepositoryMock.CreateModelRun") + m.t.Errorf("Expected call to RepositoryMock.CreateModelRun at\n%s", m.funcCreateModelRunOrigin) } if !m.CreateModelRunMock.invocationsDone() && afterCreateModelRunCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.CreateModelRun but found %d calls", - mm_atomic.LoadUint64(&m.CreateModelRunMock.expectedInvocations), afterCreateModelRunCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.CreateModelRun at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.CreateModelRunMock.expectedInvocations), m.CreateModelRunMock.expectedInvocationsOrigin, afterCreateModelRunCounter) } } @@ -1002,16 +1092,19 @@ type mRepositoryMockCreateModelTags struct { callArgs []*RepositoryMockCreateModelTagsParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockCreateModelTagsExpectation specifies expectation struct of the Repository.CreateModelTags type RepositoryMockCreateModelTagsExpectation struct { - mock *RepositoryMock - params *RepositoryMockCreateModelTagsParams - paramPtrs *RepositoryMockCreateModelTagsParamPtrs - results *RepositoryMockCreateModelTagsResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockCreateModelTagsParams + paramPtrs *RepositoryMockCreateModelTagsParamPtrs + expectationOrigins RepositoryMockCreateModelTagsExpectationOrigins + results *RepositoryMockCreateModelTagsResults + returnOrigin string + Counter uint64 } // RepositoryMockCreateModelTagsParams contains parameters of the Repository.CreateModelTags @@ -1033,6 +1126,14 @@ type RepositoryMockCreateModelTagsResults struct { err error } +// RepositoryMockCreateModelTagsOrigins contains origins of expectations of the Repository.CreateModelTags +type RepositoryMockCreateModelTagsExpectationOrigins struct { + origin string + originCtx string + originModelUID string + originTagNames string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -1058,6 +1159,7 @@ func (mmCreateModelTags *mRepositoryMockCreateModelTags) Expect(ctx context.Cont } mmCreateModelTags.defaultExpectation.params = &RepositoryMockCreateModelTagsParams{ctx, modelUID, tagNames} + mmCreateModelTags.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmCreateModelTags.expectations { if minimock.Equal(e.params, mmCreateModelTags.defaultExpectation.params) { mmCreateModelTags.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmCreateModelTags.defaultExpectation.params) @@ -1085,6 +1187,7 @@ func (mmCreateModelTags *mRepositoryMockCreateModelTags) ExpectCtxParam1(ctx con mmCreateModelTags.defaultExpectation.paramPtrs = &RepositoryMockCreateModelTagsParamPtrs{} } mmCreateModelTags.defaultExpectation.paramPtrs.ctx = &ctx + mmCreateModelTags.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmCreateModelTags } @@ -1107,6 +1210,7 @@ func (mmCreateModelTags *mRepositoryMockCreateModelTags) ExpectModelUIDParam2(mo mmCreateModelTags.defaultExpectation.paramPtrs = &RepositoryMockCreateModelTagsParamPtrs{} } mmCreateModelTags.defaultExpectation.paramPtrs.modelUID = &modelUID + mmCreateModelTags.defaultExpectation.expectationOrigins.originModelUID = minimock.CallerInfo(1) return mmCreateModelTags } @@ -1129,6 +1233,7 @@ func (mmCreateModelTags *mRepositoryMockCreateModelTags) ExpectTagNamesParam3(ta mmCreateModelTags.defaultExpectation.paramPtrs = &RepositoryMockCreateModelTagsParamPtrs{} } mmCreateModelTags.defaultExpectation.paramPtrs.tagNames = &tagNames + mmCreateModelTags.defaultExpectation.expectationOrigins.originTagNames = minimock.CallerInfo(1) return mmCreateModelTags } @@ -1154,6 +1259,7 @@ func (mmCreateModelTags *mRepositoryMockCreateModelTags) Return(err error) *Repo mmCreateModelTags.defaultExpectation = &RepositoryMockCreateModelTagsExpectation{mock: mmCreateModelTags.mock} } mmCreateModelTags.defaultExpectation.results = &RepositoryMockCreateModelTagsResults{err} + mmCreateModelTags.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmCreateModelTags.mock } @@ -1168,6 +1274,7 @@ func (mmCreateModelTags *mRepositoryMockCreateModelTags) Set(f func(ctx context. } mmCreateModelTags.mock.funcCreateModelTags = f + mmCreateModelTags.mock.funcCreateModelTagsOrigin = minimock.CallerInfo(1) return mmCreateModelTags.mock } @@ -1179,8 +1286,9 @@ func (mmCreateModelTags *mRepositoryMockCreateModelTags) When(ctx context.Contex } expectation := &RepositoryMockCreateModelTagsExpectation{ - mock: mmCreateModelTags.mock, - params: &RepositoryMockCreateModelTagsParams{ctx, modelUID, tagNames}, + mock: mmCreateModelTags.mock, + params: &RepositoryMockCreateModelTagsParams{ctx, modelUID, tagNames}, + expectationOrigins: RepositoryMockCreateModelTagsExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmCreateModelTags.expectations = append(mmCreateModelTags.expectations, expectation) return expectation @@ -1198,6 +1306,7 @@ func (mmCreateModelTags *mRepositoryMockCreateModelTags) Times(n uint64) *mRepos mmCreateModelTags.mock.t.Fatalf("Times of RepositoryMock.CreateModelTags mock can not be zero") } mm_atomic.StoreUint64(&mmCreateModelTags.expectedInvocations, n) + mmCreateModelTags.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmCreateModelTags } @@ -1212,11 +1321,13 @@ func (mmCreateModelTags *mRepositoryMockCreateModelTags) invocationsDone() bool return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// CreateModelTags implements repository.Repository +// CreateModelTags implements mm_repository.Repository func (mmCreateModelTags *RepositoryMock) CreateModelTags(ctx context.Context, modelUID uuid.UUID, tagNames []string) (err error) { mm_atomic.AddUint64(&mmCreateModelTags.beforeCreateModelTagsCounter, 1) defer mm_atomic.AddUint64(&mmCreateModelTags.afterCreateModelTagsCounter, 1) + mmCreateModelTags.t.Helper() + if mmCreateModelTags.inspectFuncCreateModelTags != nil { mmCreateModelTags.inspectFuncCreateModelTags(ctx, modelUID, tagNames) } @@ -1245,19 +1356,23 @@ func (mmCreateModelTags *RepositoryMock) CreateModelTags(ctx context.Context, mo if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmCreateModelTags.t.Errorf("RepositoryMock.CreateModelTags got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmCreateModelTags.t.Errorf("RepositoryMock.CreateModelTags got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmCreateModelTags.CreateModelTagsMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.modelUID != nil && !minimock.Equal(*mm_want_ptrs.modelUID, mm_got.modelUID) { - mmCreateModelTags.t.Errorf("RepositoryMock.CreateModelTags got unexpected parameter modelUID, want: %#v, got: %#v%s\n", *mm_want_ptrs.modelUID, mm_got.modelUID, minimock.Diff(*mm_want_ptrs.modelUID, mm_got.modelUID)) + mmCreateModelTags.t.Errorf("RepositoryMock.CreateModelTags got unexpected parameter modelUID, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmCreateModelTags.CreateModelTagsMock.defaultExpectation.expectationOrigins.originModelUID, *mm_want_ptrs.modelUID, mm_got.modelUID, minimock.Diff(*mm_want_ptrs.modelUID, mm_got.modelUID)) } if mm_want_ptrs.tagNames != nil && !minimock.Equal(*mm_want_ptrs.tagNames, mm_got.tagNames) { - mmCreateModelTags.t.Errorf("RepositoryMock.CreateModelTags got unexpected parameter tagNames, want: %#v, got: %#v%s\n", *mm_want_ptrs.tagNames, mm_got.tagNames, minimock.Diff(*mm_want_ptrs.tagNames, mm_got.tagNames)) + mmCreateModelTags.t.Errorf("RepositoryMock.CreateModelTags got unexpected parameter tagNames, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmCreateModelTags.CreateModelTagsMock.defaultExpectation.expectationOrigins.originTagNames, *mm_want_ptrs.tagNames, mm_got.tagNames, minimock.Diff(*mm_want_ptrs.tagNames, mm_got.tagNames)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmCreateModelTags.t.Errorf("RepositoryMock.CreateModelTags got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmCreateModelTags.t.Errorf("RepositoryMock.CreateModelTags got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmCreateModelTags.CreateModelTagsMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmCreateModelTags.CreateModelTagsMock.defaultExpectation.results @@ -1317,7 +1432,7 @@ func (m *RepositoryMock) MinimockCreateModelTagsDone() bool { func (m *RepositoryMock) MinimockCreateModelTagsInspect() { for _, e := range m.CreateModelTagsMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.CreateModelTags with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.CreateModelTags at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -1325,19 +1440,19 @@ func (m *RepositoryMock) MinimockCreateModelTagsInspect() { // if default expectation was set then invocations count should be greater than zero if m.CreateModelTagsMock.defaultExpectation != nil && afterCreateModelTagsCounter < 1 { if m.CreateModelTagsMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.CreateModelTags") + m.t.Errorf("Expected call to RepositoryMock.CreateModelTags at\n%s", m.CreateModelTagsMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.CreateModelTags with params: %#v", *m.CreateModelTagsMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.CreateModelTags at\n%s with params: %#v", m.CreateModelTagsMock.defaultExpectation.expectationOrigins.origin, *m.CreateModelTagsMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcCreateModelTags != nil && afterCreateModelTagsCounter < 1 { - m.t.Error("Expected call to RepositoryMock.CreateModelTags") + m.t.Errorf("Expected call to RepositoryMock.CreateModelTags at\n%s", m.funcCreateModelTagsOrigin) } if !m.CreateModelTagsMock.invocationsDone() && afterCreateModelTagsCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.CreateModelTags but found %d calls", - mm_atomic.LoadUint64(&m.CreateModelTagsMock.expectedInvocations), afterCreateModelTagsCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.CreateModelTags at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.CreateModelTagsMock.expectedInvocations), m.CreateModelTagsMock.expectedInvocationsOrigin, afterCreateModelTagsCounter) } } @@ -1350,16 +1465,19 @@ type mRepositoryMockCreateModelVersion struct { callArgs []*RepositoryMockCreateModelVersionParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockCreateModelVersionExpectation specifies expectation struct of the Repository.CreateModelVersion type RepositoryMockCreateModelVersionExpectation struct { - mock *RepositoryMock - params *RepositoryMockCreateModelVersionParams - paramPtrs *RepositoryMockCreateModelVersionParamPtrs - results *RepositoryMockCreateModelVersionResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockCreateModelVersionParams + paramPtrs *RepositoryMockCreateModelVersionParamPtrs + expectationOrigins RepositoryMockCreateModelVersionExpectationOrigins + results *RepositoryMockCreateModelVersionResults + returnOrigin string + Counter uint64 } // RepositoryMockCreateModelVersionParams contains parameters of the Repository.CreateModelVersion @@ -1381,6 +1499,14 @@ type RepositoryMockCreateModelVersionResults struct { err error } +// RepositoryMockCreateModelVersionOrigins contains origins of expectations of the Repository.CreateModelVersion +type RepositoryMockCreateModelVersionExpectationOrigins struct { + origin string + originCtx string + originOwnerPermalink string + originVersion string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -1406,6 +1532,7 @@ func (mmCreateModelVersion *mRepositoryMockCreateModelVersion) Expect(ctx contex } mmCreateModelVersion.defaultExpectation.params = &RepositoryMockCreateModelVersionParams{ctx, ownerPermalink, version} + mmCreateModelVersion.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmCreateModelVersion.expectations { if minimock.Equal(e.params, mmCreateModelVersion.defaultExpectation.params) { mmCreateModelVersion.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmCreateModelVersion.defaultExpectation.params) @@ -1433,6 +1560,7 @@ func (mmCreateModelVersion *mRepositoryMockCreateModelVersion) ExpectCtxParam1(c mmCreateModelVersion.defaultExpectation.paramPtrs = &RepositoryMockCreateModelVersionParamPtrs{} } mmCreateModelVersion.defaultExpectation.paramPtrs.ctx = &ctx + mmCreateModelVersion.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmCreateModelVersion } @@ -1455,6 +1583,7 @@ func (mmCreateModelVersion *mRepositoryMockCreateModelVersion) ExpectOwnerPermal mmCreateModelVersion.defaultExpectation.paramPtrs = &RepositoryMockCreateModelVersionParamPtrs{} } mmCreateModelVersion.defaultExpectation.paramPtrs.ownerPermalink = &ownerPermalink + mmCreateModelVersion.defaultExpectation.expectationOrigins.originOwnerPermalink = minimock.CallerInfo(1) return mmCreateModelVersion } @@ -1477,6 +1606,7 @@ func (mmCreateModelVersion *mRepositoryMockCreateModelVersion) ExpectVersionPara mmCreateModelVersion.defaultExpectation.paramPtrs = &RepositoryMockCreateModelVersionParamPtrs{} } mmCreateModelVersion.defaultExpectation.paramPtrs.version = &version + mmCreateModelVersion.defaultExpectation.expectationOrigins.originVersion = minimock.CallerInfo(1) return mmCreateModelVersion } @@ -1502,6 +1632,7 @@ func (mmCreateModelVersion *mRepositoryMockCreateModelVersion) Return(err error) mmCreateModelVersion.defaultExpectation = &RepositoryMockCreateModelVersionExpectation{mock: mmCreateModelVersion.mock} } mmCreateModelVersion.defaultExpectation.results = &RepositoryMockCreateModelVersionResults{err} + mmCreateModelVersion.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmCreateModelVersion.mock } @@ -1516,6 +1647,7 @@ func (mmCreateModelVersion *mRepositoryMockCreateModelVersion) Set(f func(ctx co } mmCreateModelVersion.mock.funcCreateModelVersion = f + mmCreateModelVersion.mock.funcCreateModelVersionOrigin = minimock.CallerInfo(1) return mmCreateModelVersion.mock } @@ -1527,8 +1659,9 @@ func (mmCreateModelVersion *mRepositoryMockCreateModelVersion) When(ctx context. } expectation := &RepositoryMockCreateModelVersionExpectation{ - mock: mmCreateModelVersion.mock, - params: &RepositoryMockCreateModelVersionParams{ctx, ownerPermalink, version}, + mock: mmCreateModelVersion.mock, + params: &RepositoryMockCreateModelVersionParams{ctx, ownerPermalink, version}, + expectationOrigins: RepositoryMockCreateModelVersionExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmCreateModelVersion.expectations = append(mmCreateModelVersion.expectations, expectation) return expectation @@ -1546,6 +1679,7 @@ func (mmCreateModelVersion *mRepositoryMockCreateModelVersion) Times(n uint64) * mmCreateModelVersion.mock.t.Fatalf("Times of RepositoryMock.CreateModelVersion mock can not be zero") } mm_atomic.StoreUint64(&mmCreateModelVersion.expectedInvocations, n) + mmCreateModelVersion.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmCreateModelVersion } @@ -1560,11 +1694,13 @@ func (mmCreateModelVersion *mRepositoryMockCreateModelVersion) invocationsDone() return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// CreateModelVersion implements repository.Repository +// CreateModelVersion implements mm_repository.Repository func (mmCreateModelVersion *RepositoryMock) CreateModelVersion(ctx context.Context, ownerPermalink string, version *datamodel.ModelVersion) (err error) { mm_atomic.AddUint64(&mmCreateModelVersion.beforeCreateModelVersionCounter, 1) defer mm_atomic.AddUint64(&mmCreateModelVersion.afterCreateModelVersionCounter, 1) + mmCreateModelVersion.t.Helper() + if mmCreateModelVersion.inspectFuncCreateModelVersion != nil { mmCreateModelVersion.inspectFuncCreateModelVersion(ctx, ownerPermalink, version) } @@ -1593,19 +1729,23 @@ func (mmCreateModelVersion *RepositoryMock) CreateModelVersion(ctx context.Conte if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmCreateModelVersion.t.Errorf("RepositoryMock.CreateModelVersion got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmCreateModelVersion.t.Errorf("RepositoryMock.CreateModelVersion got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmCreateModelVersion.CreateModelVersionMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.ownerPermalink != nil && !minimock.Equal(*mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink) { - mmCreateModelVersion.t.Errorf("RepositoryMock.CreateModelVersion got unexpected parameter ownerPermalink, want: %#v, got: %#v%s\n", *mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink, minimock.Diff(*mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink)) + mmCreateModelVersion.t.Errorf("RepositoryMock.CreateModelVersion got unexpected parameter ownerPermalink, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmCreateModelVersion.CreateModelVersionMock.defaultExpectation.expectationOrigins.originOwnerPermalink, *mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink, minimock.Diff(*mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink)) } if mm_want_ptrs.version != nil && !minimock.Equal(*mm_want_ptrs.version, mm_got.version) { - mmCreateModelVersion.t.Errorf("RepositoryMock.CreateModelVersion got unexpected parameter version, want: %#v, got: %#v%s\n", *mm_want_ptrs.version, mm_got.version, minimock.Diff(*mm_want_ptrs.version, mm_got.version)) + mmCreateModelVersion.t.Errorf("RepositoryMock.CreateModelVersion got unexpected parameter version, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmCreateModelVersion.CreateModelVersionMock.defaultExpectation.expectationOrigins.originVersion, *mm_want_ptrs.version, mm_got.version, minimock.Diff(*mm_want_ptrs.version, mm_got.version)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmCreateModelVersion.t.Errorf("RepositoryMock.CreateModelVersion got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmCreateModelVersion.t.Errorf("RepositoryMock.CreateModelVersion got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmCreateModelVersion.CreateModelVersionMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmCreateModelVersion.CreateModelVersionMock.defaultExpectation.results @@ -1665,7 +1805,7 @@ func (m *RepositoryMock) MinimockCreateModelVersionDone() bool { func (m *RepositoryMock) MinimockCreateModelVersionInspect() { for _, e := range m.CreateModelVersionMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.CreateModelVersion with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.CreateModelVersion at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -1673,19 +1813,19 @@ func (m *RepositoryMock) MinimockCreateModelVersionInspect() { // if default expectation was set then invocations count should be greater than zero if m.CreateModelVersionMock.defaultExpectation != nil && afterCreateModelVersionCounter < 1 { if m.CreateModelVersionMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.CreateModelVersion") + m.t.Errorf("Expected call to RepositoryMock.CreateModelVersion at\n%s", m.CreateModelVersionMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.CreateModelVersion with params: %#v", *m.CreateModelVersionMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.CreateModelVersion at\n%s with params: %#v", m.CreateModelVersionMock.defaultExpectation.expectationOrigins.origin, *m.CreateModelVersionMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcCreateModelVersion != nil && afterCreateModelVersionCounter < 1 { - m.t.Error("Expected call to RepositoryMock.CreateModelVersion") + m.t.Errorf("Expected call to RepositoryMock.CreateModelVersion at\n%s", m.funcCreateModelVersionOrigin) } if !m.CreateModelVersionMock.invocationsDone() && afterCreateModelVersionCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.CreateModelVersion but found %d calls", - mm_atomic.LoadUint64(&m.CreateModelVersionMock.expectedInvocations), afterCreateModelVersionCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.CreateModelVersion at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.CreateModelVersionMock.expectedInvocations), m.CreateModelVersionMock.expectedInvocationsOrigin, afterCreateModelVersionCounter) } } @@ -1698,16 +1838,19 @@ type mRepositoryMockCreateNamespaceModel struct { callArgs []*RepositoryMockCreateNamespaceModelParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockCreateNamespaceModelExpectation specifies expectation struct of the Repository.CreateNamespaceModel type RepositoryMockCreateNamespaceModelExpectation struct { - mock *RepositoryMock - params *RepositoryMockCreateNamespaceModelParams - paramPtrs *RepositoryMockCreateNamespaceModelParamPtrs - results *RepositoryMockCreateNamespaceModelResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockCreateNamespaceModelParams + paramPtrs *RepositoryMockCreateNamespaceModelParamPtrs + expectationOrigins RepositoryMockCreateNamespaceModelExpectationOrigins + results *RepositoryMockCreateNamespaceModelResults + returnOrigin string + Counter uint64 } // RepositoryMockCreateNamespaceModelParams contains parameters of the Repository.CreateNamespaceModel @@ -1729,6 +1872,14 @@ type RepositoryMockCreateNamespaceModelResults struct { err error } +// RepositoryMockCreateNamespaceModelOrigins contains origins of expectations of the Repository.CreateNamespaceModel +type RepositoryMockCreateNamespaceModelExpectationOrigins struct { + origin string + originCtx string + originOwnerPermalink string + originModel string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -1754,6 +1905,7 @@ func (mmCreateNamespaceModel *mRepositoryMockCreateNamespaceModel) Expect(ctx co } mmCreateNamespaceModel.defaultExpectation.params = &RepositoryMockCreateNamespaceModelParams{ctx, ownerPermalink, model} + mmCreateNamespaceModel.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmCreateNamespaceModel.expectations { if minimock.Equal(e.params, mmCreateNamespaceModel.defaultExpectation.params) { mmCreateNamespaceModel.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmCreateNamespaceModel.defaultExpectation.params) @@ -1781,6 +1933,7 @@ func (mmCreateNamespaceModel *mRepositoryMockCreateNamespaceModel) ExpectCtxPara mmCreateNamespaceModel.defaultExpectation.paramPtrs = &RepositoryMockCreateNamespaceModelParamPtrs{} } mmCreateNamespaceModel.defaultExpectation.paramPtrs.ctx = &ctx + mmCreateNamespaceModel.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmCreateNamespaceModel } @@ -1803,6 +1956,7 @@ func (mmCreateNamespaceModel *mRepositoryMockCreateNamespaceModel) ExpectOwnerPe mmCreateNamespaceModel.defaultExpectation.paramPtrs = &RepositoryMockCreateNamespaceModelParamPtrs{} } mmCreateNamespaceModel.defaultExpectation.paramPtrs.ownerPermalink = &ownerPermalink + mmCreateNamespaceModel.defaultExpectation.expectationOrigins.originOwnerPermalink = minimock.CallerInfo(1) return mmCreateNamespaceModel } @@ -1825,6 +1979,7 @@ func (mmCreateNamespaceModel *mRepositoryMockCreateNamespaceModel) ExpectModelPa mmCreateNamespaceModel.defaultExpectation.paramPtrs = &RepositoryMockCreateNamespaceModelParamPtrs{} } mmCreateNamespaceModel.defaultExpectation.paramPtrs.model = &model + mmCreateNamespaceModel.defaultExpectation.expectationOrigins.originModel = minimock.CallerInfo(1) return mmCreateNamespaceModel } @@ -1850,6 +2005,7 @@ func (mmCreateNamespaceModel *mRepositoryMockCreateNamespaceModel) Return(err er mmCreateNamespaceModel.defaultExpectation = &RepositoryMockCreateNamespaceModelExpectation{mock: mmCreateNamespaceModel.mock} } mmCreateNamespaceModel.defaultExpectation.results = &RepositoryMockCreateNamespaceModelResults{err} + mmCreateNamespaceModel.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmCreateNamespaceModel.mock } @@ -1864,6 +2020,7 @@ func (mmCreateNamespaceModel *mRepositoryMockCreateNamespaceModel) Set(f func(ct } mmCreateNamespaceModel.mock.funcCreateNamespaceModel = f + mmCreateNamespaceModel.mock.funcCreateNamespaceModelOrigin = minimock.CallerInfo(1) return mmCreateNamespaceModel.mock } @@ -1875,8 +2032,9 @@ func (mmCreateNamespaceModel *mRepositoryMockCreateNamespaceModel) When(ctx cont } expectation := &RepositoryMockCreateNamespaceModelExpectation{ - mock: mmCreateNamespaceModel.mock, - params: &RepositoryMockCreateNamespaceModelParams{ctx, ownerPermalink, model}, + mock: mmCreateNamespaceModel.mock, + params: &RepositoryMockCreateNamespaceModelParams{ctx, ownerPermalink, model}, + expectationOrigins: RepositoryMockCreateNamespaceModelExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmCreateNamespaceModel.expectations = append(mmCreateNamespaceModel.expectations, expectation) return expectation @@ -1894,6 +2052,7 @@ func (mmCreateNamespaceModel *mRepositoryMockCreateNamespaceModel) Times(n uint6 mmCreateNamespaceModel.mock.t.Fatalf("Times of RepositoryMock.CreateNamespaceModel mock can not be zero") } mm_atomic.StoreUint64(&mmCreateNamespaceModel.expectedInvocations, n) + mmCreateNamespaceModel.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmCreateNamespaceModel } @@ -1908,11 +2067,13 @@ func (mmCreateNamespaceModel *mRepositoryMockCreateNamespaceModel) invocationsDo return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// CreateNamespaceModel implements repository.Repository +// CreateNamespaceModel implements mm_repository.Repository func (mmCreateNamespaceModel *RepositoryMock) CreateNamespaceModel(ctx context.Context, ownerPermalink string, model *datamodel.Model) (err error) { mm_atomic.AddUint64(&mmCreateNamespaceModel.beforeCreateNamespaceModelCounter, 1) defer mm_atomic.AddUint64(&mmCreateNamespaceModel.afterCreateNamespaceModelCounter, 1) + mmCreateNamespaceModel.t.Helper() + if mmCreateNamespaceModel.inspectFuncCreateNamespaceModel != nil { mmCreateNamespaceModel.inspectFuncCreateNamespaceModel(ctx, ownerPermalink, model) } @@ -1941,19 +2102,23 @@ func (mmCreateNamespaceModel *RepositoryMock) CreateNamespaceModel(ctx context.C if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmCreateNamespaceModel.t.Errorf("RepositoryMock.CreateNamespaceModel got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmCreateNamespaceModel.t.Errorf("RepositoryMock.CreateNamespaceModel got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmCreateNamespaceModel.CreateNamespaceModelMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.ownerPermalink != nil && !minimock.Equal(*mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink) { - mmCreateNamespaceModel.t.Errorf("RepositoryMock.CreateNamespaceModel got unexpected parameter ownerPermalink, want: %#v, got: %#v%s\n", *mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink, minimock.Diff(*mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink)) + mmCreateNamespaceModel.t.Errorf("RepositoryMock.CreateNamespaceModel got unexpected parameter ownerPermalink, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmCreateNamespaceModel.CreateNamespaceModelMock.defaultExpectation.expectationOrigins.originOwnerPermalink, *mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink, minimock.Diff(*mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink)) } if mm_want_ptrs.model != nil && !minimock.Equal(*mm_want_ptrs.model, mm_got.model) { - mmCreateNamespaceModel.t.Errorf("RepositoryMock.CreateNamespaceModel got unexpected parameter model, want: %#v, got: %#v%s\n", *mm_want_ptrs.model, mm_got.model, minimock.Diff(*mm_want_ptrs.model, mm_got.model)) + mmCreateNamespaceModel.t.Errorf("RepositoryMock.CreateNamespaceModel got unexpected parameter model, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmCreateNamespaceModel.CreateNamespaceModelMock.defaultExpectation.expectationOrigins.originModel, *mm_want_ptrs.model, mm_got.model, minimock.Diff(*mm_want_ptrs.model, mm_got.model)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmCreateNamespaceModel.t.Errorf("RepositoryMock.CreateNamespaceModel got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmCreateNamespaceModel.t.Errorf("RepositoryMock.CreateNamespaceModel got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmCreateNamespaceModel.CreateNamespaceModelMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmCreateNamespaceModel.CreateNamespaceModelMock.defaultExpectation.results @@ -2013,7 +2178,7 @@ func (m *RepositoryMock) MinimockCreateNamespaceModelDone() bool { func (m *RepositoryMock) MinimockCreateNamespaceModelInspect() { for _, e := range m.CreateNamespaceModelMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.CreateNamespaceModel with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.CreateNamespaceModel at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -2021,19 +2186,19 @@ func (m *RepositoryMock) MinimockCreateNamespaceModelInspect() { // if default expectation was set then invocations count should be greater than zero if m.CreateNamespaceModelMock.defaultExpectation != nil && afterCreateNamespaceModelCounter < 1 { if m.CreateNamespaceModelMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.CreateNamespaceModel") + m.t.Errorf("Expected call to RepositoryMock.CreateNamespaceModel at\n%s", m.CreateNamespaceModelMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.CreateNamespaceModel with params: %#v", *m.CreateNamespaceModelMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.CreateNamespaceModel at\n%s with params: %#v", m.CreateNamespaceModelMock.defaultExpectation.expectationOrigins.origin, *m.CreateNamespaceModelMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcCreateNamespaceModel != nil && afterCreateNamespaceModelCounter < 1 { - m.t.Error("Expected call to RepositoryMock.CreateNamespaceModel") + m.t.Errorf("Expected call to RepositoryMock.CreateNamespaceModel at\n%s", m.funcCreateNamespaceModelOrigin) } if !m.CreateNamespaceModelMock.invocationsDone() && afterCreateNamespaceModelCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.CreateNamespaceModel but found %d calls", - mm_atomic.LoadUint64(&m.CreateNamespaceModelMock.expectedInvocations), afterCreateNamespaceModelCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.CreateNamespaceModel at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.CreateNamespaceModelMock.expectedInvocations), m.CreateNamespaceModelMock.expectedInvocationsOrigin, afterCreateNamespaceModelCounter) } } @@ -2046,16 +2211,19 @@ type mRepositoryMockDeleteModelTags struct { callArgs []*RepositoryMockDeleteModelTagsParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockDeleteModelTagsExpectation specifies expectation struct of the Repository.DeleteModelTags type RepositoryMockDeleteModelTagsExpectation struct { - mock *RepositoryMock - params *RepositoryMockDeleteModelTagsParams - paramPtrs *RepositoryMockDeleteModelTagsParamPtrs - results *RepositoryMockDeleteModelTagsResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockDeleteModelTagsParams + paramPtrs *RepositoryMockDeleteModelTagsParamPtrs + expectationOrigins RepositoryMockDeleteModelTagsExpectationOrigins + results *RepositoryMockDeleteModelTagsResults + returnOrigin string + Counter uint64 } // RepositoryMockDeleteModelTagsParams contains parameters of the Repository.DeleteModelTags @@ -2077,6 +2245,14 @@ type RepositoryMockDeleteModelTagsResults struct { err error } +// RepositoryMockDeleteModelTagsOrigins contains origins of expectations of the Repository.DeleteModelTags +type RepositoryMockDeleteModelTagsExpectationOrigins struct { + origin string + originCtx string + originModelUID string + originTagNames string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -2102,6 +2278,7 @@ func (mmDeleteModelTags *mRepositoryMockDeleteModelTags) Expect(ctx context.Cont } mmDeleteModelTags.defaultExpectation.params = &RepositoryMockDeleteModelTagsParams{ctx, modelUID, tagNames} + mmDeleteModelTags.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmDeleteModelTags.expectations { if minimock.Equal(e.params, mmDeleteModelTags.defaultExpectation.params) { mmDeleteModelTags.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmDeleteModelTags.defaultExpectation.params) @@ -2129,6 +2306,7 @@ func (mmDeleteModelTags *mRepositoryMockDeleteModelTags) ExpectCtxParam1(ctx con mmDeleteModelTags.defaultExpectation.paramPtrs = &RepositoryMockDeleteModelTagsParamPtrs{} } mmDeleteModelTags.defaultExpectation.paramPtrs.ctx = &ctx + mmDeleteModelTags.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmDeleteModelTags } @@ -2151,6 +2329,7 @@ func (mmDeleteModelTags *mRepositoryMockDeleteModelTags) ExpectModelUIDParam2(mo mmDeleteModelTags.defaultExpectation.paramPtrs = &RepositoryMockDeleteModelTagsParamPtrs{} } mmDeleteModelTags.defaultExpectation.paramPtrs.modelUID = &modelUID + mmDeleteModelTags.defaultExpectation.expectationOrigins.originModelUID = minimock.CallerInfo(1) return mmDeleteModelTags } @@ -2173,6 +2352,7 @@ func (mmDeleteModelTags *mRepositoryMockDeleteModelTags) ExpectTagNamesParam3(ta mmDeleteModelTags.defaultExpectation.paramPtrs = &RepositoryMockDeleteModelTagsParamPtrs{} } mmDeleteModelTags.defaultExpectation.paramPtrs.tagNames = &tagNames + mmDeleteModelTags.defaultExpectation.expectationOrigins.originTagNames = minimock.CallerInfo(1) return mmDeleteModelTags } @@ -2198,6 +2378,7 @@ func (mmDeleteModelTags *mRepositoryMockDeleteModelTags) Return(err error) *Repo mmDeleteModelTags.defaultExpectation = &RepositoryMockDeleteModelTagsExpectation{mock: mmDeleteModelTags.mock} } mmDeleteModelTags.defaultExpectation.results = &RepositoryMockDeleteModelTagsResults{err} + mmDeleteModelTags.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmDeleteModelTags.mock } @@ -2212,6 +2393,7 @@ func (mmDeleteModelTags *mRepositoryMockDeleteModelTags) Set(f func(ctx context. } mmDeleteModelTags.mock.funcDeleteModelTags = f + mmDeleteModelTags.mock.funcDeleteModelTagsOrigin = minimock.CallerInfo(1) return mmDeleteModelTags.mock } @@ -2223,8 +2405,9 @@ func (mmDeleteModelTags *mRepositoryMockDeleteModelTags) When(ctx context.Contex } expectation := &RepositoryMockDeleteModelTagsExpectation{ - mock: mmDeleteModelTags.mock, - params: &RepositoryMockDeleteModelTagsParams{ctx, modelUID, tagNames}, + mock: mmDeleteModelTags.mock, + params: &RepositoryMockDeleteModelTagsParams{ctx, modelUID, tagNames}, + expectationOrigins: RepositoryMockDeleteModelTagsExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmDeleteModelTags.expectations = append(mmDeleteModelTags.expectations, expectation) return expectation @@ -2242,6 +2425,7 @@ func (mmDeleteModelTags *mRepositoryMockDeleteModelTags) Times(n uint64) *mRepos mmDeleteModelTags.mock.t.Fatalf("Times of RepositoryMock.DeleteModelTags mock can not be zero") } mm_atomic.StoreUint64(&mmDeleteModelTags.expectedInvocations, n) + mmDeleteModelTags.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmDeleteModelTags } @@ -2256,11 +2440,13 @@ func (mmDeleteModelTags *mRepositoryMockDeleteModelTags) invocationsDone() bool return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// DeleteModelTags implements repository.Repository +// DeleteModelTags implements mm_repository.Repository func (mmDeleteModelTags *RepositoryMock) DeleteModelTags(ctx context.Context, modelUID uuid.UUID, tagNames []string) (err error) { mm_atomic.AddUint64(&mmDeleteModelTags.beforeDeleteModelTagsCounter, 1) defer mm_atomic.AddUint64(&mmDeleteModelTags.afterDeleteModelTagsCounter, 1) + mmDeleteModelTags.t.Helper() + if mmDeleteModelTags.inspectFuncDeleteModelTags != nil { mmDeleteModelTags.inspectFuncDeleteModelTags(ctx, modelUID, tagNames) } @@ -2289,19 +2475,23 @@ func (mmDeleteModelTags *RepositoryMock) DeleteModelTags(ctx context.Context, mo if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmDeleteModelTags.t.Errorf("RepositoryMock.DeleteModelTags got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmDeleteModelTags.t.Errorf("RepositoryMock.DeleteModelTags got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmDeleteModelTags.DeleteModelTagsMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.modelUID != nil && !minimock.Equal(*mm_want_ptrs.modelUID, mm_got.modelUID) { - mmDeleteModelTags.t.Errorf("RepositoryMock.DeleteModelTags got unexpected parameter modelUID, want: %#v, got: %#v%s\n", *mm_want_ptrs.modelUID, mm_got.modelUID, minimock.Diff(*mm_want_ptrs.modelUID, mm_got.modelUID)) + mmDeleteModelTags.t.Errorf("RepositoryMock.DeleteModelTags got unexpected parameter modelUID, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmDeleteModelTags.DeleteModelTagsMock.defaultExpectation.expectationOrigins.originModelUID, *mm_want_ptrs.modelUID, mm_got.modelUID, minimock.Diff(*mm_want_ptrs.modelUID, mm_got.modelUID)) } if mm_want_ptrs.tagNames != nil && !minimock.Equal(*mm_want_ptrs.tagNames, mm_got.tagNames) { - mmDeleteModelTags.t.Errorf("RepositoryMock.DeleteModelTags got unexpected parameter tagNames, want: %#v, got: %#v%s\n", *mm_want_ptrs.tagNames, mm_got.tagNames, minimock.Diff(*mm_want_ptrs.tagNames, mm_got.tagNames)) + mmDeleteModelTags.t.Errorf("RepositoryMock.DeleteModelTags got unexpected parameter tagNames, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmDeleteModelTags.DeleteModelTagsMock.defaultExpectation.expectationOrigins.originTagNames, *mm_want_ptrs.tagNames, mm_got.tagNames, minimock.Diff(*mm_want_ptrs.tagNames, mm_got.tagNames)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmDeleteModelTags.t.Errorf("RepositoryMock.DeleteModelTags got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmDeleteModelTags.t.Errorf("RepositoryMock.DeleteModelTags got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmDeleteModelTags.DeleteModelTagsMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmDeleteModelTags.DeleteModelTagsMock.defaultExpectation.results @@ -2361,7 +2551,7 @@ func (m *RepositoryMock) MinimockDeleteModelTagsDone() bool { func (m *RepositoryMock) MinimockDeleteModelTagsInspect() { for _, e := range m.DeleteModelTagsMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.DeleteModelTags with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.DeleteModelTags at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -2369,19 +2559,19 @@ func (m *RepositoryMock) MinimockDeleteModelTagsInspect() { // if default expectation was set then invocations count should be greater than zero if m.DeleteModelTagsMock.defaultExpectation != nil && afterDeleteModelTagsCounter < 1 { if m.DeleteModelTagsMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.DeleteModelTags") + m.t.Errorf("Expected call to RepositoryMock.DeleteModelTags at\n%s", m.DeleteModelTagsMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.DeleteModelTags with params: %#v", *m.DeleteModelTagsMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.DeleteModelTags at\n%s with params: %#v", m.DeleteModelTagsMock.defaultExpectation.expectationOrigins.origin, *m.DeleteModelTagsMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcDeleteModelTags != nil && afterDeleteModelTagsCounter < 1 { - m.t.Error("Expected call to RepositoryMock.DeleteModelTags") + m.t.Errorf("Expected call to RepositoryMock.DeleteModelTags at\n%s", m.funcDeleteModelTagsOrigin) } if !m.DeleteModelTagsMock.invocationsDone() && afterDeleteModelTagsCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.DeleteModelTags but found %d calls", - mm_atomic.LoadUint64(&m.DeleteModelTagsMock.expectedInvocations), afterDeleteModelTagsCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.DeleteModelTags at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.DeleteModelTagsMock.expectedInvocations), m.DeleteModelTagsMock.expectedInvocationsOrigin, afterDeleteModelTagsCounter) } } @@ -2394,16 +2584,19 @@ type mRepositoryMockDeleteModelVersionByDigest struct { callArgs []*RepositoryMockDeleteModelVersionByDigestParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockDeleteModelVersionByDigestExpectation specifies expectation struct of the Repository.DeleteModelVersionByDigest type RepositoryMockDeleteModelVersionByDigestExpectation struct { - mock *RepositoryMock - params *RepositoryMockDeleteModelVersionByDigestParams - paramPtrs *RepositoryMockDeleteModelVersionByDigestParamPtrs - results *RepositoryMockDeleteModelVersionByDigestResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockDeleteModelVersionByDigestParams + paramPtrs *RepositoryMockDeleteModelVersionByDigestParamPtrs + expectationOrigins RepositoryMockDeleteModelVersionByDigestExpectationOrigins + results *RepositoryMockDeleteModelVersionByDigestResults + returnOrigin string + Counter uint64 } // RepositoryMockDeleteModelVersionByDigestParams contains parameters of the Repository.DeleteModelVersionByDigest @@ -2425,6 +2618,14 @@ type RepositoryMockDeleteModelVersionByDigestResults struct { err error } +// RepositoryMockDeleteModelVersionByDigestOrigins contains origins of expectations of the Repository.DeleteModelVersionByDigest +type RepositoryMockDeleteModelVersionByDigestExpectationOrigins struct { + origin string + originCtx string + originModelUID string + originDigest string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -2450,6 +2651,7 @@ func (mmDeleteModelVersionByDigest *mRepositoryMockDeleteModelVersionByDigest) E } mmDeleteModelVersionByDigest.defaultExpectation.params = &RepositoryMockDeleteModelVersionByDigestParams{ctx, modelUID, digest} + mmDeleteModelVersionByDigest.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmDeleteModelVersionByDigest.expectations { if minimock.Equal(e.params, mmDeleteModelVersionByDigest.defaultExpectation.params) { mmDeleteModelVersionByDigest.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmDeleteModelVersionByDigest.defaultExpectation.params) @@ -2477,6 +2679,7 @@ func (mmDeleteModelVersionByDigest *mRepositoryMockDeleteModelVersionByDigest) E mmDeleteModelVersionByDigest.defaultExpectation.paramPtrs = &RepositoryMockDeleteModelVersionByDigestParamPtrs{} } mmDeleteModelVersionByDigest.defaultExpectation.paramPtrs.ctx = &ctx + mmDeleteModelVersionByDigest.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmDeleteModelVersionByDigest } @@ -2499,6 +2702,7 @@ func (mmDeleteModelVersionByDigest *mRepositoryMockDeleteModelVersionByDigest) E mmDeleteModelVersionByDigest.defaultExpectation.paramPtrs = &RepositoryMockDeleteModelVersionByDigestParamPtrs{} } mmDeleteModelVersionByDigest.defaultExpectation.paramPtrs.modelUID = &modelUID + mmDeleteModelVersionByDigest.defaultExpectation.expectationOrigins.originModelUID = minimock.CallerInfo(1) return mmDeleteModelVersionByDigest } @@ -2521,6 +2725,7 @@ func (mmDeleteModelVersionByDigest *mRepositoryMockDeleteModelVersionByDigest) E mmDeleteModelVersionByDigest.defaultExpectation.paramPtrs = &RepositoryMockDeleteModelVersionByDigestParamPtrs{} } mmDeleteModelVersionByDigest.defaultExpectation.paramPtrs.digest = &digest + mmDeleteModelVersionByDigest.defaultExpectation.expectationOrigins.originDigest = minimock.CallerInfo(1) return mmDeleteModelVersionByDigest } @@ -2546,6 +2751,7 @@ func (mmDeleteModelVersionByDigest *mRepositoryMockDeleteModelVersionByDigest) R mmDeleteModelVersionByDigest.defaultExpectation = &RepositoryMockDeleteModelVersionByDigestExpectation{mock: mmDeleteModelVersionByDigest.mock} } mmDeleteModelVersionByDigest.defaultExpectation.results = &RepositoryMockDeleteModelVersionByDigestResults{err} + mmDeleteModelVersionByDigest.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmDeleteModelVersionByDigest.mock } @@ -2560,6 +2766,7 @@ func (mmDeleteModelVersionByDigest *mRepositoryMockDeleteModelVersionByDigest) S } mmDeleteModelVersionByDigest.mock.funcDeleteModelVersionByDigest = f + mmDeleteModelVersionByDigest.mock.funcDeleteModelVersionByDigestOrigin = minimock.CallerInfo(1) return mmDeleteModelVersionByDigest.mock } @@ -2571,8 +2778,9 @@ func (mmDeleteModelVersionByDigest *mRepositoryMockDeleteModelVersionByDigest) W } expectation := &RepositoryMockDeleteModelVersionByDigestExpectation{ - mock: mmDeleteModelVersionByDigest.mock, - params: &RepositoryMockDeleteModelVersionByDigestParams{ctx, modelUID, digest}, + mock: mmDeleteModelVersionByDigest.mock, + params: &RepositoryMockDeleteModelVersionByDigestParams{ctx, modelUID, digest}, + expectationOrigins: RepositoryMockDeleteModelVersionByDigestExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmDeleteModelVersionByDigest.expectations = append(mmDeleteModelVersionByDigest.expectations, expectation) return expectation @@ -2590,6 +2798,7 @@ func (mmDeleteModelVersionByDigest *mRepositoryMockDeleteModelVersionByDigest) T mmDeleteModelVersionByDigest.mock.t.Fatalf("Times of RepositoryMock.DeleteModelVersionByDigest mock can not be zero") } mm_atomic.StoreUint64(&mmDeleteModelVersionByDigest.expectedInvocations, n) + mmDeleteModelVersionByDigest.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmDeleteModelVersionByDigest } @@ -2604,11 +2813,13 @@ func (mmDeleteModelVersionByDigest *mRepositoryMockDeleteModelVersionByDigest) i return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// DeleteModelVersionByDigest implements repository.Repository +// DeleteModelVersionByDigest implements mm_repository.Repository func (mmDeleteModelVersionByDigest *RepositoryMock) DeleteModelVersionByDigest(ctx context.Context, modelUID uuid.UUID, digest string) (err error) { mm_atomic.AddUint64(&mmDeleteModelVersionByDigest.beforeDeleteModelVersionByDigestCounter, 1) defer mm_atomic.AddUint64(&mmDeleteModelVersionByDigest.afterDeleteModelVersionByDigestCounter, 1) + mmDeleteModelVersionByDigest.t.Helper() + if mmDeleteModelVersionByDigest.inspectFuncDeleteModelVersionByDigest != nil { mmDeleteModelVersionByDigest.inspectFuncDeleteModelVersionByDigest(ctx, modelUID, digest) } @@ -2637,19 +2848,23 @@ func (mmDeleteModelVersionByDigest *RepositoryMock) DeleteModelVersionByDigest(c if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmDeleteModelVersionByDigest.t.Errorf("RepositoryMock.DeleteModelVersionByDigest got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmDeleteModelVersionByDigest.t.Errorf("RepositoryMock.DeleteModelVersionByDigest got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmDeleteModelVersionByDigest.DeleteModelVersionByDigestMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.modelUID != nil && !minimock.Equal(*mm_want_ptrs.modelUID, mm_got.modelUID) { - mmDeleteModelVersionByDigest.t.Errorf("RepositoryMock.DeleteModelVersionByDigest got unexpected parameter modelUID, want: %#v, got: %#v%s\n", *mm_want_ptrs.modelUID, mm_got.modelUID, minimock.Diff(*mm_want_ptrs.modelUID, mm_got.modelUID)) + mmDeleteModelVersionByDigest.t.Errorf("RepositoryMock.DeleteModelVersionByDigest got unexpected parameter modelUID, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmDeleteModelVersionByDigest.DeleteModelVersionByDigestMock.defaultExpectation.expectationOrigins.originModelUID, *mm_want_ptrs.modelUID, mm_got.modelUID, minimock.Diff(*mm_want_ptrs.modelUID, mm_got.modelUID)) } if mm_want_ptrs.digest != nil && !minimock.Equal(*mm_want_ptrs.digest, mm_got.digest) { - mmDeleteModelVersionByDigest.t.Errorf("RepositoryMock.DeleteModelVersionByDigest got unexpected parameter digest, want: %#v, got: %#v%s\n", *mm_want_ptrs.digest, mm_got.digest, minimock.Diff(*mm_want_ptrs.digest, mm_got.digest)) + mmDeleteModelVersionByDigest.t.Errorf("RepositoryMock.DeleteModelVersionByDigest got unexpected parameter digest, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmDeleteModelVersionByDigest.DeleteModelVersionByDigestMock.defaultExpectation.expectationOrigins.originDigest, *mm_want_ptrs.digest, mm_got.digest, minimock.Diff(*mm_want_ptrs.digest, mm_got.digest)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmDeleteModelVersionByDigest.t.Errorf("RepositoryMock.DeleteModelVersionByDigest got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmDeleteModelVersionByDigest.t.Errorf("RepositoryMock.DeleteModelVersionByDigest got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmDeleteModelVersionByDigest.DeleteModelVersionByDigestMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmDeleteModelVersionByDigest.DeleteModelVersionByDigestMock.defaultExpectation.results @@ -2709,7 +2924,7 @@ func (m *RepositoryMock) MinimockDeleteModelVersionByDigestDone() bool { func (m *RepositoryMock) MinimockDeleteModelVersionByDigestInspect() { for _, e := range m.DeleteModelVersionByDigestMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.DeleteModelVersionByDigest with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.DeleteModelVersionByDigest at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -2717,19 +2932,19 @@ func (m *RepositoryMock) MinimockDeleteModelVersionByDigestInspect() { // if default expectation was set then invocations count should be greater than zero if m.DeleteModelVersionByDigestMock.defaultExpectation != nil && afterDeleteModelVersionByDigestCounter < 1 { if m.DeleteModelVersionByDigestMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.DeleteModelVersionByDigest") + m.t.Errorf("Expected call to RepositoryMock.DeleteModelVersionByDigest at\n%s", m.DeleteModelVersionByDigestMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.DeleteModelVersionByDigest with params: %#v", *m.DeleteModelVersionByDigestMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.DeleteModelVersionByDigest at\n%s with params: %#v", m.DeleteModelVersionByDigestMock.defaultExpectation.expectationOrigins.origin, *m.DeleteModelVersionByDigestMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcDeleteModelVersionByDigest != nil && afterDeleteModelVersionByDigestCounter < 1 { - m.t.Error("Expected call to RepositoryMock.DeleteModelVersionByDigest") + m.t.Errorf("Expected call to RepositoryMock.DeleteModelVersionByDigest at\n%s", m.funcDeleteModelVersionByDigestOrigin) } if !m.DeleteModelVersionByDigestMock.invocationsDone() && afterDeleteModelVersionByDigestCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.DeleteModelVersionByDigest but found %d calls", - mm_atomic.LoadUint64(&m.DeleteModelVersionByDigestMock.expectedInvocations), afterDeleteModelVersionByDigestCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.DeleteModelVersionByDigest at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.DeleteModelVersionByDigestMock.expectedInvocations), m.DeleteModelVersionByDigestMock.expectedInvocationsOrigin, afterDeleteModelVersionByDigestCounter) } } @@ -2742,16 +2957,19 @@ type mRepositoryMockDeleteModelVersionByID struct { callArgs []*RepositoryMockDeleteModelVersionByIDParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockDeleteModelVersionByIDExpectation specifies expectation struct of the Repository.DeleteModelVersionByID type RepositoryMockDeleteModelVersionByIDExpectation struct { - mock *RepositoryMock - params *RepositoryMockDeleteModelVersionByIDParams - paramPtrs *RepositoryMockDeleteModelVersionByIDParamPtrs - results *RepositoryMockDeleteModelVersionByIDResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockDeleteModelVersionByIDParams + paramPtrs *RepositoryMockDeleteModelVersionByIDParamPtrs + expectationOrigins RepositoryMockDeleteModelVersionByIDExpectationOrigins + results *RepositoryMockDeleteModelVersionByIDResults + returnOrigin string + Counter uint64 } // RepositoryMockDeleteModelVersionByIDParams contains parameters of the Repository.DeleteModelVersionByID @@ -2773,6 +2991,14 @@ type RepositoryMockDeleteModelVersionByIDResults struct { err error } +// RepositoryMockDeleteModelVersionByIDOrigins contains origins of expectations of the Repository.DeleteModelVersionByID +type RepositoryMockDeleteModelVersionByIDExpectationOrigins struct { + origin string + originCtx string + originModelUID string + originVersionID string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -2798,6 +3024,7 @@ func (mmDeleteModelVersionByID *mRepositoryMockDeleteModelVersionByID) Expect(ct } mmDeleteModelVersionByID.defaultExpectation.params = &RepositoryMockDeleteModelVersionByIDParams{ctx, modelUID, versionID} + mmDeleteModelVersionByID.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmDeleteModelVersionByID.expectations { if minimock.Equal(e.params, mmDeleteModelVersionByID.defaultExpectation.params) { mmDeleteModelVersionByID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmDeleteModelVersionByID.defaultExpectation.params) @@ -2825,6 +3052,7 @@ func (mmDeleteModelVersionByID *mRepositoryMockDeleteModelVersionByID) ExpectCtx mmDeleteModelVersionByID.defaultExpectation.paramPtrs = &RepositoryMockDeleteModelVersionByIDParamPtrs{} } mmDeleteModelVersionByID.defaultExpectation.paramPtrs.ctx = &ctx + mmDeleteModelVersionByID.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmDeleteModelVersionByID } @@ -2847,6 +3075,7 @@ func (mmDeleteModelVersionByID *mRepositoryMockDeleteModelVersionByID) ExpectMod mmDeleteModelVersionByID.defaultExpectation.paramPtrs = &RepositoryMockDeleteModelVersionByIDParamPtrs{} } mmDeleteModelVersionByID.defaultExpectation.paramPtrs.modelUID = &modelUID + mmDeleteModelVersionByID.defaultExpectation.expectationOrigins.originModelUID = minimock.CallerInfo(1) return mmDeleteModelVersionByID } @@ -2869,6 +3098,7 @@ func (mmDeleteModelVersionByID *mRepositoryMockDeleteModelVersionByID) ExpectVer mmDeleteModelVersionByID.defaultExpectation.paramPtrs = &RepositoryMockDeleteModelVersionByIDParamPtrs{} } mmDeleteModelVersionByID.defaultExpectation.paramPtrs.versionID = &versionID + mmDeleteModelVersionByID.defaultExpectation.expectationOrigins.originVersionID = minimock.CallerInfo(1) return mmDeleteModelVersionByID } @@ -2894,6 +3124,7 @@ func (mmDeleteModelVersionByID *mRepositoryMockDeleteModelVersionByID) Return(er mmDeleteModelVersionByID.defaultExpectation = &RepositoryMockDeleteModelVersionByIDExpectation{mock: mmDeleteModelVersionByID.mock} } mmDeleteModelVersionByID.defaultExpectation.results = &RepositoryMockDeleteModelVersionByIDResults{err} + mmDeleteModelVersionByID.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmDeleteModelVersionByID.mock } @@ -2908,6 +3139,7 @@ func (mmDeleteModelVersionByID *mRepositoryMockDeleteModelVersionByID) Set(f fun } mmDeleteModelVersionByID.mock.funcDeleteModelVersionByID = f + mmDeleteModelVersionByID.mock.funcDeleteModelVersionByIDOrigin = minimock.CallerInfo(1) return mmDeleteModelVersionByID.mock } @@ -2919,8 +3151,9 @@ func (mmDeleteModelVersionByID *mRepositoryMockDeleteModelVersionByID) When(ctx } expectation := &RepositoryMockDeleteModelVersionByIDExpectation{ - mock: mmDeleteModelVersionByID.mock, - params: &RepositoryMockDeleteModelVersionByIDParams{ctx, modelUID, versionID}, + mock: mmDeleteModelVersionByID.mock, + params: &RepositoryMockDeleteModelVersionByIDParams{ctx, modelUID, versionID}, + expectationOrigins: RepositoryMockDeleteModelVersionByIDExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmDeleteModelVersionByID.expectations = append(mmDeleteModelVersionByID.expectations, expectation) return expectation @@ -2938,6 +3171,7 @@ func (mmDeleteModelVersionByID *mRepositoryMockDeleteModelVersionByID) Times(n u mmDeleteModelVersionByID.mock.t.Fatalf("Times of RepositoryMock.DeleteModelVersionByID mock can not be zero") } mm_atomic.StoreUint64(&mmDeleteModelVersionByID.expectedInvocations, n) + mmDeleteModelVersionByID.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmDeleteModelVersionByID } @@ -2952,11 +3186,13 @@ func (mmDeleteModelVersionByID *mRepositoryMockDeleteModelVersionByID) invocatio return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// DeleteModelVersionByID implements repository.Repository +// DeleteModelVersionByID implements mm_repository.Repository func (mmDeleteModelVersionByID *RepositoryMock) DeleteModelVersionByID(ctx context.Context, modelUID uuid.UUID, versionID string) (err error) { mm_atomic.AddUint64(&mmDeleteModelVersionByID.beforeDeleteModelVersionByIDCounter, 1) defer mm_atomic.AddUint64(&mmDeleteModelVersionByID.afterDeleteModelVersionByIDCounter, 1) + mmDeleteModelVersionByID.t.Helper() + if mmDeleteModelVersionByID.inspectFuncDeleteModelVersionByID != nil { mmDeleteModelVersionByID.inspectFuncDeleteModelVersionByID(ctx, modelUID, versionID) } @@ -2985,19 +3221,23 @@ func (mmDeleteModelVersionByID *RepositoryMock) DeleteModelVersionByID(ctx conte if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmDeleteModelVersionByID.t.Errorf("RepositoryMock.DeleteModelVersionByID got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmDeleteModelVersionByID.t.Errorf("RepositoryMock.DeleteModelVersionByID got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmDeleteModelVersionByID.DeleteModelVersionByIDMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.modelUID != nil && !minimock.Equal(*mm_want_ptrs.modelUID, mm_got.modelUID) { - mmDeleteModelVersionByID.t.Errorf("RepositoryMock.DeleteModelVersionByID got unexpected parameter modelUID, want: %#v, got: %#v%s\n", *mm_want_ptrs.modelUID, mm_got.modelUID, minimock.Diff(*mm_want_ptrs.modelUID, mm_got.modelUID)) + mmDeleteModelVersionByID.t.Errorf("RepositoryMock.DeleteModelVersionByID got unexpected parameter modelUID, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmDeleteModelVersionByID.DeleteModelVersionByIDMock.defaultExpectation.expectationOrigins.originModelUID, *mm_want_ptrs.modelUID, mm_got.modelUID, minimock.Diff(*mm_want_ptrs.modelUID, mm_got.modelUID)) } if mm_want_ptrs.versionID != nil && !minimock.Equal(*mm_want_ptrs.versionID, mm_got.versionID) { - mmDeleteModelVersionByID.t.Errorf("RepositoryMock.DeleteModelVersionByID got unexpected parameter versionID, want: %#v, got: %#v%s\n", *mm_want_ptrs.versionID, mm_got.versionID, minimock.Diff(*mm_want_ptrs.versionID, mm_got.versionID)) + mmDeleteModelVersionByID.t.Errorf("RepositoryMock.DeleteModelVersionByID got unexpected parameter versionID, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmDeleteModelVersionByID.DeleteModelVersionByIDMock.defaultExpectation.expectationOrigins.originVersionID, *mm_want_ptrs.versionID, mm_got.versionID, minimock.Diff(*mm_want_ptrs.versionID, mm_got.versionID)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmDeleteModelVersionByID.t.Errorf("RepositoryMock.DeleteModelVersionByID got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmDeleteModelVersionByID.t.Errorf("RepositoryMock.DeleteModelVersionByID got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmDeleteModelVersionByID.DeleteModelVersionByIDMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmDeleteModelVersionByID.DeleteModelVersionByIDMock.defaultExpectation.results @@ -3057,7 +3297,7 @@ func (m *RepositoryMock) MinimockDeleteModelVersionByIDDone() bool { func (m *RepositoryMock) MinimockDeleteModelVersionByIDInspect() { for _, e := range m.DeleteModelVersionByIDMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.DeleteModelVersionByID with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.DeleteModelVersionByID at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -3065,19 +3305,19 @@ func (m *RepositoryMock) MinimockDeleteModelVersionByIDInspect() { // if default expectation was set then invocations count should be greater than zero if m.DeleteModelVersionByIDMock.defaultExpectation != nil && afterDeleteModelVersionByIDCounter < 1 { if m.DeleteModelVersionByIDMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.DeleteModelVersionByID") + m.t.Errorf("Expected call to RepositoryMock.DeleteModelVersionByID at\n%s", m.DeleteModelVersionByIDMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.DeleteModelVersionByID with params: %#v", *m.DeleteModelVersionByIDMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.DeleteModelVersionByID at\n%s with params: %#v", m.DeleteModelVersionByIDMock.defaultExpectation.expectationOrigins.origin, *m.DeleteModelVersionByIDMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcDeleteModelVersionByID != nil && afterDeleteModelVersionByIDCounter < 1 { - m.t.Error("Expected call to RepositoryMock.DeleteModelVersionByID") + m.t.Errorf("Expected call to RepositoryMock.DeleteModelVersionByID at\n%s", m.funcDeleteModelVersionByIDOrigin) } if !m.DeleteModelVersionByIDMock.invocationsDone() && afterDeleteModelVersionByIDCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.DeleteModelVersionByID but found %d calls", - mm_atomic.LoadUint64(&m.DeleteModelVersionByIDMock.expectedInvocations), afterDeleteModelVersionByIDCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.DeleteModelVersionByID at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.DeleteModelVersionByIDMock.expectedInvocations), m.DeleteModelVersionByIDMock.expectedInvocationsOrigin, afterDeleteModelVersionByIDCounter) } } @@ -3090,16 +3330,19 @@ type mRepositoryMockDeleteNamespaceModelByID struct { callArgs []*RepositoryMockDeleteNamespaceModelByIDParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockDeleteNamespaceModelByIDExpectation specifies expectation struct of the Repository.DeleteNamespaceModelByID type RepositoryMockDeleteNamespaceModelByIDExpectation struct { - mock *RepositoryMock - params *RepositoryMockDeleteNamespaceModelByIDParams - paramPtrs *RepositoryMockDeleteNamespaceModelByIDParamPtrs - results *RepositoryMockDeleteNamespaceModelByIDResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockDeleteNamespaceModelByIDParams + paramPtrs *RepositoryMockDeleteNamespaceModelByIDParamPtrs + expectationOrigins RepositoryMockDeleteNamespaceModelByIDExpectationOrigins + results *RepositoryMockDeleteNamespaceModelByIDResults + returnOrigin string + Counter uint64 } // RepositoryMockDeleteNamespaceModelByIDParams contains parameters of the Repository.DeleteNamespaceModelByID @@ -3121,6 +3364,14 @@ type RepositoryMockDeleteNamespaceModelByIDResults struct { err error } +// RepositoryMockDeleteNamespaceModelByIDOrigins contains origins of expectations of the Repository.DeleteNamespaceModelByID +type RepositoryMockDeleteNamespaceModelByIDExpectationOrigins struct { + origin string + originCtx string + originOwnerPermalink string + originId string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -3146,6 +3397,7 @@ func (mmDeleteNamespaceModelByID *mRepositoryMockDeleteNamespaceModelByID) Expec } mmDeleteNamespaceModelByID.defaultExpectation.params = &RepositoryMockDeleteNamespaceModelByIDParams{ctx, ownerPermalink, id} + mmDeleteNamespaceModelByID.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmDeleteNamespaceModelByID.expectations { if minimock.Equal(e.params, mmDeleteNamespaceModelByID.defaultExpectation.params) { mmDeleteNamespaceModelByID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmDeleteNamespaceModelByID.defaultExpectation.params) @@ -3173,6 +3425,7 @@ func (mmDeleteNamespaceModelByID *mRepositoryMockDeleteNamespaceModelByID) Expec mmDeleteNamespaceModelByID.defaultExpectation.paramPtrs = &RepositoryMockDeleteNamespaceModelByIDParamPtrs{} } mmDeleteNamespaceModelByID.defaultExpectation.paramPtrs.ctx = &ctx + mmDeleteNamespaceModelByID.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmDeleteNamespaceModelByID } @@ -3195,6 +3448,7 @@ func (mmDeleteNamespaceModelByID *mRepositoryMockDeleteNamespaceModelByID) Expec mmDeleteNamespaceModelByID.defaultExpectation.paramPtrs = &RepositoryMockDeleteNamespaceModelByIDParamPtrs{} } mmDeleteNamespaceModelByID.defaultExpectation.paramPtrs.ownerPermalink = &ownerPermalink + mmDeleteNamespaceModelByID.defaultExpectation.expectationOrigins.originOwnerPermalink = minimock.CallerInfo(1) return mmDeleteNamespaceModelByID } @@ -3217,6 +3471,7 @@ func (mmDeleteNamespaceModelByID *mRepositoryMockDeleteNamespaceModelByID) Expec mmDeleteNamespaceModelByID.defaultExpectation.paramPtrs = &RepositoryMockDeleteNamespaceModelByIDParamPtrs{} } mmDeleteNamespaceModelByID.defaultExpectation.paramPtrs.id = &id + mmDeleteNamespaceModelByID.defaultExpectation.expectationOrigins.originId = minimock.CallerInfo(1) return mmDeleteNamespaceModelByID } @@ -3242,6 +3497,7 @@ func (mmDeleteNamespaceModelByID *mRepositoryMockDeleteNamespaceModelByID) Retur mmDeleteNamespaceModelByID.defaultExpectation = &RepositoryMockDeleteNamespaceModelByIDExpectation{mock: mmDeleteNamespaceModelByID.mock} } mmDeleteNamespaceModelByID.defaultExpectation.results = &RepositoryMockDeleteNamespaceModelByIDResults{err} + mmDeleteNamespaceModelByID.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmDeleteNamespaceModelByID.mock } @@ -3256,6 +3512,7 @@ func (mmDeleteNamespaceModelByID *mRepositoryMockDeleteNamespaceModelByID) Set(f } mmDeleteNamespaceModelByID.mock.funcDeleteNamespaceModelByID = f + mmDeleteNamespaceModelByID.mock.funcDeleteNamespaceModelByIDOrigin = minimock.CallerInfo(1) return mmDeleteNamespaceModelByID.mock } @@ -3267,8 +3524,9 @@ func (mmDeleteNamespaceModelByID *mRepositoryMockDeleteNamespaceModelByID) When( } expectation := &RepositoryMockDeleteNamespaceModelByIDExpectation{ - mock: mmDeleteNamespaceModelByID.mock, - params: &RepositoryMockDeleteNamespaceModelByIDParams{ctx, ownerPermalink, id}, + mock: mmDeleteNamespaceModelByID.mock, + params: &RepositoryMockDeleteNamespaceModelByIDParams{ctx, ownerPermalink, id}, + expectationOrigins: RepositoryMockDeleteNamespaceModelByIDExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmDeleteNamespaceModelByID.expectations = append(mmDeleteNamespaceModelByID.expectations, expectation) return expectation @@ -3286,6 +3544,7 @@ func (mmDeleteNamespaceModelByID *mRepositoryMockDeleteNamespaceModelByID) Times mmDeleteNamespaceModelByID.mock.t.Fatalf("Times of RepositoryMock.DeleteNamespaceModelByID mock can not be zero") } mm_atomic.StoreUint64(&mmDeleteNamespaceModelByID.expectedInvocations, n) + mmDeleteNamespaceModelByID.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmDeleteNamespaceModelByID } @@ -3300,11 +3559,13 @@ func (mmDeleteNamespaceModelByID *mRepositoryMockDeleteNamespaceModelByID) invoc return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// DeleteNamespaceModelByID implements repository.Repository +// DeleteNamespaceModelByID implements mm_repository.Repository func (mmDeleteNamespaceModelByID *RepositoryMock) DeleteNamespaceModelByID(ctx context.Context, ownerPermalink string, id string) (err error) { mm_atomic.AddUint64(&mmDeleteNamespaceModelByID.beforeDeleteNamespaceModelByIDCounter, 1) defer mm_atomic.AddUint64(&mmDeleteNamespaceModelByID.afterDeleteNamespaceModelByIDCounter, 1) + mmDeleteNamespaceModelByID.t.Helper() + if mmDeleteNamespaceModelByID.inspectFuncDeleteNamespaceModelByID != nil { mmDeleteNamespaceModelByID.inspectFuncDeleteNamespaceModelByID(ctx, ownerPermalink, id) } @@ -3333,19 +3594,23 @@ func (mmDeleteNamespaceModelByID *RepositoryMock) DeleteNamespaceModelByID(ctx c if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmDeleteNamespaceModelByID.t.Errorf("RepositoryMock.DeleteNamespaceModelByID got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmDeleteNamespaceModelByID.t.Errorf("RepositoryMock.DeleteNamespaceModelByID got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmDeleteNamespaceModelByID.DeleteNamespaceModelByIDMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.ownerPermalink != nil && !minimock.Equal(*mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink) { - mmDeleteNamespaceModelByID.t.Errorf("RepositoryMock.DeleteNamespaceModelByID got unexpected parameter ownerPermalink, want: %#v, got: %#v%s\n", *mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink, minimock.Diff(*mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink)) + mmDeleteNamespaceModelByID.t.Errorf("RepositoryMock.DeleteNamespaceModelByID got unexpected parameter ownerPermalink, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmDeleteNamespaceModelByID.DeleteNamespaceModelByIDMock.defaultExpectation.expectationOrigins.originOwnerPermalink, *mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink, minimock.Diff(*mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink)) } if mm_want_ptrs.id != nil && !minimock.Equal(*mm_want_ptrs.id, mm_got.id) { - mmDeleteNamespaceModelByID.t.Errorf("RepositoryMock.DeleteNamespaceModelByID got unexpected parameter id, want: %#v, got: %#v%s\n", *mm_want_ptrs.id, mm_got.id, minimock.Diff(*mm_want_ptrs.id, mm_got.id)) + mmDeleteNamespaceModelByID.t.Errorf("RepositoryMock.DeleteNamespaceModelByID got unexpected parameter id, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmDeleteNamespaceModelByID.DeleteNamespaceModelByIDMock.defaultExpectation.expectationOrigins.originId, *mm_want_ptrs.id, mm_got.id, minimock.Diff(*mm_want_ptrs.id, mm_got.id)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmDeleteNamespaceModelByID.t.Errorf("RepositoryMock.DeleteNamespaceModelByID got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmDeleteNamespaceModelByID.t.Errorf("RepositoryMock.DeleteNamespaceModelByID got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmDeleteNamespaceModelByID.DeleteNamespaceModelByIDMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmDeleteNamespaceModelByID.DeleteNamespaceModelByIDMock.defaultExpectation.results @@ -3405,7 +3670,7 @@ func (m *RepositoryMock) MinimockDeleteNamespaceModelByIDDone() bool { func (m *RepositoryMock) MinimockDeleteNamespaceModelByIDInspect() { for _, e := range m.DeleteNamespaceModelByIDMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.DeleteNamespaceModelByID with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.DeleteNamespaceModelByID at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -3413,19 +3678,19 @@ func (m *RepositoryMock) MinimockDeleteNamespaceModelByIDInspect() { // if default expectation was set then invocations count should be greater than zero if m.DeleteNamespaceModelByIDMock.defaultExpectation != nil && afterDeleteNamespaceModelByIDCounter < 1 { if m.DeleteNamespaceModelByIDMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.DeleteNamespaceModelByID") + m.t.Errorf("Expected call to RepositoryMock.DeleteNamespaceModelByID at\n%s", m.DeleteNamespaceModelByIDMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.DeleteNamespaceModelByID with params: %#v", *m.DeleteNamespaceModelByIDMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.DeleteNamespaceModelByID at\n%s with params: %#v", m.DeleteNamespaceModelByIDMock.defaultExpectation.expectationOrigins.origin, *m.DeleteNamespaceModelByIDMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcDeleteNamespaceModelByID != nil && afterDeleteNamespaceModelByIDCounter < 1 { - m.t.Error("Expected call to RepositoryMock.DeleteNamespaceModelByID") + m.t.Errorf("Expected call to RepositoryMock.DeleteNamespaceModelByID at\n%s", m.funcDeleteNamespaceModelByIDOrigin) } if !m.DeleteNamespaceModelByIDMock.invocationsDone() && afterDeleteNamespaceModelByIDCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.DeleteNamespaceModelByID but found %d calls", - mm_atomic.LoadUint64(&m.DeleteNamespaceModelByIDMock.expectedInvocations), afterDeleteNamespaceModelByIDCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.DeleteNamespaceModelByID at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.DeleteNamespaceModelByIDMock.expectedInvocations), m.DeleteNamespaceModelByIDMock.expectedInvocationsOrigin, afterDeleteNamespaceModelByIDCounter) } } @@ -3438,16 +3703,19 @@ type mRepositoryMockGetLatestModelRunByModelUID struct { callArgs []*RepositoryMockGetLatestModelRunByModelUIDParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockGetLatestModelRunByModelUIDExpectation specifies expectation struct of the Repository.GetLatestModelRunByModelUID type RepositoryMockGetLatestModelRunByModelUIDExpectation struct { - mock *RepositoryMock - params *RepositoryMockGetLatestModelRunByModelUIDParams - paramPtrs *RepositoryMockGetLatestModelRunByModelUIDParamPtrs - results *RepositoryMockGetLatestModelRunByModelUIDResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockGetLatestModelRunByModelUIDParams + paramPtrs *RepositoryMockGetLatestModelRunByModelUIDParamPtrs + expectationOrigins RepositoryMockGetLatestModelRunByModelUIDExpectationOrigins + results *RepositoryMockGetLatestModelRunByModelUIDResults + returnOrigin string + Counter uint64 } // RepositoryMockGetLatestModelRunByModelUIDParams contains parameters of the Repository.GetLatestModelRunByModelUID @@ -3470,6 +3738,14 @@ type RepositoryMockGetLatestModelRunByModelUIDResults struct { err error } +// RepositoryMockGetLatestModelRunByModelUIDOrigins contains origins of expectations of the Repository.GetLatestModelRunByModelUID +type RepositoryMockGetLatestModelRunByModelUIDExpectationOrigins struct { + origin string + originCtx string + originUserUID string + originModelUID string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -3495,6 +3771,7 @@ func (mmGetLatestModelRunByModelUID *mRepositoryMockGetLatestModelRunByModelUID) } mmGetLatestModelRunByModelUID.defaultExpectation.params = &RepositoryMockGetLatestModelRunByModelUIDParams{ctx, userUID, modelUID} + mmGetLatestModelRunByModelUID.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmGetLatestModelRunByModelUID.expectations { if minimock.Equal(e.params, mmGetLatestModelRunByModelUID.defaultExpectation.params) { mmGetLatestModelRunByModelUID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetLatestModelRunByModelUID.defaultExpectation.params) @@ -3522,6 +3799,7 @@ func (mmGetLatestModelRunByModelUID *mRepositoryMockGetLatestModelRunByModelUID) mmGetLatestModelRunByModelUID.defaultExpectation.paramPtrs = &RepositoryMockGetLatestModelRunByModelUIDParamPtrs{} } mmGetLatestModelRunByModelUID.defaultExpectation.paramPtrs.ctx = &ctx + mmGetLatestModelRunByModelUID.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmGetLatestModelRunByModelUID } @@ -3544,6 +3822,7 @@ func (mmGetLatestModelRunByModelUID *mRepositoryMockGetLatestModelRunByModelUID) mmGetLatestModelRunByModelUID.defaultExpectation.paramPtrs = &RepositoryMockGetLatestModelRunByModelUIDParamPtrs{} } mmGetLatestModelRunByModelUID.defaultExpectation.paramPtrs.userUID = &userUID + mmGetLatestModelRunByModelUID.defaultExpectation.expectationOrigins.originUserUID = minimock.CallerInfo(1) return mmGetLatestModelRunByModelUID } @@ -3566,6 +3845,7 @@ func (mmGetLatestModelRunByModelUID *mRepositoryMockGetLatestModelRunByModelUID) mmGetLatestModelRunByModelUID.defaultExpectation.paramPtrs = &RepositoryMockGetLatestModelRunByModelUIDParamPtrs{} } mmGetLatestModelRunByModelUID.defaultExpectation.paramPtrs.modelUID = &modelUID + mmGetLatestModelRunByModelUID.defaultExpectation.expectationOrigins.originModelUID = minimock.CallerInfo(1) return mmGetLatestModelRunByModelUID } @@ -3591,6 +3871,7 @@ func (mmGetLatestModelRunByModelUID *mRepositoryMockGetLatestModelRunByModelUID) mmGetLatestModelRunByModelUID.defaultExpectation = &RepositoryMockGetLatestModelRunByModelUIDExpectation{mock: mmGetLatestModelRunByModelUID.mock} } mmGetLatestModelRunByModelUID.defaultExpectation.results = &RepositoryMockGetLatestModelRunByModelUIDResults{modelRun, err} + mmGetLatestModelRunByModelUID.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmGetLatestModelRunByModelUID.mock } @@ -3605,6 +3886,7 @@ func (mmGetLatestModelRunByModelUID *mRepositoryMockGetLatestModelRunByModelUID) } mmGetLatestModelRunByModelUID.mock.funcGetLatestModelRunByModelUID = f + mmGetLatestModelRunByModelUID.mock.funcGetLatestModelRunByModelUIDOrigin = minimock.CallerInfo(1) return mmGetLatestModelRunByModelUID.mock } @@ -3616,8 +3898,9 @@ func (mmGetLatestModelRunByModelUID *mRepositoryMockGetLatestModelRunByModelUID) } expectation := &RepositoryMockGetLatestModelRunByModelUIDExpectation{ - mock: mmGetLatestModelRunByModelUID.mock, - params: &RepositoryMockGetLatestModelRunByModelUIDParams{ctx, userUID, modelUID}, + mock: mmGetLatestModelRunByModelUID.mock, + params: &RepositoryMockGetLatestModelRunByModelUIDParams{ctx, userUID, modelUID}, + expectationOrigins: RepositoryMockGetLatestModelRunByModelUIDExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmGetLatestModelRunByModelUID.expectations = append(mmGetLatestModelRunByModelUID.expectations, expectation) return expectation @@ -3635,6 +3918,7 @@ func (mmGetLatestModelRunByModelUID *mRepositoryMockGetLatestModelRunByModelUID) mmGetLatestModelRunByModelUID.mock.t.Fatalf("Times of RepositoryMock.GetLatestModelRunByModelUID mock can not be zero") } mm_atomic.StoreUint64(&mmGetLatestModelRunByModelUID.expectedInvocations, n) + mmGetLatestModelRunByModelUID.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmGetLatestModelRunByModelUID } @@ -3649,11 +3933,13 @@ func (mmGetLatestModelRunByModelUID *mRepositoryMockGetLatestModelRunByModelUID) return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// GetLatestModelRunByModelUID implements repository.Repository +// GetLatestModelRunByModelUID implements mm_repository.Repository func (mmGetLatestModelRunByModelUID *RepositoryMock) GetLatestModelRunByModelUID(ctx context.Context, userUID string, modelUID string) (modelRun *datamodel.ModelRun, err error) { mm_atomic.AddUint64(&mmGetLatestModelRunByModelUID.beforeGetLatestModelRunByModelUIDCounter, 1) defer mm_atomic.AddUint64(&mmGetLatestModelRunByModelUID.afterGetLatestModelRunByModelUIDCounter, 1) + mmGetLatestModelRunByModelUID.t.Helper() + if mmGetLatestModelRunByModelUID.inspectFuncGetLatestModelRunByModelUID != nil { mmGetLatestModelRunByModelUID.inspectFuncGetLatestModelRunByModelUID(ctx, userUID, modelUID) } @@ -3682,19 +3968,23 @@ func (mmGetLatestModelRunByModelUID *RepositoryMock) GetLatestModelRunByModelUID if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmGetLatestModelRunByModelUID.t.Errorf("RepositoryMock.GetLatestModelRunByModelUID got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmGetLatestModelRunByModelUID.t.Errorf("RepositoryMock.GetLatestModelRunByModelUID got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetLatestModelRunByModelUID.GetLatestModelRunByModelUIDMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.userUID != nil && !minimock.Equal(*mm_want_ptrs.userUID, mm_got.userUID) { - mmGetLatestModelRunByModelUID.t.Errorf("RepositoryMock.GetLatestModelRunByModelUID got unexpected parameter userUID, want: %#v, got: %#v%s\n", *mm_want_ptrs.userUID, mm_got.userUID, minimock.Diff(*mm_want_ptrs.userUID, mm_got.userUID)) + mmGetLatestModelRunByModelUID.t.Errorf("RepositoryMock.GetLatestModelRunByModelUID got unexpected parameter userUID, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetLatestModelRunByModelUID.GetLatestModelRunByModelUIDMock.defaultExpectation.expectationOrigins.originUserUID, *mm_want_ptrs.userUID, mm_got.userUID, minimock.Diff(*mm_want_ptrs.userUID, mm_got.userUID)) } if mm_want_ptrs.modelUID != nil && !minimock.Equal(*mm_want_ptrs.modelUID, mm_got.modelUID) { - mmGetLatestModelRunByModelUID.t.Errorf("RepositoryMock.GetLatestModelRunByModelUID got unexpected parameter modelUID, want: %#v, got: %#v%s\n", *mm_want_ptrs.modelUID, mm_got.modelUID, minimock.Diff(*mm_want_ptrs.modelUID, mm_got.modelUID)) + mmGetLatestModelRunByModelUID.t.Errorf("RepositoryMock.GetLatestModelRunByModelUID got unexpected parameter modelUID, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetLatestModelRunByModelUID.GetLatestModelRunByModelUIDMock.defaultExpectation.expectationOrigins.originModelUID, *mm_want_ptrs.modelUID, mm_got.modelUID, minimock.Diff(*mm_want_ptrs.modelUID, mm_got.modelUID)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmGetLatestModelRunByModelUID.t.Errorf("RepositoryMock.GetLatestModelRunByModelUID got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmGetLatestModelRunByModelUID.t.Errorf("RepositoryMock.GetLatestModelRunByModelUID got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetLatestModelRunByModelUID.GetLatestModelRunByModelUIDMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmGetLatestModelRunByModelUID.GetLatestModelRunByModelUIDMock.defaultExpectation.results @@ -3754,7 +4044,7 @@ func (m *RepositoryMock) MinimockGetLatestModelRunByModelUIDDone() bool { func (m *RepositoryMock) MinimockGetLatestModelRunByModelUIDInspect() { for _, e := range m.GetLatestModelRunByModelUIDMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.GetLatestModelRunByModelUID with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.GetLatestModelRunByModelUID at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -3762,19 +4052,19 @@ func (m *RepositoryMock) MinimockGetLatestModelRunByModelUIDInspect() { // if default expectation was set then invocations count should be greater than zero if m.GetLatestModelRunByModelUIDMock.defaultExpectation != nil && afterGetLatestModelRunByModelUIDCounter < 1 { if m.GetLatestModelRunByModelUIDMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.GetLatestModelRunByModelUID") + m.t.Errorf("Expected call to RepositoryMock.GetLatestModelRunByModelUID at\n%s", m.GetLatestModelRunByModelUIDMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.GetLatestModelRunByModelUID with params: %#v", *m.GetLatestModelRunByModelUIDMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.GetLatestModelRunByModelUID at\n%s with params: %#v", m.GetLatestModelRunByModelUIDMock.defaultExpectation.expectationOrigins.origin, *m.GetLatestModelRunByModelUIDMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcGetLatestModelRunByModelUID != nil && afterGetLatestModelRunByModelUIDCounter < 1 { - m.t.Error("Expected call to RepositoryMock.GetLatestModelRunByModelUID") + m.t.Errorf("Expected call to RepositoryMock.GetLatestModelRunByModelUID at\n%s", m.funcGetLatestModelRunByModelUIDOrigin) } if !m.GetLatestModelRunByModelUIDMock.invocationsDone() && afterGetLatestModelRunByModelUIDCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.GetLatestModelRunByModelUID but found %d calls", - mm_atomic.LoadUint64(&m.GetLatestModelRunByModelUIDMock.expectedInvocations), afterGetLatestModelRunByModelUIDCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.GetLatestModelRunByModelUID at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.GetLatestModelRunByModelUIDMock.expectedInvocations), m.GetLatestModelRunByModelUIDMock.expectedInvocationsOrigin, afterGetLatestModelRunByModelUIDCounter) } } @@ -3787,16 +4077,19 @@ type mRepositoryMockGetLatestModelVersionByModelUID struct { callArgs []*RepositoryMockGetLatestModelVersionByModelUIDParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockGetLatestModelVersionByModelUIDExpectation specifies expectation struct of the Repository.GetLatestModelVersionByModelUID type RepositoryMockGetLatestModelVersionByModelUIDExpectation struct { - mock *RepositoryMock - params *RepositoryMockGetLatestModelVersionByModelUIDParams - paramPtrs *RepositoryMockGetLatestModelVersionByModelUIDParamPtrs - results *RepositoryMockGetLatestModelVersionByModelUIDResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockGetLatestModelVersionByModelUIDParams + paramPtrs *RepositoryMockGetLatestModelVersionByModelUIDParamPtrs + expectationOrigins RepositoryMockGetLatestModelVersionByModelUIDExpectationOrigins + results *RepositoryMockGetLatestModelVersionByModelUIDResults + returnOrigin string + Counter uint64 } // RepositoryMockGetLatestModelVersionByModelUIDParams contains parameters of the Repository.GetLatestModelVersionByModelUID @@ -3817,6 +4110,13 @@ type RepositoryMockGetLatestModelVersionByModelUIDResults struct { err error } +// RepositoryMockGetLatestModelVersionByModelUIDOrigins contains origins of expectations of the Repository.GetLatestModelVersionByModelUID +type RepositoryMockGetLatestModelVersionByModelUIDExpectationOrigins struct { + origin string + originCtx string + originModelUID string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -3842,6 +4142,7 @@ func (mmGetLatestModelVersionByModelUID *mRepositoryMockGetLatestModelVersionByM } mmGetLatestModelVersionByModelUID.defaultExpectation.params = &RepositoryMockGetLatestModelVersionByModelUIDParams{ctx, modelUID} + mmGetLatestModelVersionByModelUID.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmGetLatestModelVersionByModelUID.expectations { if minimock.Equal(e.params, mmGetLatestModelVersionByModelUID.defaultExpectation.params) { mmGetLatestModelVersionByModelUID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetLatestModelVersionByModelUID.defaultExpectation.params) @@ -3869,6 +4170,7 @@ func (mmGetLatestModelVersionByModelUID *mRepositoryMockGetLatestModelVersionByM mmGetLatestModelVersionByModelUID.defaultExpectation.paramPtrs = &RepositoryMockGetLatestModelVersionByModelUIDParamPtrs{} } mmGetLatestModelVersionByModelUID.defaultExpectation.paramPtrs.ctx = &ctx + mmGetLatestModelVersionByModelUID.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmGetLatestModelVersionByModelUID } @@ -3891,6 +4193,7 @@ func (mmGetLatestModelVersionByModelUID *mRepositoryMockGetLatestModelVersionByM mmGetLatestModelVersionByModelUID.defaultExpectation.paramPtrs = &RepositoryMockGetLatestModelVersionByModelUIDParamPtrs{} } mmGetLatestModelVersionByModelUID.defaultExpectation.paramPtrs.modelUID = &modelUID + mmGetLatestModelVersionByModelUID.defaultExpectation.expectationOrigins.originModelUID = minimock.CallerInfo(1) return mmGetLatestModelVersionByModelUID } @@ -3916,6 +4219,7 @@ func (mmGetLatestModelVersionByModelUID *mRepositoryMockGetLatestModelVersionByM mmGetLatestModelVersionByModelUID.defaultExpectation = &RepositoryMockGetLatestModelVersionByModelUIDExpectation{mock: mmGetLatestModelVersionByModelUID.mock} } mmGetLatestModelVersionByModelUID.defaultExpectation.results = &RepositoryMockGetLatestModelVersionByModelUIDResults{version, err} + mmGetLatestModelVersionByModelUID.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmGetLatestModelVersionByModelUID.mock } @@ -3930,6 +4234,7 @@ func (mmGetLatestModelVersionByModelUID *mRepositoryMockGetLatestModelVersionByM } mmGetLatestModelVersionByModelUID.mock.funcGetLatestModelVersionByModelUID = f + mmGetLatestModelVersionByModelUID.mock.funcGetLatestModelVersionByModelUIDOrigin = minimock.CallerInfo(1) return mmGetLatestModelVersionByModelUID.mock } @@ -3941,8 +4246,9 @@ func (mmGetLatestModelVersionByModelUID *mRepositoryMockGetLatestModelVersionByM } expectation := &RepositoryMockGetLatestModelVersionByModelUIDExpectation{ - mock: mmGetLatestModelVersionByModelUID.mock, - params: &RepositoryMockGetLatestModelVersionByModelUIDParams{ctx, modelUID}, + mock: mmGetLatestModelVersionByModelUID.mock, + params: &RepositoryMockGetLatestModelVersionByModelUIDParams{ctx, modelUID}, + expectationOrigins: RepositoryMockGetLatestModelVersionByModelUIDExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmGetLatestModelVersionByModelUID.expectations = append(mmGetLatestModelVersionByModelUID.expectations, expectation) return expectation @@ -3960,6 +4266,7 @@ func (mmGetLatestModelVersionByModelUID *mRepositoryMockGetLatestModelVersionByM mmGetLatestModelVersionByModelUID.mock.t.Fatalf("Times of RepositoryMock.GetLatestModelVersionByModelUID mock can not be zero") } mm_atomic.StoreUint64(&mmGetLatestModelVersionByModelUID.expectedInvocations, n) + mmGetLatestModelVersionByModelUID.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmGetLatestModelVersionByModelUID } @@ -3974,11 +4281,13 @@ func (mmGetLatestModelVersionByModelUID *mRepositoryMockGetLatestModelVersionByM return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// GetLatestModelVersionByModelUID implements repository.Repository +// GetLatestModelVersionByModelUID implements mm_repository.Repository func (mmGetLatestModelVersionByModelUID *RepositoryMock) GetLatestModelVersionByModelUID(ctx context.Context, modelUID uuid.UUID) (version *datamodel.ModelVersion, err error) { mm_atomic.AddUint64(&mmGetLatestModelVersionByModelUID.beforeGetLatestModelVersionByModelUIDCounter, 1) defer mm_atomic.AddUint64(&mmGetLatestModelVersionByModelUID.afterGetLatestModelVersionByModelUIDCounter, 1) + mmGetLatestModelVersionByModelUID.t.Helper() + if mmGetLatestModelVersionByModelUID.inspectFuncGetLatestModelVersionByModelUID != nil { mmGetLatestModelVersionByModelUID.inspectFuncGetLatestModelVersionByModelUID(ctx, modelUID) } @@ -4007,15 +4316,18 @@ func (mmGetLatestModelVersionByModelUID *RepositoryMock) GetLatestModelVersionBy if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmGetLatestModelVersionByModelUID.t.Errorf("RepositoryMock.GetLatestModelVersionByModelUID got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmGetLatestModelVersionByModelUID.t.Errorf("RepositoryMock.GetLatestModelVersionByModelUID got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetLatestModelVersionByModelUID.GetLatestModelVersionByModelUIDMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.modelUID != nil && !minimock.Equal(*mm_want_ptrs.modelUID, mm_got.modelUID) { - mmGetLatestModelVersionByModelUID.t.Errorf("RepositoryMock.GetLatestModelVersionByModelUID got unexpected parameter modelUID, want: %#v, got: %#v%s\n", *mm_want_ptrs.modelUID, mm_got.modelUID, minimock.Diff(*mm_want_ptrs.modelUID, mm_got.modelUID)) + mmGetLatestModelVersionByModelUID.t.Errorf("RepositoryMock.GetLatestModelVersionByModelUID got unexpected parameter modelUID, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetLatestModelVersionByModelUID.GetLatestModelVersionByModelUIDMock.defaultExpectation.expectationOrigins.originModelUID, *mm_want_ptrs.modelUID, mm_got.modelUID, minimock.Diff(*mm_want_ptrs.modelUID, mm_got.modelUID)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmGetLatestModelVersionByModelUID.t.Errorf("RepositoryMock.GetLatestModelVersionByModelUID got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmGetLatestModelVersionByModelUID.t.Errorf("RepositoryMock.GetLatestModelVersionByModelUID got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetLatestModelVersionByModelUID.GetLatestModelVersionByModelUIDMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmGetLatestModelVersionByModelUID.GetLatestModelVersionByModelUIDMock.defaultExpectation.results @@ -4075,7 +4387,7 @@ func (m *RepositoryMock) MinimockGetLatestModelVersionByModelUIDDone() bool { func (m *RepositoryMock) MinimockGetLatestModelVersionByModelUIDInspect() { for _, e := range m.GetLatestModelVersionByModelUIDMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.GetLatestModelVersionByModelUID with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.GetLatestModelVersionByModelUID at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -4083,19 +4395,19 @@ func (m *RepositoryMock) MinimockGetLatestModelVersionByModelUIDInspect() { // if default expectation was set then invocations count should be greater than zero if m.GetLatestModelVersionByModelUIDMock.defaultExpectation != nil && afterGetLatestModelVersionByModelUIDCounter < 1 { if m.GetLatestModelVersionByModelUIDMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.GetLatestModelVersionByModelUID") + m.t.Errorf("Expected call to RepositoryMock.GetLatestModelVersionByModelUID at\n%s", m.GetLatestModelVersionByModelUIDMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.GetLatestModelVersionByModelUID with params: %#v", *m.GetLatestModelVersionByModelUIDMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.GetLatestModelVersionByModelUID at\n%s with params: %#v", m.GetLatestModelVersionByModelUIDMock.defaultExpectation.expectationOrigins.origin, *m.GetLatestModelVersionByModelUIDMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcGetLatestModelVersionByModelUID != nil && afterGetLatestModelVersionByModelUIDCounter < 1 { - m.t.Error("Expected call to RepositoryMock.GetLatestModelVersionByModelUID") + m.t.Errorf("Expected call to RepositoryMock.GetLatestModelVersionByModelUID at\n%s", m.funcGetLatestModelVersionByModelUIDOrigin) } if !m.GetLatestModelVersionByModelUIDMock.invocationsDone() && afterGetLatestModelVersionByModelUIDCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.GetLatestModelVersionByModelUID but found %d calls", - mm_atomic.LoadUint64(&m.GetLatestModelVersionByModelUIDMock.expectedInvocations), afterGetLatestModelVersionByModelUIDCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.GetLatestModelVersionByModelUID at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.GetLatestModelVersionByModelUIDMock.expectedInvocations), m.GetLatestModelVersionByModelUIDMock.expectedInvocationsOrigin, afterGetLatestModelVersionByModelUIDCounter) } } @@ -4108,16 +4420,19 @@ type mRepositoryMockGetLatestModelVersionRunByModelUID struct { callArgs []*RepositoryMockGetLatestModelVersionRunByModelUIDParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockGetLatestModelVersionRunByModelUIDExpectation specifies expectation struct of the Repository.GetLatestModelVersionRunByModelUID type RepositoryMockGetLatestModelVersionRunByModelUIDExpectation struct { - mock *RepositoryMock - params *RepositoryMockGetLatestModelVersionRunByModelUIDParams - paramPtrs *RepositoryMockGetLatestModelVersionRunByModelUIDParamPtrs - results *RepositoryMockGetLatestModelVersionRunByModelUIDResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockGetLatestModelVersionRunByModelUIDParams + paramPtrs *RepositoryMockGetLatestModelVersionRunByModelUIDParamPtrs + expectationOrigins RepositoryMockGetLatestModelVersionRunByModelUIDExpectationOrigins + results *RepositoryMockGetLatestModelVersionRunByModelUIDResults + returnOrigin string + Counter uint64 } // RepositoryMockGetLatestModelVersionRunByModelUIDParams contains parameters of the Repository.GetLatestModelVersionRunByModelUID @@ -4142,6 +4457,15 @@ type RepositoryMockGetLatestModelVersionRunByModelUIDResults struct { err error } +// RepositoryMockGetLatestModelVersionRunByModelUIDOrigins contains origins of expectations of the Repository.GetLatestModelVersionRunByModelUID +type RepositoryMockGetLatestModelVersionRunByModelUIDExpectationOrigins struct { + origin string + originCtx string + originUserUID string + originModelUID string + originVersion string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -4167,6 +4491,7 @@ func (mmGetLatestModelVersionRunByModelUID *mRepositoryMockGetLatestModelVersion } mmGetLatestModelVersionRunByModelUID.defaultExpectation.params = &RepositoryMockGetLatestModelVersionRunByModelUIDParams{ctx, userUID, modelUID, version} + mmGetLatestModelVersionRunByModelUID.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmGetLatestModelVersionRunByModelUID.expectations { if minimock.Equal(e.params, mmGetLatestModelVersionRunByModelUID.defaultExpectation.params) { mmGetLatestModelVersionRunByModelUID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetLatestModelVersionRunByModelUID.defaultExpectation.params) @@ -4194,6 +4519,7 @@ func (mmGetLatestModelVersionRunByModelUID *mRepositoryMockGetLatestModelVersion mmGetLatestModelVersionRunByModelUID.defaultExpectation.paramPtrs = &RepositoryMockGetLatestModelVersionRunByModelUIDParamPtrs{} } mmGetLatestModelVersionRunByModelUID.defaultExpectation.paramPtrs.ctx = &ctx + mmGetLatestModelVersionRunByModelUID.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmGetLatestModelVersionRunByModelUID } @@ -4216,6 +4542,7 @@ func (mmGetLatestModelVersionRunByModelUID *mRepositoryMockGetLatestModelVersion mmGetLatestModelVersionRunByModelUID.defaultExpectation.paramPtrs = &RepositoryMockGetLatestModelVersionRunByModelUIDParamPtrs{} } mmGetLatestModelVersionRunByModelUID.defaultExpectation.paramPtrs.userUID = &userUID + mmGetLatestModelVersionRunByModelUID.defaultExpectation.expectationOrigins.originUserUID = minimock.CallerInfo(1) return mmGetLatestModelVersionRunByModelUID } @@ -4238,6 +4565,7 @@ func (mmGetLatestModelVersionRunByModelUID *mRepositoryMockGetLatestModelVersion mmGetLatestModelVersionRunByModelUID.defaultExpectation.paramPtrs = &RepositoryMockGetLatestModelVersionRunByModelUIDParamPtrs{} } mmGetLatestModelVersionRunByModelUID.defaultExpectation.paramPtrs.modelUID = &modelUID + mmGetLatestModelVersionRunByModelUID.defaultExpectation.expectationOrigins.originModelUID = minimock.CallerInfo(1) return mmGetLatestModelVersionRunByModelUID } @@ -4260,6 +4588,7 @@ func (mmGetLatestModelVersionRunByModelUID *mRepositoryMockGetLatestModelVersion mmGetLatestModelVersionRunByModelUID.defaultExpectation.paramPtrs = &RepositoryMockGetLatestModelVersionRunByModelUIDParamPtrs{} } mmGetLatestModelVersionRunByModelUID.defaultExpectation.paramPtrs.version = &version + mmGetLatestModelVersionRunByModelUID.defaultExpectation.expectationOrigins.originVersion = minimock.CallerInfo(1) return mmGetLatestModelVersionRunByModelUID } @@ -4285,6 +4614,7 @@ func (mmGetLatestModelVersionRunByModelUID *mRepositoryMockGetLatestModelVersion mmGetLatestModelVersionRunByModelUID.defaultExpectation = &RepositoryMockGetLatestModelVersionRunByModelUIDExpectation{mock: mmGetLatestModelVersionRunByModelUID.mock} } mmGetLatestModelVersionRunByModelUID.defaultExpectation.results = &RepositoryMockGetLatestModelVersionRunByModelUIDResults{modelRun, err} + mmGetLatestModelVersionRunByModelUID.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmGetLatestModelVersionRunByModelUID.mock } @@ -4299,6 +4629,7 @@ func (mmGetLatestModelVersionRunByModelUID *mRepositoryMockGetLatestModelVersion } mmGetLatestModelVersionRunByModelUID.mock.funcGetLatestModelVersionRunByModelUID = f + mmGetLatestModelVersionRunByModelUID.mock.funcGetLatestModelVersionRunByModelUIDOrigin = minimock.CallerInfo(1) return mmGetLatestModelVersionRunByModelUID.mock } @@ -4310,8 +4641,9 @@ func (mmGetLatestModelVersionRunByModelUID *mRepositoryMockGetLatestModelVersion } expectation := &RepositoryMockGetLatestModelVersionRunByModelUIDExpectation{ - mock: mmGetLatestModelVersionRunByModelUID.mock, - params: &RepositoryMockGetLatestModelVersionRunByModelUIDParams{ctx, userUID, modelUID, version}, + mock: mmGetLatestModelVersionRunByModelUID.mock, + params: &RepositoryMockGetLatestModelVersionRunByModelUIDParams{ctx, userUID, modelUID, version}, + expectationOrigins: RepositoryMockGetLatestModelVersionRunByModelUIDExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmGetLatestModelVersionRunByModelUID.expectations = append(mmGetLatestModelVersionRunByModelUID.expectations, expectation) return expectation @@ -4329,6 +4661,7 @@ func (mmGetLatestModelVersionRunByModelUID *mRepositoryMockGetLatestModelVersion mmGetLatestModelVersionRunByModelUID.mock.t.Fatalf("Times of RepositoryMock.GetLatestModelVersionRunByModelUID mock can not be zero") } mm_atomic.StoreUint64(&mmGetLatestModelVersionRunByModelUID.expectedInvocations, n) + mmGetLatestModelVersionRunByModelUID.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmGetLatestModelVersionRunByModelUID } @@ -4343,11 +4676,13 @@ func (mmGetLatestModelVersionRunByModelUID *mRepositoryMockGetLatestModelVersion return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// GetLatestModelVersionRunByModelUID implements repository.Repository +// GetLatestModelVersionRunByModelUID implements mm_repository.Repository func (mmGetLatestModelVersionRunByModelUID *RepositoryMock) GetLatestModelVersionRunByModelUID(ctx context.Context, userUID string, modelUID string, version string) (modelRun *datamodel.ModelRun, err error) { mm_atomic.AddUint64(&mmGetLatestModelVersionRunByModelUID.beforeGetLatestModelVersionRunByModelUIDCounter, 1) defer mm_atomic.AddUint64(&mmGetLatestModelVersionRunByModelUID.afterGetLatestModelVersionRunByModelUIDCounter, 1) + mmGetLatestModelVersionRunByModelUID.t.Helper() + if mmGetLatestModelVersionRunByModelUID.inspectFuncGetLatestModelVersionRunByModelUID != nil { mmGetLatestModelVersionRunByModelUID.inspectFuncGetLatestModelVersionRunByModelUID(ctx, userUID, modelUID, version) } @@ -4376,23 +4711,28 @@ func (mmGetLatestModelVersionRunByModelUID *RepositoryMock) GetLatestModelVersio if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmGetLatestModelVersionRunByModelUID.t.Errorf("RepositoryMock.GetLatestModelVersionRunByModelUID got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmGetLatestModelVersionRunByModelUID.t.Errorf("RepositoryMock.GetLatestModelVersionRunByModelUID got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetLatestModelVersionRunByModelUID.GetLatestModelVersionRunByModelUIDMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.userUID != nil && !minimock.Equal(*mm_want_ptrs.userUID, mm_got.userUID) { - mmGetLatestModelVersionRunByModelUID.t.Errorf("RepositoryMock.GetLatestModelVersionRunByModelUID got unexpected parameter userUID, want: %#v, got: %#v%s\n", *mm_want_ptrs.userUID, mm_got.userUID, minimock.Diff(*mm_want_ptrs.userUID, mm_got.userUID)) + mmGetLatestModelVersionRunByModelUID.t.Errorf("RepositoryMock.GetLatestModelVersionRunByModelUID got unexpected parameter userUID, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetLatestModelVersionRunByModelUID.GetLatestModelVersionRunByModelUIDMock.defaultExpectation.expectationOrigins.originUserUID, *mm_want_ptrs.userUID, mm_got.userUID, minimock.Diff(*mm_want_ptrs.userUID, mm_got.userUID)) } if mm_want_ptrs.modelUID != nil && !minimock.Equal(*mm_want_ptrs.modelUID, mm_got.modelUID) { - mmGetLatestModelVersionRunByModelUID.t.Errorf("RepositoryMock.GetLatestModelVersionRunByModelUID got unexpected parameter modelUID, want: %#v, got: %#v%s\n", *mm_want_ptrs.modelUID, mm_got.modelUID, minimock.Diff(*mm_want_ptrs.modelUID, mm_got.modelUID)) + mmGetLatestModelVersionRunByModelUID.t.Errorf("RepositoryMock.GetLatestModelVersionRunByModelUID got unexpected parameter modelUID, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetLatestModelVersionRunByModelUID.GetLatestModelVersionRunByModelUIDMock.defaultExpectation.expectationOrigins.originModelUID, *mm_want_ptrs.modelUID, mm_got.modelUID, minimock.Diff(*mm_want_ptrs.modelUID, mm_got.modelUID)) } if mm_want_ptrs.version != nil && !minimock.Equal(*mm_want_ptrs.version, mm_got.version) { - mmGetLatestModelVersionRunByModelUID.t.Errorf("RepositoryMock.GetLatestModelVersionRunByModelUID got unexpected parameter version, want: %#v, got: %#v%s\n", *mm_want_ptrs.version, mm_got.version, minimock.Diff(*mm_want_ptrs.version, mm_got.version)) + mmGetLatestModelVersionRunByModelUID.t.Errorf("RepositoryMock.GetLatestModelVersionRunByModelUID got unexpected parameter version, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetLatestModelVersionRunByModelUID.GetLatestModelVersionRunByModelUIDMock.defaultExpectation.expectationOrigins.originVersion, *mm_want_ptrs.version, mm_got.version, minimock.Diff(*mm_want_ptrs.version, mm_got.version)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmGetLatestModelVersionRunByModelUID.t.Errorf("RepositoryMock.GetLatestModelVersionRunByModelUID got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmGetLatestModelVersionRunByModelUID.t.Errorf("RepositoryMock.GetLatestModelVersionRunByModelUID got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetLatestModelVersionRunByModelUID.GetLatestModelVersionRunByModelUIDMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmGetLatestModelVersionRunByModelUID.GetLatestModelVersionRunByModelUIDMock.defaultExpectation.results @@ -4452,7 +4792,7 @@ func (m *RepositoryMock) MinimockGetLatestModelVersionRunByModelUIDDone() bool { func (m *RepositoryMock) MinimockGetLatestModelVersionRunByModelUIDInspect() { for _, e := range m.GetLatestModelVersionRunByModelUIDMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.GetLatestModelVersionRunByModelUID with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.GetLatestModelVersionRunByModelUID at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -4460,19 +4800,19 @@ func (m *RepositoryMock) MinimockGetLatestModelVersionRunByModelUIDInspect() { // if default expectation was set then invocations count should be greater than zero if m.GetLatestModelVersionRunByModelUIDMock.defaultExpectation != nil && afterGetLatestModelVersionRunByModelUIDCounter < 1 { if m.GetLatestModelVersionRunByModelUIDMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.GetLatestModelVersionRunByModelUID") + m.t.Errorf("Expected call to RepositoryMock.GetLatestModelVersionRunByModelUID at\n%s", m.GetLatestModelVersionRunByModelUIDMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.GetLatestModelVersionRunByModelUID with params: %#v", *m.GetLatestModelVersionRunByModelUIDMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.GetLatestModelVersionRunByModelUID at\n%s with params: %#v", m.GetLatestModelVersionRunByModelUIDMock.defaultExpectation.expectationOrigins.origin, *m.GetLatestModelVersionRunByModelUIDMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcGetLatestModelVersionRunByModelUID != nil && afterGetLatestModelVersionRunByModelUIDCounter < 1 { - m.t.Error("Expected call to RepositoryMock.GetLatestModelVersionRunByModelUID") + m.t.Errorf("Expected call to RepositoryMock.GetLatestModelVersionRunByModelUID at\n%s", m.funcGetLatestModelVersionRunByModelUIDOrigin) } if !m.GetLatestModelVersionRunByModelUIDMock.invocationsDone() && afterGetLatestModelVersionRunByModelUIDCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.GetLatestModelVersionRunByModelUID but found %d calls", - mm_atomic.LoadUint64(&m.GetLatestModelVersionRunByModelUIDMock.expectedInvocations), afterGetLatestModelVersionRunByModelUIDCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.GetLatestModelVersionRunByModelUID at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.GetLatestModelVersionRunByModelUIDMock.expectedInvocations), m.GetLatestModelVersionRunByModelUIDMock.expectedInvocationsOrigin, afterGetLatestModelVersionRunByModelUIDCounter) } } @@ -4485,16 +4825,19 @@ type mRepositoryMockGetModelByUID struct { callArgs []*RepositoryMockGetModelByUIDParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockGetModelByUIDExpectation specifies expectation struct of the Repository.GetModelByUID type RepositoryMockGetModelByUIDExpectation struct { - mock *RepositoryMock - params *RepositoryMockGetModelByUIDParams - paramPtrs *RepositoryMockGetModelByUIDParamPtrs - results *RepositoryMockGetModelByUIDResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockGetModelByUIDParams + paramPtrs *RepositoryMockGetModelByUIDParamPtrs + expectationOrigins RepositoryMockGetModelByUIDExpectationOrigins + results *RepositoryMockGetModelByUIDResults + returnOrigin string + Counter uint64 } // RepositoryMockGetModelByUIDParams contains parameters of the Repository.GetModelByUID @@ -4519,6 +4862,15 @@ type RepositoryMockGetModelByUIDResults struct { err error } +// RepositoryMockGetModelByUIDOrigins contains origins of expectations of the Repository.GetModelByUID +type RepositoryMockGetModelByUIDExpectationOrigins struct { + origin string + originCtx string + originUid string + originIsBasicView string + originIncludeAvatar string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -4544,6 +4896,7 @@ func (mmGetModelByUID *mRepositoryMockGetModelByUID) Expect(ctx context.Context, } mmGetModelByUID.defaultExpectation.params = &RepositoryMockGetModelByUIDParams{ctx, uid, isBasicView, includeAvatar} + mmGetModelByUID.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmGetModelByUID.expectations { if minimock.Equal(e.params, mmGetModelByUID.defaultExpectation.params) { mmGetModelByUID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetModelByUID.defaultExpectation.params) @@ -4571,6 +4924,7 @@ func (mmGetModelByUID *mRepositoryMockGetModelByUID) ExpectCtxParam1(ctx context mmGetModelByUID.defaultExpectation.paramPtrs = &RepositoryMockGetModelByUIDParamPtrs{} } mmGetModelByUID.defaultExpectation.paramPtrs.ctx = &ctx + mmGetModelByUID.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmGetModelByUID } @@ -4593,6 +4947,7 @@ func (mmGetModelByUID *mRepositoryMockGetModelByUID) ExpectUidParam2(uid uuid.UU mmGetModelByUID.defaultExpectation.paramPtrs = &RepositoryMockGetModelByUIDParamPtrs{} } mmGetModelByUID.defaultExpectation.paramPtrs.uid = &uid + mmGetModelByUID.defaultExpectation.expectationOrigins.originUid = minimock.CallerInfo(1) return mmGetModelByUID } @@ -4615,6 +4970,7 @@ func (mmGetModelByUID *mRepositoryMockGetModelByUID) ExpectIsBasicViewParam3(isB mmGetModelByUID.defaultExpectation.paramPtrs = &RepositoryMockGetModelByUIDParamPtrs{} } mmGetModelByUID.defaultExpectation.paramPtrs.isBasicView = &isBasicView + mmGetModelByUID.defaultExpectation.expectationOrigins.originIsBasicView = minimock.CallerInfo(1) return mmGetModelByUID } @@ -4637,6 +4993,7 @@ func (mmGetModelByUID *mRepositoryMockGetModelByUID) ExpectIncludeAvatarParam4(i mmGetModelByUID.defaultExpectation.paramPtrs = &RepositoryMockGetModelByUIDParamPtrs{} } mmGetModelByUID.defaultExpectation.paramPtrs.includeAvatar = &includeAvatar + mmGetModelByUID.defaultExpectation.expectationOrigins.originIncludeAvatar = minimock.CallerInfo(1) return mmGetModelByUID } @@ -4662,6 +5019,7 @@ func (mmGetModelByUID *mRepositoryMockGetModelByUID) Return(mp1 *datamodel.Model mmGetModelByUID.defaultExpectation = &RepositoryMockGetModelByUIDExpectation{mock: mmGetModelByUID.mock} } mmGetModelByUID.defaultExpectation.results = &RepositoryMockGetModelByUIDResults{mp1, err} + mmGetModelByUID.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmGetModelByUID.mock } @@ -4676,6 +5034,7 @@ func (mmGetModelByUID *mRepositoryMockGetModelByUID) Set(f func(ctx context.Cont } mmGetModelByUID.mock.funcGetModelByUID = f + mmGetModelByUID.mock.funcGetModelByUIDOrigin = minimock.CallerInfo(1) return mmGetModelByUID.mock } @@ -4687,8 +5046,9 @@ func (mmGetModelByUID *mRepositoryMockGetModelByUID) When(ctx context.Context, u } expectation := &RepositoryMockGetModelByUIDExpectation{ - mock: mmGetModelByUID.mock, - params: &RepositoryMockGetModelByUIDParams{ctx, uid, isBasicView, includeAvatar}, + mock: mmGetModelByUID.mock, + params: &RepositoryMockGetModelByUIDParams{ctx, uid, isBasicView, includeAvatar}, + expectationOrigins: RepositoryMockGetModelByUIDExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmGetModelByUID.expectations = append(mmGetModelByUID.expectations, expectation) return expectation @@ -4706,6 +5066,7 @@ func (mmGetModelByUID *mRepositoryMockGetModelByUID) Times(n uint64) *mRepositor mmGetModelByUID.mock.t.Fatalf("Times of RepositoryMock.GetModelByUID mock can not be zero") } mm_atomic.StoreUint64(&mmGetModelByUID.expectedInvocations, n) + mmGetModelByUID.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmGetModelByUID } @@ -4720,11 +5081,13 @@ func (mmGetModelByUID *mRepositoryMockGetModelByUID) invocationsDone() bool { return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// GetModelByUID implements repository.Repository +// GetModelByUID implements mm_repository.Repository func (mmGetModelByUID *RepositoryMock) GetModelByUID(ctx context.Context, uid uuid.UUID, isBasicView bool, includeAvatar bool) (mp1 *datamodel.Model, err error) { mm_atomic.AddUint64(&mmGetModelByUID.beforeGetModelByUIDCounter, 1) defer mm_atomic.AddUint64(&mmGetModelByUID.afterGetModelByUIDCounter, 1) + mmGetModelByUID.t.Helper() + if mmGetModelByUID.inspectFuncGetModelByUID != nil { mmGetModelByUID.inspectFuncGetModelByUID(ctx, uid, isBasicView, includeAvatar) } @@ -4753,23 +5116,28 @@ func (mmGetModelByUID *RepositoryMock) GetModelByUID(ctx context.Context, uid uu if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmGetModelByUID.t.Errorf("RepositoryMock.GetModelByUID got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmGetModelByUID.t.Errorf("RepositoryMock.GetModelByUID got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetModelByUID.GetModelByUIDMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.uid != nil && !minimock.Equal(*mm_want_ptrs.uid, mm_got.uid) { - mmGetModelByUID.t.Errorf("RepositoryMock.GetModelByUID got unexpected parameter uid, want: %#v, got: %#v%s\n", *mm_want_ptrs.uid, mm_got.uid, minimock.Diff(*mm_want_ptrs.uid, mm_got.uid)) + mmGetModelByUID.t.Errorf("RepositoryMock.GetModelByUID got unexpected parameter uid, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetModelByUID.GetModelByUIDMock.defaultExpectation.expectationOrigins.originUid, *mm_want_ptrs.uid, mm_got.uid, minimock.Diff(*mm_want_ptrs.uid, mm_got.uid)) } if mm_want_ptrs.isBasicView != nil && !minimock.Equal(*mm_want_ptrs.isBasicView, mm_got.isBasicView) { - mmGetModelByUID.t.Errorf("RepositoryMock.GetModelByUID got unexpected parameter isBasicView, want: %#v, got: %#v%s\n", *mm_want_ptrs.isBasicView, mm_got.isBasicView, minimock.Diff(*mm_want_ptrs.isBasicView, mm_got.isBasicView)) + mmGetModelByUID.t.Errorf("RepositoryMock.GetModelByUID got unexpected parameter isBasicView, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetModelByUID.GetModelByUIDMock.defaultExpectation.expectationOrigins.originIsBasicView, *mm_want_ptrs.isBasicView, mm_got.isBasicView, minimock.Diff(*mm_want_ptrs.isBasicView, mm_got.isBasicView)) } if mm_want_ptrs.includeAvatar != nil && !minimock.Equal(*mm_want_ptrs.includeAvatar, mm_got.includeAvatar) { - mmGetModelByUID.t.Errorf("RepositoryMock.GetModelByUID got unexpected parameter includeAvatar, want: %#v, got: %#v%s\n", *mm_want_ptrs.includeAvatar, mm_got.includeAvatar, minimock.Diff(*mm_want_ptrs.includeAvatar, mm_got.includeAvatar)) + mmGetModelByUID.t.Errorf("RepositoryMock.GetModelByUID got unexpected parameter includeAvatar, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetModelByUID.GetModelByUIDMock.defaultExpectation.expectationOrigins.originIncludeAvatar, *mm_want_ptrs.includeAvatar, mm_got.includeAvatar, minimock.Diff(*mm_want_ptrs.includeAvatar, mm_got.includeAvatar)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmGetModelByUID.t.Errorf("RepositoryMock.GetModelByUID got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmGetModelByUID.t.Errorf("RepositoryMock.GetModelByUID got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetModelByUID.GetModelByUIDMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmGetModelByUID.GetModelByUIDMock.defaultExpectation.results @@ -4829,7 +5197,7 @@ func (m *RepositoryMock) MinimockGetModelByUIDDone() bool { func (m *RepositoryMock) MinimockGetModelByUIDInspect() { for _, e := range m.GetModelByUIDMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.GetModelByUID with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.GetModelByUID at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -4837,19 +5205,19 @@ func (m *RepositoryMock) MinimockGetModelByUIDInspect() { // if default expectation was set then invocations count should be greater than zero if m.GetModelByUIDMock.defaultExpectation != nil && afterGetModelByUIDCounter < 1 { if m.GetModelByUIDMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.GetModelByUID") + m.t.Errorf("Expected call to RepositoryMock.GetModelByUID at\n%s", m.GetModelByUIDMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.GetModelByUID with params: %#v", *m.GetModelByUIDMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.GetModelByUID at\n%s with params: %#v", m.GetModelByUIDMock.defaultExpectation.expectationOrigins.origin, *m.GetModelByUIDMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcGetModelByUID != nil && afterGetModelByUIDCounter < 1 { - m.t.Error("Expected call to RepositoryMock.GetModelByUID") + m.t.Errorf("Expected call to RepositoryMock.GetModelByUID at\n%s", m.funcGetModelByUIDOrigin) } if !m.GetModelByUIDMock.invocationsDone() && afterGetModelByUIDCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.GetModelByUID but found %d calls", - mm_atomic.LoadUint64(&m.GetModelByUIDMock.expectedInvocations), afterGetModelByUIDCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.GetModelByUID at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.GetModelByUIDMock.expectedInvocations), m.GetModelByUIDMock.expectedInvocationsOrigin, afterGetModelByUIDCounter) } } @@ -4862,16 +5230,19 @@ type mRepositoryMockGetModelByUIDAdmin struct { callArgs []*RepositoryMockGetModelByUIDAdminParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockGetModelByUIDAdminExpectation specifies expectation struct of the Repository.GetModelByUIDAdmin type RepositoryMockGetModelByUIDAdminExpectation struct { - mock *RepositoryMock - params *RepositoryMockGetModelByUIDAdminParams - paramPtrs *RepositoryMockGetModelByUIDAdminParamPtrs - results *RepositoryMockGetModelByUIDAdminResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockGetModelByUIDAdminParams + paramPtrs *RepositoryMockGetModelByUIDAdminParamPtrs + expectationOrigins RepositoryMockGetModelByUIDAdminExpectationOrigins + results *RepositoryMockGetModelByUIDAdminResults + returnOrigin string + Counter uint64 } // RepositoryMockGetModelByUIDAdminParams contains parameters of the Repository.GetModelByUIDAdmin @@ -4896,6 +5267,15 @@ type RepositoryMockGetModelByUIDAdminResults struct { err error } +// RepositoryMockGetModelByUIDAdminOrigins contains origins of expectations of the Repository.GetModelByUIDAdmin +type RepositoryMockGetModelByUIDAdminExpectationOrigins struct { + origin string + originCtx string + originUid string + originIsBasicView string + originIncludeAvatar string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -4921,6 +5301,7 @@ func (mmGetModelByUIDAdmin *mRepositoryMockGetModelByUIDAdmin) Expect(ctx contex } mmGetModelByUIDAdmin.defaultExpectation.params = &RepositoryMockGetModelByUIDAdminParams{ctx, uid, isBasicView, includeAvatar} + mmGetModelByUIDAdmin.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmGetModelByUIDAdmin.expectations { if minimock.Equal(e.params, mmGetModelByUIDAdmin.defaultExpectation.params) { mmGetModelByUIDAdmin.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetModelByUIDAdmin.defaultExpectation.params) @@ -4948,6 +5329,7 @@ func (mmGetModelByUIDAdmin *mRepositoryMockGetModelByUIDAdmin) ExpectCtxParam1(c mmGetModelByUIDAdmin.defaultExpectation.paramPtrs = &RepositoryMockGetModelByUIDAdminParamPtrs{} } mmGetModelByUIDAdmin.defaultExpectation.paramPtrs.ctx = &ctx + mmGetModelByUIDAdmin.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmGetModelByUIDAdmin } @@ -4970,6 +5352,7 @@ func (mmGetModelByUIDAdmin *mRepositoryMockGetModelByUIDAdmin) ExpectUidParam2(u mmGetModelByUIDAdmin.defaultExpectation.paramPtrs = &RepositoryMockGetModelByUIDAdminParamPtrs{} } mmGetModelByUIDAdmin.defaultExpectation.paramPtrs.uid = &uid + mmGetModelByUIDAdmin.defaultExpectation.expectationOrigins.originUid = minimock.CallerInfo(1) return mmGetModelByUIDAdmin } @@ -4992,6 +5375,7 @@ func (mmGetModelByUIDAdmin *mRepositoryMockGetModelByUIDAdmin) ExpectIsBasicView mmGetModelByUIDAdmin.defaultExpectation.paramPtrs = &RepositoryMockGetModelByUIDAdminParamPtrs{} } mmGetModelByUIDAdmin.defaultExpectation.paramPtrs.isBasicView = &isBasicView + mmGetModelByUIDAdmin.defaultExpectation.expectationOrigins.originIsBasicView = minimock.CallerInfo(1) return mmGetModelByUIDAdmin } @@ -5014,6 +5398,7 @@ func (mmGetModelByUIDAdmin *mRepositoryMockGetModelByUIDAdmin) ExpectIncludeAvat mmGetModelByUIDAdmin.defaultExpectation.paramPtrs = &RepositoryMockGetModelByUIDAdminParamPtrs{} } mmGetModelByUIDAdmin.defaultExpectation.paramPtrs.includeAvatar = &includeAvatar + mmGetModelByUIDAdmin.defaultExpectation.expectationOrigins.originIncludeAvatar = minimock.CallerInfo(1) return mmGetModelByUIDAdmin } @@ -5039,6 +5424,7 @@ func (mmGetModelByUIDAdmin *mRepositoryMockGetModelByUIDAdmin) Return(mp1 *datam mmGetModelByUIDAdmin.defaultExpectation = &RepositoryMockGetModelByUIDAdminExpectation{mock: mmGetModelByUIDAdmin.mock} } mmGetModelByUIDAdmin.defaultExpectation.results = &RepositoryMockGetModelByUIDAdminResults{mp1, err} + mmGetModelByUIDAdmin.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmGetModelByUIDAdmin.mock } @@ -5053,6 +5439,7 @@ func (mmGetModelByUIDAdmin *mRepositoryMockGetModelByUIDAdmin) Set(f func(ctx co } mmGetModelByUIDAdmin.mock.funcGetModelByUIDAdmin = f + mmGetModelByUIDAdmin.mock.funcGetModelByUIDAdminOrigin = minimock.CallerInfo(1) return mmGetModelByUIDAdmin.mock } @@ -5064,8 +5451,9 @@ func (mmGetModelByUIDAdmin *mRepositoryMockGetModelByUIDAdmin) When(ctx context. } expectation := &RepositoryMockGetModelByUIDAdminExpectation{ - mock: mmGetModelByUIDAdmin.mock, - params: &RepositoryMockGetModelByUIDAdminParams{ctx, uid, isBasicView, includeAvatar}, + mock: mmGetModelByUIDAdmin.mock, + params: &RepositoryMockGetModelByUIDAdminParams{ctx, uid, isBasicView, includeAvatar}, + expectationOrigins: RepositoryMockGetModelByUIDAdminExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmGetModelByUIDAdmin.expectations = append(mmGetModelByUIDAdmin.expectations, expectation) return expectation @@ -5083,6 +5471,7 @@ func (mmGetModelByUIDAdmin *mRepositoryMockGetModelByUIDAdmin) Times(n uint64) * mmGetModelByUIDAdmin.mock.t.Fatalf("Times of RepositoryMock.GetModelByUIDAdmin mock can not be zero") } mm_atomic.StoreUint64(&mmGetModelByUIDAdmin.expectedInvocations, n) + mmGetModelByUIDAdmin.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmGetModelByUIDAdmin } @@ -5097,11 +5486,13 @@ func (mmGetModelByUIDAdmin *mRepositoryMockGetModelByUIDAdmin) invocationsDone() return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// GetModelByUIDAdmin implements repository.Repository +// GetModelByUIDAdmin implements mm_repository.Repository func (mmGetModelByUIDAdmin *RepositoryMock) GetModelByUIDAdmin(ctx context.Context, uid uuid.UUID, isBasicView bool, includeAvatar bool) (mp1 *datamodel.Model, err error) { mm_atomic.AddUint64(&mmGetModelByUIDAdmin.beforeGetModelByUIDAdminCounter, 1) defer mm_atomic.AddUint64(&mmGetModelByUIDAdmin.afterGetModelByUIDAdminCounter, 1) + mmGetModelByUIDAdmin.t.Helper() + if mmGetModelByUIDAdmin.inspectFuncGetModelByUIDAdmin != nil { mmGetModelByUIDAdmin.inspectFuncGetModelByUIDAdmin(ctx, uid, isBasicView, includeAvatar) } @@ -5130,23 +5521,28 @@ func (mmGetModelByUIDAdmin *RepositoryMock) GetModelByUIDAdmin(ctx context.Conte if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmGetModelByUIDAdmin.t.Errorf("RepositoryMock.GetModelByUIDAdmin got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmGetModelByUIDAdmin.t.Errorf("RepositoryMock.GetModelByUIDAdmin got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetModelByUIDAdmin.GetModelByUIDAdminMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.uid != nil && !minimock.Equal(*mm_want_ptrs.uid, mm_got.uid) { - mmGetModelByUIDAdmin.t.Errorf("RepositoryMock.GetModelByUIDAdmin got unexpected parameter uid, want: %#v, got: %#v%s\n", *mm_want_ptrs.uid, mm_got.uid, minimock.Diff(*mm_want_ptrs.uid, mm_got.uid)) + mmGetModelByUIDAdmin.t.Errorf("RepositoryMock.GetModelByUIDAdmin got unexpected parameter uid, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetModelByUIDAdmin.GetModelByUIDAdminMock.defaultExpectation.expectationOrigins.originUid, *mm_want_ptrs.uid, mm_got.uid, minimock.Diff(*mm_want_ptrs.uid, mm_got.uid)) } if mm_want_ptrs.isBasicView != nil && !minimock.Equal(*mm_want_ptrs.isBasicView, mm_got.isBasicView) { - mmGetModelByUIDAdmin.t.Errorf("RepositoryMock.GetModelByUIDAdmin got unexpected parameter isBasicView, want: %#v, got: %#v%s\n", *mm_want_ptrs.isBasicView, mm_got.isBasicView, minimock.Diff(*mm_want_ptrs.isBasicView, mm_got.isBasicView)) + mmGetModelByUIDAdmin.t.Errorf("RepositoryMock.GetModelByUIDAdmin got unexpected parameter isBasicView, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetModelByUIDAdmin.GetModelByUIDAdminMock.defaultExpectation.expectationOrigins.originIsBasicView, *mm_want_ptrs.isBasicView, mm_got.isBasicView, minimock.Diff(*mm_want_ptrs.isBasicView, mm_got.isBasicView)) } if mm_want_ptrs.includeAvatar != nil && !minimock.Equal(*mm_want_ptrs.includeAvatar, mm_got.includeAvatar) { - mmGetModelByUIDAdmin.t.Errorf("RepositoryMock.GetModelByUIDAdmin got unexpected parameter includeAvatar, want: %#v, got: %#v%s\n", *mm_want_ptrs.includeAvatar, mm_got.includeAvatar, minimock.Diff(*mm_want_ptrs.includeAvatar, mm_got.includeAvatar)) + mmGetModelByUIDAdmin.t.Errorf("RepositoryMock.GetModelByUIDAdmin got unexpected parameter includeAvatar, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetModelByUIDAdmin.GetModelByUIDAdminMock.defaultExpectation.expectationOrigins.originIncludeAvatar, *mm_want_ptrs.includeAvatar, mm_got.includeAvatar, minimock.Diff(*mm_want_ptrs.includeAvatar, mm_got.includeAvatar)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmGetModelByUIDAdmin.t.Errorf("RepositoryMock.GetModelByUIDAdmin got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmGetModelByUIDAdmin.t.Errorf("RepositoryMock.GetModelByUIDAdmin got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetModelByUIDAdmin.GetModelByUIDAdminMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmGetModelByUIDAdmin.GetModelByUIDAdminMock.defaultExpectation.results @@ -5206,7 +5602,7 @@ func (m *RepositoryMock) MinimockGetModelByUIDAdminDone() bool { func (m *RepositoryMock) MinimockGetModelByUIDAdminInspect() { for _, e := range m.GetModelByUIDAdminMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.GetModelByUIDAdmin with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.GetModelByUIDAdmin at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -5214,19 +5610,19 @@ func (m *RepositoryMock) MinimockGetModelByUIDAdminInspect() { // if default expectation was set then invocations count should be greater than zero if m.GetModelByUIDAdminMock.defaultExpectation != nil && afterGetModelByUIDAdminCounter < 1 { if m.GetModelByUIDAdminMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.GetModelByUIDAdmin") + m.t.Errorf("Expected call to RepositoryMock.GetModelByUIDAdmin at\n%s", m.GetModelByUIDAdminMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.GetModelByUIDAdmin with params: %#v", *m.GetModelByUIDAdminMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.GetModelByUIDAdmin at\n%s with params: %#v", m.GetModelByUIDAdminMock.defaultExpectation.expectationOrigins.origin, *m.GetModelByUIDAdminMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcGetModelByUIDAdmin != nil && afterGetModelByUIDAdminCounter < 1 { - m.t.Error("Expected call to RepositoryMock.GetModelByUIDAdmin") + m.t.Errorf("Expected call to RepositoryMock.GetModelByUIDAdmin at\n%s", m.funcGetModelByUIDAdminOrigin) } if !m.GetModelByUIDAdminMock.invocationsDone() && afterGetModelByUIDAdminCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.GetModelByUIDAdmin but found %d calls", - mm_atomic.LoadUint64(&m.GetModelByUIDAdminMock.expectedInvocations), afterGetModelByUIDAdminCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.GetModelByUIDAdmin at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.GetModelByUIDAdminMock.expectedInvocations), m.GetModelByUIDAdminMock.expectedInvocationsOrigin, afterGetModelByUIDAdminCounter) } } @@ -5239,16 +5635,19 @@ type mRepositoryMockGetModelDefinition struct { callArgs []*RepositoryMockGetModelDefinitionParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockGetModelDefinitionExpectation specifies expectation struct of the Repository.GetModelDefinition type RepositoryMockGetModelDefinitionExpectation struct { - mock *RepositoryMock - params *RepositoryMockGetModelDefinitionParams - paramPtrs *RepositoryMockGetModelDefinitionParamPtrs - results *RepositoryMockGetModelDefinitionResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockGetModelDefinitionParams + paramPtrs *RepositoryMockGetModelDefinitionParamPtrs + expectationOrigins RepositoryMockGetModelDefinitionExpectationOrigins + results *RepositoryMockGetModelDefinitionResults + returnOrigin string + Counter uint64 } // RepositoryMockGetModelDefinitionParams contains parameters of the Repository.GetModelDefinition @@ -5267,6 +5666,12 @@ type RepositoryMockGetModelDefinitionResults struct { err error } +// RepositoryMockGetModelDefinitionOrigins contains origins of expectations of the Repository.GetModelDefinition +type RepositoryMockGetModelDefinitionExpectationOrigins struct { + origin string + originId string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -5292,6 +5697,7 @@ func (mmGetModelDefinition *mRepositoryMockGetModelDefinition) Expect(id string) } mmGetModelDefinition.defaultExpectation.params = &RepositoryMockGetModelDefinitionParams{id} + mmGetModelDefinition.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmGetModelDefinition.expectations { if minimock.Equal(e.params, mmGetModelDefinition.defaultExpectation.params) { mmGetModelDefinition.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetModelDefinition.defaultExpectation.params) @@ -5319,6 +5725,7 @@ func (mmGetModelDefinition *mRepositoryMockGetModelDefinition) ExpectIdParam1(id mmGetModelDefinition.defaultExpectation.paramPtrs = &RepositoryMockGetModelDefinitionParamPtrs{} } mmGetModelDefinition.defaultExpectation.paramPtrs.id = &id + mmGetModelDefinition.defaultExpectation.expectationOrigins.originId = minimock.CallerInfo(1) return mmGetModelDefinition } @@ -5344,6 +5751,7 @@ func (mmGetModelDefinition *mRepositoryMockGetModelDefinition) Return(mp1 *datam mmGetModelDefinition.defaultExpectation = &RepositoryMockGetModelDefinitionExpectation{mock: mmGetModelDefinition.mock} } mmGetModelDefinition.defaultExpectation.results = &RepositoryMockGetModelDefinitionResults{mp1, err} + mmGetModelDefinition.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmGetModelDefinition.mock } @@ -5358,6 +5766,7 @@ func (mmGetModelDefinition *mRepositoryMockGetModelDefinition) Set(f func(id str } mmGetModelDefinition.mock.funcGetModelDefinition = f + mmGetModelDefinition.mock.funcGetModelDefinitionOrigin = minimock.CallerInfo(1) return mmGetModelDefinition.mock } @@ -5369,8 +5778,9 @@ func (mmGetModelDefinition *mRepositoryMockGetModelDefinition) When(id string) * } expectation := &RepositoryMockGetModelDefinitionExpectation{ - mock: mmGetModelDefinition.mock, - params: &RepositoryMockGetModelDefinitionParams{id}, + mock: mmGetModelDefinition.mock, + params: &RepositoryMockGetModelDefinitionParams{id}, + expectationOrigins: RepositoryMockGetModelDefinitionExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmGetModelDefinition.expectations = append(mmGetModelDefinition.expectations, expectation) return expectation @@ -5388,6 +5798,7 @@ func (mmGetModelDefinition *mRepositoryMockGetModelDefinition) Times(n uint64) * mmGetModelDefinition.mock.t.Fatalf("Times of RepositoryMock.GetModelDefinition mock can not be zero") } mm_atomic.StoreUint64(&mmGetModelDefinition.expectedInvocations, n) + mmGetModelDefinition.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmGetModelDefinition } @@ -5402,11 +5813,13 @@ func (mmGetModelDefinition *mRepositoryMockGetModelDefinition) invocationsDone() return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// GetModelDefinition implements repository.Repository +// GetModelDefinition implements mm_repository.Repository func (mmGetModelDefinition *RepositoryMock) GetModelDefinition(id string) (mp1 *datamodel.ModelDefinition, err error) { mm_atomic.AddUint64(&mmGetModelDefinition.beforeGetModelDefinitionCounter, 1) defer mm_atomic.AddUint64(&mmGetModelDefinition.afterGetModelDefinitionCounter, 1) + mmGetModelDefinition.t.Helper() + if mmGetModelDefinition.inspectFuncGetModelDefinition != nil { mmGetModelDefinition.inspectFuncGetModelDefinition(id) } @@ -5435,11 +5848,13 @@ func (mmGetModelDefinition *RepositoryMock) GetModelDefinition(id string) (mp1 * if mm_want_ptrs != nil { if mm_want_ptrs.id != nil && !minimock.Equal(*mm_want_ptrs.id, mm_got.id) { - mmGetModelDefinition.t.Errorf("RepositoryMock.GetModelDefinition got unexpected parameter id, want: %#v, got: %#v%s\n", *mm_want_ptrs.id, mm_got.id, minimock.Diff(*mm_want_ptrs.id, mm_got.id)) + mmGetModelDefinition.t.Errorf("RepositoryMock.GetModelDefinition got unexpected parameter id, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetModelDefinition.GetModelDefinitionMock.defaultExpectation.expectationOrigins.originId, *mm_want_ptrs.id, mm_got.id, minimock.Diff(*mm_want_ptrs.id, mm_got.id)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmGetModelDefinition.t.Errorf("RepositoryMock.GetModelDefinition got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmGetModelDefinition.t.Errorf("RepositoryMock.GetModelDefinition got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetModelDefinition.GetModelDefinitionMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmGetModelDefinition.GetModelDefinitionMock.defaultExpectation.results @@ -5499,7 +5914,7 @@ func (m *RepositoryMock) MinimockGetModelDefinitionDone() bool { func (m *RepositoryMock) MinimockGetModelDefinitionInspect() { for _, e := range m.GetModelDefinitionMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.GetModelDefinition with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.GetModelDefinition at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -5507,19 +5922,19 @@ func (m *RepositoryMock) MinimockGetModelDefinitionInspect() { // if default expectation was set then invocations count should be greater than zero if m.GetModelDefinitionMock.defaultExpectation != nil && afterGetModelDefinitionCounter < 1 { if m.GetModelDefinitionMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.GetModelDefinition") + m.t.Errorf("Expected call to RepositoryMock.GetModelDefinition at\n%s", m.GetModelDefinitionMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.GetModelDefinition with params: %#v", *m.GetModelDefinitionMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.GetModelDefinition at\n%s with params: %#v", m.GetModelDefinitionMock.defaultExpectation.expectationOrigins.origin, *m.GetModelDefinitionMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcGetModelDefinition != nil && afterGetModelDefinitionCounter < 1 { - m.t.Error("Expected call to RepositoryMock.GetModelDefinition") + m.t.Errorf("Expected call to RepositoryMock.GetModelDefinition at\n%s", m.funcGetModelDefinitionOrigin) } if !m.GetModelDefinitionMock.invocationsDone() && afterGetModelDefinitionCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.GetModelDefinition but found %d calls", - mm_atomic.LoadUint64(&m.GetModelDefinitionMock.expectedInvocations), afterGetModelDefinitionCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.GetModelDefinition at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.GetModelDefinitionMock.expectedInvocations), m.GetModelDefinitionMock.expectedInvocationsOrigin, afterGetModelDefinitionCounter) } } @@ -5532,16 +5947,19 @@ type mRepositoryMockGetModelDefinitionByUID struct { callArgs []*RepositoryMockGetModelDefinitionByUIDParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockGetModelDefinitionByUIDExpectation specifies expectation struct of the Repository.GetModelDefinitionByUID type RepositoryMockGetModelDefinitionByUIDExpectation struct { - mock *RepositoryMock - params *RepositoryMockGetModelDefinitionByUIDParams - paramPtrs *RepositoryMockGetModelDefinitionByUIDParamPtrs - results *RepositoryMockGetModelDefinitionByUIDResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockGetModelDefinitionByUIDParams + paramPtrs *RepositoryMockGetModelDefinitionByUIDParamPtrs + expectationOrigins RepositoryMockGetModelDefinitionByUIDExpectationOrigins + results *RepositoryMockGetModelDefinitionByUIDResults + returnOrigin string + Counter uint64 } // RepositoryMockGetModelDefinitionByUIDParams contains parameters of the Repository.GetModelDefinitionByUID @@ -5560,6 +5978,12 @@ type RepositoryMockGetModelDefinitionByUIDResults struct { err error } +// RepositoryMockGetModelDefinitionByUIDOrigins contains origins of expectations of the Repository.GetModelDefinitionByUID +type RepositoryMockGetModelDefinitionByUIDExpectationOrigins struct { + origin string + originUid string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -5585,6 +6009,7 @@ func (mmGetModelDefinitionByUID *mRepositoryMockGetModelDefinitionByUID) Expect( } mmGetModelDefinitionByUID.defaultExpectation.params = &RepositoryMockGetModelDefinitionByUIDParams{uid} + mmGetModelDefinitionByUID.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmGetModelDefinitionByUID.expectations { if minimock.Equal(e.params, mmGetModelDefinitionByUID.defaultExpectation.params) { mmGetModelDefinitionByUID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetModelDefinitionByUID.defaultExpectation.params) @@ -5612,6 +6037,7 @@ func (mmGetModelDefinitionByUID *mRepositoryMockGetModelDefinitionByUID) ExpectU mmGetModelDefinitionByUID.defaultExpectation.paramPtrs = &RepositoryMockGetModelDefinitionByUIDParamPtrs{} } mmGetModelDefinitionByUID.defaultExpectation.paramPtrs.uid = &uid + mmGetModelDefinitionByUID.defaultExpectation.expectationOrigins.originUid = minimock.CallerInfo(1) return mmGetModelDefinitionByUID } @@ -5637,6 +6063,7 @@ func (mmGetModelDefinitionByUID *mRepositoryMockGetModelDefinitionByUID) Return( mmGetModelDefinitionByUID.defaultExpectation = &RepositoryMockGetModelDefinitionByUIDExpectation{mock: mmGetModelDefinitionByUID.mock} } mmGetModelDefinitionByUID.defaultExpectation.results = &RepositoryMockGetModelDefinitionByUIDResults{mp1, err} + mmGetModelDefinitionByUID.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmGetModelDefinitionByUID.mock } @@ -5651,6 +6078,7 @@ func (mmGetModelDefinitionByUID *mRepositoryMockGetModelDefinitionByUID) Set(f f } mmGetModelDefinitionByUID.mock.funcGetModelDefinitionByUID = f + mmGetModelDefinitionByUID.mock.funcGetModelDefinitionByUIDOrigin = minimock.CallerInfo(1) return mmGetModelDefinitionByUID.mock } @@ -5662,8 +6090,9 @@ func (mmGetModelDefinitionByUID *mRepositoryMockGetModelDefinitionByUID) When(ui } expectation := &RepositoryMockGetModelDefinitionByUIDExpectation{ - mock: mmGetModelDefinitionByUID.mock, - params: &RepositoryMockGetModelDefinitionByUIDParams{uid}, + mock: mmGetModelDefinitionByUID.mock, + params: &RepositoryMockGetModelDefinitionByUIDParams{uid}, + expectationOrigins: RepositoryMockGetModelDefinitionByUIDExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmGetModelDefinitionByUID.expectations = append(mmGetModelDefinitionByUID.expectations, expectation) return expectation @@ -5681,6 +6110,7 @@ func (mmGetModelDefinitionByUID *mRepositoryMockGetModelDefinitionByUID) Times(n mmGetModelDefinitionByUID.mock.t.Fatalf("Times of RepositoryMock.GetModelDefinitionByUID mock can not be zero") } mm_atomic.StoreUint64(&mmGetModelDefinitionByUID.expectedInvocations, n) + mmGetModelDefinitionByUID.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmGetModelDefinitionByUID } @@ -5695,11 +6125,13 @@ func (mmGetModelDefinitionByUID *mRepositoryMockGetModelDefinitionByUID) invocat return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// GetModelDefinitionByUID implements repository.Repository +// GetModelDefinitionByUID implements mm_repository.Repository func (mmGetModelDefinitionByUID *RepositoryMock) GetModelDefinitionByUID(uid uuid.UUID) (mp1 *datamodel.ModelDefinition, err error) { mm_atomic.AddUint64(&mmGetModelDefinitionByUID.beforeGetModelDefinitionByUIDCounter, 1) defer mm_atomic.AddUint64(&mmGetModelDefinitionByUID.afterGetModelDefinitionByUIDCounter, 1) + mmGetModelDefinitionByUID.t.Helper() + if mmGetModelDefinitionByUID.inspectFuncGetModelDefinitionByUID != nil { mmGetModelDefinitionByUID.inspectFuncGetModelDefinitionByUID(uid) } @@ -5728,11 +6160,13 @@ func (mmGetModelDefinitionByUID *RepositoryMock) GetModelDefinitionByUID(uid uui if mm_want_ptrs != nil { if mm_want_ptrs.uid != nil && !minimock.Equal(*mm_want_ptrs.uid, mm_got.uid) { - mmGetModelDefinitionByUID.t.Errorf("RepositoryMock.GetModelDefinitionByUID got unexpected parameter uid, want: %#v, got: %#v%s\n", *mm_want_ptrs.uid, mm_got.uid, minimock.Diff(*mm_want_ptrs.uid, mm_got.uid)) + mmGetModelDefinitionByUID.t.Errorf("RepositoryMock.GetModelDefinitionByUID got unexpected parameter uid, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetModelDefinitionByUID.GetModelDefinitionByUIDMock.defaultExpectation.expectationOrigins.originUid, *mm_want_ptrs.uid, mm_got.uid, minimock.Diff(*mm_want_ptrs.uid, mm_got.uid)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmGetModelDefinitionByUID.t.Errorf("RepositoryMock.GetModelDefinitionByUID got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmGetModelDefinitionByUID.t.Errorf("RepositoryMock.GetModelDefinitionByUID got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetModelDefinitionByUID.GetModelDefinitionByUIDMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmGetModelDefinitionByUID.GetModelDefinitionByUIDMock.defaultExpectation.results @@ -5792,7 +6226,7 @@ func (m *RepositoryMock) MinimockGetModelDefinitionByUIDDone() bool { func (m *RepositoryMock) MinimockGetModelDefinitionByUIDInspect() { for _, e := range m.GetModelDefinitionByUIDMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.GetModelDefinitionByUID with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.GetModelDefinitionByUID at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -5800,19 +6234,19 @@ func (m *RepositoryMock) MinimockGetModelDefinitionByUIDInspect() { // if default expectation was set then invocations count should be greater than zero if m.GetModelDefinitionByUIDMock.defaultExpectation != nil && afterGetModelDefinitionByUIDCounter < 1 { if m.GetModelDefinitionByUIDMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.GetModelDefinitionByUID") + m.t.Errorf("Expected call to RepositoryMock.GetModelDefinitionByUID at\n%s", m.GetModelDefinitionByUIDMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.GetModelDefinitionByUID with params: %#v", *m.GetModelDefinitionByUIDMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.GetModelDefinitionByUID at\n%s with params: %#v", m.GetModelDefinitionByUIDMock.defaultExpectation.expectationOrigins.origin, *m.GetModelDefinitionByUIDMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcGetModelDefinitionByUID != nil && afterGetModelDefinitionByUIDCounter < 1 { - m.t.Error("Expected call to RepositoryMock.GetModelDefinitionByUID") + m.t.Errorf("Expected call to RepositoryMock.GetModelDefinitionByUID at\n%s", m.funcGetModelDefinitionByUIDOrigin) } if !m.GetModelDefinitionByUIDMock.invocationsDone() && afterGetModelDefinitionByUIDCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.GetModelDefinitionByUID but found %d calls", - mm_atomic.LoadUint64(&m.GetModelDefinitionByUIDMock.expectedInvocations), afterGetModelDefinitionByUIDCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.GetModelDefinitionByUID at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.GetModelDefinitionByUIDMock.expectedInvocations), m.GetModelDefinitionByUIDMock.expectedInvocationsOrigin, afterGetModelDefinitionByUIDCounter) } } @@ -5825,16 +6259,19 @@ type mRepositoryMockGetModelRunByUID struct { callArgs []*RepositoryMockGetModelRunByUIDParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockGetModelRunByUIDExpectation specifies expectation struct of the Repository.GetModelRunByUID type RepositoryMockGetModelRunByUIDExpectation struct { - mock *RepositoryMock - params *RepositoryMockGetModelRunByUIDParams - paramPtrs *RepositoryMockGetModelRunByUIDParamPtrs - results *RepositoryMockGetModelRunByUIDResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockGetModelRunByUIDParams + paramPtrs *RepositoryMockGetModelRunByUIDParamPtrs + expectationOrigins RepositoryMockGetModelRunByUIDExpectationOrigins + results *RepositoryMockGetModelRunByUIDResults + returnOrigin string + Counter uint64 } // RepositoryMockGetModelRunByUIDParams contains parameters of the Repository.GetModelRunByUID @@ -5855,6 +6292,13 @@ type RepositoryMockGetModelRunByUIDResults struct { err error } +// RepositoryMockGetModelRunByUIDOrigins contains origins of expectations of the Repository.GetModelRunByUID +type RepositoryMockGetModelRunByUIDExpectationOrigins struct { + origin string + originCtx string + originTriggerUID string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -5880,6 +6324,7 @@ func (mmGetModelRunByUID *mRepositoryMockGetModelRunByUID) Expect(ctx context.Co } mmGetModelRunByUID.defaultExpectation.params = &RepositoryMockGetModelRunByUIDParams{ctx, triggerUID} + mmGetModelRunByUID.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmGetModelRunByUID.expectations { if minimock.Equal(e.params, mmGetModelRunByUID.defaultExpectation.params) { mmGetModelRunByUID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetModelRunByUID.defaultExpectation.params) @@ -5907,6 +6352,7 @@ func (mmGetModelRunByUID *mRepositoryMockGetModelRunByUID) ExpectCtxParam1(ctx c mmGetModelRunByUID.defaultExpectation.paramPtrs = &RepositoryMockGetModelRunByUIDParamPtrs{} } mmGetModelRunByUID.defaultExpectation.paramPtrs.ctx = &ctx + mmGetModelRunByUID.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmGetModelRunByUID } @@ -5929,6 +6375,7 @@ func (mmGetModelRunByUID *mRepositoryMockGetModelRunByUID) ExpectTriggerUIDParam mmGetModelRunByUID.defaultExpectation.paramPtrs = &RepositoryMockGetModelRunByUIDParamPtrs{} } mmGetModelRunByUID.defaultExpectation.paramPtrs.triggerUID = &triggerUID + mmGetModelRunByUID.defaultExpectation.expectationOrigins.originTriggerUID = minimock.CallerInfo(1) return mmGetModelRunByUID } @@ -5954,6 +6401,7 @@ func (mmGetModelRunByUID *mRepositoryMockGetModelRunByUID) Return(modelRun *data mmGetModelRunByUID.defaultExpectation = &RepositoryMockGetModelRunByUIDExpectation{mock: mmGetModelRunByUID.mock} } mmGetModelRunByUID.defaultExpectation.results = &RepositoryMockGetModelRunByUIDResults{modelRun, err} + mmGetModelRunByUID.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmGetModelRunByUID.mock } @@ -5968,6 +6416,7 @@ func (mmGetModelRunByUID *mRepositoryMockGetModelRunByUID) Set(f func(ctx contex } mmGetModelRunByUID.mock.funcGetModelRunByUID = f + mmGetModelRunByUID.mock.funcGetModelRunByUIDOrigin = minimock.CallerInfo(1) return mmGetModelRunByUID.mock } @@ -5979,8 +6428,9 @@ func (mmGetModelRunByUID *mRepositoryMockGetModelRunByUID) When(ctx context.Cont } expectation := &RepositoryMockGetModelRunByUIDExpectation{ - mock: mmGetModelRunByUID.mock, - params: &RepositoryMockGetModelRunByUIDParams{ctx, triggerUID}, + mock: mmGetModelRunByUID.mock, + params: &RepositoryMockGetModelRunByUIDParams{ctx, triggerUID}, + expectationOrigins: RepositoryMockGetModelRunByUIDExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmGetModelRunByUID.expectations = append(mmGetModelRunByUID.expectations, expectation) return expectation @@ -5998,6 +6448,7 @@ func (mmGetModelRunByUID *mRepositoryMockGetModelRunByUID) Times(n uint64) *mRep mmGetModelRunByUID.mock.t.Fatalf("Times of RepositoryMock.GetModelRunByUID mock can not be zero") } mm_atomic.StoreUint64(&mmGetModelRunByUID.expectedInvocations, n) + mmGetModelRunByUID.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmGetModelRunByUID } @@ -6012,11 +6463,13 @@ func (mmGetModelRunByUID *mRepositoryMockGetModelRunByUID) invocationsDone() boo return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// GetModelRunByUID implements repository.Repository +// GetModelRunByUID implements mm_repository.Repository func (mmGetModelRunByUID *RepositoryMock) GetModelRunByUID(ctx context.Context, triggerUID string) (modelRun *datamodel.ModelRun, err error) { mm_atomic.AddUint64(&mmGetModelRunByUID.beforeGetModelRunByUIDCounter, 1) defer mm_atomic.AddUint64(&mmGetModelRunByUID.afterGetModelRunByUIDCounter, 1) + mmGetModelRunByUID.t.Helper() + if mmGetModelRunByUID.inspectFuncGetModelRunByUID != nil { mmGetModelRunByUID.inspectFuncGetModelRunByUID(ctx, triggerUID) } @@ -6045,15 +6498,18 @@ func (mmGetModelRunByUID *RepositoryMock) GetModelRunByUID(ctx context.Context, if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmGetModelRunByUID.t.Errorf("RepositoryMock.GetModelRunByUID got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmGetModelRunByUID.t.Errorf("RepositoryMock.GetModelRunByUID got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetModelRunByUID.GetModelRunByUIDMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.triggerUID != nil && !minimock.Equal(*mm_want_ptrs.triggerUID, mm_got.triggerUID) { - mmGetModelRunByUID.t.Errorf("RepositoryMock.GetModelRunByUID got unexpected parameter triggerUID, want: %#v, got: %#v%s\n", *mm_want_ptrs.triggerUID, mm_got.triggerUID, minimock.Diff(*mm_want_ptrs.triggerUID, mm_got.triggerUID)) + mmGetModelRunByUID.t.Errorf("RepositoryMock.GetModelRunByUID got unexpected parameter triggerUID, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetModelRunByUID.GetModelRunByUIDMock.defaultExpectation.expectationOrigins.originTriggerUID, *mm_want_ptrs.triggerUID, mm_got.triggerUID, minimock.Diff(*mm_want_ptrs.triggerUID, mm_got.triggerUID)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmGetModelRunByUID.t.Errorf("RepositoryMock.GetModelRunByUID got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmGetModelRunByUID.t.Errorf("RepositoryMock.GetModelRunByUID got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetModelRunByUID.GetModelRunByUIDMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmGetModelRunByUID.GetModelRunByUIDMock.defaultExpectation.results @@ -6113,7 +6569,7 @@ func (m *RepositoryMock) MinimockGetModelRunByUIDDone() bool { func (m *RepositoryMock) MinimockGetModelRunByUIDInspect() { for _, e := range m.GetModelRunByUIDMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.GetModelRunByUID with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.GetModelRunByUID at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -6121,19 +6577,19 @@ func (m *RepositoryMock) MinimockGetModelRunByUIDInspect() { // if default expectation was set then invocations count should be greater than zero if m.GetModelRunByUIDMock.defaultExpectation != nil && afterGetModelRunByUIDCounter < 1 { if m.GetModelRunByUIDMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.GetModelRunByUID") + m.t.Errorf("Expected call to RepositoryMock.GetModelRunByUID at\n%s", m.GetModelRunByUIDMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.GetModelRunByUID with params: %#v", *m.GetModelRunByUIDMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.GetModelRunByUID at\n%s with params: %#v", m.GetModelRunByUIDMock.defaultExpectation.expectationOrigins.origin, *m.GetModelRunByUIDMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcGetModelRunByUID != nil && afterGetModelRunByUIDCounter < 1 { - m.t.Error("Expected call to RepositoryMock.GetModelRunByUID") + m.t.Errorf("Expected call to RepositoryMock.GetModelRunByUID at\n%s", m.funcGetModelRunByUIDOrigin) } if !m.GetModelRunByUIDMock.invocationsDone() && afterGetModelRunByUIDCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.GetModelRunByUID but found %d calls", - mm_atomic.LoadUint64(&m.GetModelRunByUIDMock.expectedInvocations), afterGetModelRunByUIDCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.GetModelRunByUID at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.GetModelRunByUIDMock.expectedInvocations), m.GetModelRunByUIDMock.expectedInvocationsOrigin, afterGetModelRunByUIDCounter) } } @@ -6146,16 +6602,19 @@ type mRepositoryMockGetModelVersionByID struct { callArgs []*RepositoryMockGetModelVersionByIDParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockGetModelVersionByIDExpectation specifies expectation struct of the Repository.GetModelVersionByID type RepositoryMockGetModelVersionByIDExpectation struct { - mock *RepositoryMock - params *RepositoryMockGetModelVersionByIDParams - paramPtrs *RepositoryMockGetModelVersionByIDParamPtrs - results *RepositoryMockGetModelVersionByIDResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockGetModelVersionByIDParams + paramPtrs *RepositoryMockGetModelVersionByIDParamPtrs + expectationOrigins RepositoryMockGetModelVersionByIDExpectationOrigins + results *RepositoryMockGetModelVersionByIDResults + returnOrigin string + Counter uint64 } // RepositoryMockGetModelVersionByIDParams contains parameters of the Repository.GetModelVersionByID @@ -6178,6 +6637,14 @@ type RepositoryMockGetModelVersionByIDResults struct { err error } +// RepositoryMockGetModelVersionByIDOrigins contains origins of expectations of the Repository.GetModelVersionByID +type RepositoryMockGetModelVersionByIDExpectationOrigins struct { + origin string + originCtx string + originModelUID string + originVersionID string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -6203,6 +6670,7 @@ func (mmGetModelVersionByID *mRepositoryMockGetModelVersionByID) Expect(ctx cont } mmGetModelVersionByID.defaultExpectation.params = &RepositoryMockGetModelVersionByIDParams{ctx, modelUID, versionID} + mmGetModelVersionByID.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmGetModelVersionByID.expectations { if minimock.Equal(e.params, mmGetModelVersionByID.defaultExpectation.params) { mmGetModelVersionByID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetModelVersionByID.defaultExpectation.params) @@ -6230,6 +6698,7 @@ func (mmGetModelVersionByID *mRepositoryMockGetModelVersionByID) ExpectCtxParam1 mmGetModelVersionByID.defaultExpectation.paramPtrs = &RepositoryMockGetModelVersionByIDParamPtrs{} } mmGetModelVersionByID.defaultExpectation.paramPtrs.ctx = &ctx + mmGetModelVersionByID.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmGetModelVersionByID } @@ -6252,6 +6721,7 @@ func (mmGetModelVersionByID *mRepositoryMockGetModelVersionByID) ExpectModelUIDP mmGetModelVersionByID.defaultExpectation.paramPtrs = &RepositoryMockGetModelVersionByIDParamPtrs{} } mmGetModelVersionByID.defaultExpectation.paramPtrs.modelUID = &modelUID + mmGetModelVersionByID.defaultExpectation.expectationOrigins.originModelUID = minimock.CallerInfo(1) return mmGetModelVersionByID } @@ -6274,6 +6744,7 @@ func (mmGetModelVersionByID *mRepositoryMockGetModelVersionByID) ExpectVersionID mmGetModelVersionByID.defaultExpectation.paramPtrs = &RepositoryMockGetModelVersionByIDParamPtrs{} } mmGetModelVersionByID.defaultExpectation.paramPtrs.versionID = &versionID + mmGetModelVersionByID.defaultExpectation.expectationOrigins.originVersionID = minimock.CallerInfo(1) return mmGetModelVersionByID } @@ -6299,6 +6770,7 @@ func (mmGetModelVersionByID *mRepositoryMockGetModelVersionByID) Return(version mmGetModelVersionByID.defaultExpectation = &RepositoryMockGetModelVersionByIDExpectation{mock: mmGetModelVersionByID.mock} } mmGetModelVersionByID.defaultExpectation.results = &RepositoryMockGetModelVersionByIDResults{version, err} + mmGetModelVersionByID.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmGetModelVersionByID.mock } @@ -6313,6 +6785,7 @@ func (mmGetModelVersionByID *mRepositoryMockGetModelVersionByID) Set(f func(ctx } mmGetModelVersionByID.mock.funcGetModelVersionByID = f + mmGetModelVersionByID.mock.funcGetModelVersionByIDOrigin = minimock.CallerInfo(1) return mmGetModelVersionByID.mock } @@ -6324,8 +6797,9 @@ func (mmGetModelVersionByID *mRepositoryMockGetModelVersionByID) When(ctx contex } expectation := &RepositoryMockGetModelVersionByIDExpectation{ - mock: mmGetModelVersionByID.mock, - params: &RepositoryMockGetModelVersionByIDParams{ctx, modelUID, versionID}, + mock: mmGetModelVersionByID.mock, + params: &RepositoryMockGetModelVersionByIDParams{ctx, modelUID, versionID}, + expectationOrigins: RepositoryMockGetModelVersionByIDExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmGetModelVersionByID.expectations = append(mmGetModelVersionByID.expectations, expectation) return expectation @@ -6343,6 +6817,7 @@ func (mmGetModelVersionByID *mRepositoryMockGetModelVersionByID) Times(n uint64) mmGetModelVersionByID.mock.t.Fatalf("Times of RepositoryMock.GetModelVersionByID mock can not be zero") } mm_atomic.StoreUint64(&mmGetModelVersionByID.expectedInvocations, n) + mmGetModelVersionByID.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmGetModelVersionByID } @@ -6357,11 +6832,13 @@ func (mmGetModelVersionByID *mRepositoryMockGetModelVersionByID) invocationsDone return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// GetModelVersionByID implements repository.Repository +// GetModelVersionByID implements mm_repository.Repository func (mmGetModelVersionByID *RepositoryMock) GetModelVersionByID(ctx context.Context, modelUID uuid.UUID, versionID string) (version *datamodel.ModelVersion, err error) { mm_atomic.AddUint64(&mmGetModelVersionByID.beforeGetModelVersionByIDCounter, 1) defer mm_atomic.AddUint64(&mmGetModelVersionByID.afterGetModelVersionByIDCounter, 1) + mmGetModelVersionByID.t.Helper() + if mmGetModelVersionByID.inspectFuncGetModelVersionByID != nil { mmGetModelVersionByID.inspectFuncGetModelVersionByID(ctx, modelUID, versionID) } @@ -6390,19 +6867,23 @@ func (mmGetModelVersionByID *RepositoryMock) GetModelVersionByID(ctx context.Con if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmGetModelVersionByID.t.Errorf("RepositoryMock.GetModelVersionByID got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmGetModelVersionByID.t.Errorf("RepositoryMock.GetModelVersionByID got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetModelVersionByID.GetModelVersionByIDMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.modelUID != nil && !minimock.Equal(*mm_want_ptrs.modelUID, mm_got.modelUID) { - mmGetModelVersionByID.t.Errorf("RepositoryMock.GetModelVersionByID got unexpected parameter modelUID, want: %#v, got: %#v%s\n", *mm_want_ptrs.modelUID, mm_got.modelUID, minimock.Diff(*mm_want_ptrs.modelUID, mm_got.modelUID)) + mmGetModelVersionByID.t.Errorf("RepositoryMock.GetModelVersionByID got unexpected parameter modelUID, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetModelVersionByID.GetModelVersionByIDMock.defaultExpectation.expectationOrigins.originModelUID, *mm_want_ptrs.modelUID, mm_got.modelUID, minimock.Diff(*mm_want_ptrs.modelUID, mm_got.modelUID)) } if mm_want_ptrs.versionID != nil && !minimock.Equal(*mm_want_ptrs.versionID, mm_got.versionID) { - mmGetModelVersionByID.t.Errorf("RepositoryMock.GetModelVersionByID got unexpected parameter versionID, want: %#v, got: %#v%s\n", *mm_want_ptrs.versionID, mm_got.versionID, minimock.Diff(*mm_want_ptrs.versionID, mm_got.versionID)) + mmGetModelVersionByID.t.Errorf("RepositoryMock.GetModelVersionByID got unexpected parameter versionID, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetModelVersionByID.GetModelVersionByIDMock.defaultExpectation.expectationOrigins.originVersionID, *mm_want_ptrs.versionID, mm_got.versionID, minimock.Diff(*mm_want_ptrs.versionID, mm_got.versionID)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmGetModelVersionByID.t.Errorf("RepositoryMock.GetModelVersionByID got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmGetModelVersionByID.t.Errorf("RepositoryMock.GetModelVersionByID got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetModelVersionByID.GetModelVersionByIDMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmGetModelVersionByID.GetModelVersionByIDMock.defaultExpectation.results @@ -6462,7 +6943,7 @@ func (m *RepositoryMock) MinimockGetModelVersionByIDDone() bool { func (m *RepositoryMock) MinimockGetModelVersionByIDInspect() { for _, e := range m.GetModelVersionByIDMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.GetModelVersionByID with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.GetModelVersionByID at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -6470,19 +6951,19 @@ func (m *RepositoryMock) MinimockGetModelVersionByIDInspect() { // if default expectation was set then invocations count should be greater than zero if m.GetModelVersionByIDMock.defaultExpectation != nil && afterGetModelVersionByIDCounter < 1 { if m.GetModelVersionByIDMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.GetModelVersionByID") + m.t.Errorf("Expected call to RepositoryMock.GetModelVersionByID at\n%s", m.GetModelVersionByIDMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.GetModelVersionByID with params: %#v", *m.GetModelVersionByIDMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.GetModelVersionByID at\n%s with params: %#v", m.GetModelVersionByIDMock.defaultExpectation.expectationOrigins.origin, *m.GetModelVersionByIDMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcGetModelVersionByID != nil && afterGetModelVersionByIDCounter < 1 { - m.t.Error("Expected call to RepositoryMock.GetModelVersionByID") + m.t.Errorf("Expected call to RepositoryMock.GetModelVersionByID at\n%s", m.funcGetModelVersionByIDOrigin) } if !m.GetModelVersionByIDMock.invocationsDone() && afterGetModelVersionByIDCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.GetModelVersionByID but found %d calls", - mm_atomic.LoadUint64(&m.GetModelVersionByIDMock.expectedInvocations), afterGetModelVersionByIDCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.GetModelVersionByID at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.GetModelVersionByIDMock.expectedInvocations), m.GetModelVersionByIDMock.expectedInvocationsOrigin, afterGetModelVersionByIDCounter) } } @@ -6495,16 +6976,19 @@ type mRepositoryMockGetNamespaceModelByID struct { callArgs []*RepositoryMockGetNamespaceModelByIDParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockGetNamespaceModelByIDExpectation specifies expectation struct of the Repository.GetNamespaceModelByID type RepositoryMockGetNamespaceModelByIDExpectation struct { - mock *RepositoryMock - params *RepositoryMockGetNamespaceModelByIDParams - paramPtrs *RepositoryMockGetNamespaceModelByIDParamPtrs - results *RepositoryMockGetNamespaceModelByIDResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockGetNamespaceModelByIDParams + paramPtrs *RepositoryMockGetNamespaceModelByIDParamPtrs + expectationOrigins RepositoryMockGetNamespaceModelByIDExpectationOrigins + results *RepositoryMockGetNamespaceModelByIDResults + returnOrigin string + Counter uint64 } // RepositoryMockGetNamespaceModelByIDParams contains parameters of the Repository.GetNamespaceModelByID @@ -6531,6 +7015,16 @@ type RepositoryMockGetNamespaceModelByIDResults struct { err error } +// RepositoryMockGetNamespaceModelByIDOrigins contains origins of expectations of the Repository.GetNamespaceModelByID +type RepositoryMockGetNamespaceModelByIDExpectationOrigins struct { + origin string + originCtx string + originOwnerPermalink string + originId string + originIsBasicView string + originIncludeAvatar string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -6556,6 +7050,7 @@ func (mmGetNamespaceModelByID *mRepositoryMockGetNamespaceModelByID) Expect(ctx } mmGetNamespaceModelByID.defaultExpectation.params = &RepositoryMockGetNamespaceModelByIDParams{ctx, ownerPermalink, id, isBasicView, includeAvatar} + mmGetNamespaceModelByID.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmGetNamespaceModelByID.expectations { if minimock.Equal(e.params, mmGetNamespaceModelByID.defaultExpectation.params) { mmGetNamespaceModelByID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetNamespaceModelByID.defaultExpectation.params) @@ -6583,6 +7078,7 @@ func (mmGetNamespaceModelByID *mRepositoryMockGetNamespaceModelByID) ExpectCtxPa mmGetNamespaceModelByID.defaultExpectation.paramPtrs = &RepositoryMockGetNamespaceModelByIDParamPtrs{} } mmGetNamespaceModelByID.defaultExpectation.paramPtrs.ctx = &ctx + mmGetNamespaceModelByID.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmGetNamespaceModelByID } @@ -6605,6 +7101,7 @@ func (mmGetNamespaceModelByID *mRepositoryMockGetNamespaceModelByID) ExpectOwner mmGetNamespaceModelByID.defaultExpectation.paramPtrs = &RepositoryMockGetNamespaceModelByIDParamPtrs{} } mmGetNamespaceModelByID.defaultExpectation.paramPtrs.ownerPermalink = &ownerPermalink + mmGetNamespaceModelByID.defaultExpectation.expectationOrigins.originOwnerPermalink = minimock.CallerInfo(1) return mmGetNamespaceModelByID } @@ -6627,6 +7124,7 @@ func (mmGetNamespaceModelByID *mRepositoryMockGetNamespaceModelByID) ExpectIdPar mmGetNamespaceModelByID.defaultExpectation.paramPtrs = &RepositoryMockGetNamespaceModelByIDParamPtrs{} } mmGetNamespaceModelByID.defaultExpectation.paramPtrs.id = &id + mmGetNamespaceModelByID.defaultExpectation.expectationOrigins.originId = minimock.CallerInfo(1) return mmGetNamespaceModelByID } @@ -6649,6 +7147,7 @@ func (mmGetNamespaceModelByID *mRepositoryMockGetNamespaceModelByID) ExpectIsBas mmGetNamespaceModelByID.defaultExpectation.paramPtrs = &RepositoryMockGetNamespaceModelByIDParamPtrs{} } mmGetNamespaceModelByID.defaultExpectation.paramPtrs.isBasicView = &isBasicView + mmGetNamespaceModelByID.defaultExpectation.expectationOrigins.originIsBasicView = minimock.CallerInfo(1) return mmGetNamespaceModelByID } @@ -6671,6 +7170,7 @@ func (mmGetNamespaceModelByID *mRepositoryMockGetNamespaceModelByID) ExpectInclu mmGetNamespaceModelByID.defaultExpectation.paramPtrs = &RepositoryMockGetNamespaceModelByIDParamPtrs{} } mmGetNamespaceModelByID.defaultExpectation.paramPtrs.includeAvatar = &includeAvatar + mmGetNamespaceModelByID.defaultExpectation.expectationOrigins.originIncludeAvatar = minimock.CallerInfo(1) return mmGetNamespaceModelByID } @@ -6696,6 +7196,7 @@ func (mmGetNamespaceModelByID *mRepositoryMockGetNamespaceModelByID) Return(mp1 mmGetNamespaceModelByID.defaultExpectation = &RepositoryMockGetNamespaceModelByIDExpectation{mock: mmGetNamespaceModelByID.mock} } mmGetNamespaceModelByID.defaultExpectation.results = &RepositoryMockGetNamespaceModelByIDResults{mp1, err} + mmGetNamespaceModelByID.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmGetNamespaceModelByID.mock } @@ -6710,6 +7211,7 @@ func (mmGetNamespaceModelByID *mRepositoryMockGetNamespaceModelByID) Set(f func( } mmGetNamespaceModelByID.mock.funcGetNamespaceModelByID = f + mmGetNamespaceModelByID.mock.funcGetNamespaceModelByIDOrigin = minimock.CallerInfo(1) return mmGetNamespaceModelByID.mock } @@ -6721,8 +7223,9 @@ func (mmGetNamespaceModelByID *mRepositoryMockGetNamespaceModelByID) When(ctx co } expectation := &RepositoryMockGetNamespaceModelByIDExpectation{ - mock: mmGetNamespaceModelByID.mock, - params: &RepositoryMockGetNamespaceModelByIDParams{ctx, ownerPermalink, id, isBasicView, includeAvatar}, + mock: mmGetNamespaceModelByID.mock, + params: &RepositoryMockGetNamespaceModelByIDParams{ctx, ownerPermalink, id, isBasicView, includeAvatar}, + expectationOrigins: RepositoryMockGetNamespaceModelByIDExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmGetNamespaceModelByID.expectations = append(mmGetNamespaceModelByID.expectations, expectation) return expectation @@ -6740,6 +7243,7 @@ func (mmGetNamespaceModelByID *mRepositoryMockGetNamespaceModelByID) Times(n uin mmGetNamespaceModelByID.mock.t.Fatalf("Times of RepositoryMock.GetNamespaceModelByID mock can not be zero") } mm_atomic.StoreUint64(&mmGetNamespaceModelByID.expectedInvocations, n) + mmGetNamespaceModelByID.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmGetNamespaceModelByID } @@ -6754,11 +7258,13 @@ func (mmGetNamespaceModelByID *mRepositoryMockGetNamespaceModelByID) invocations return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// GetNamespaceModelByID implements repository.Repository +// GetNamespaceModelByID implements mm_repository.Repository func (mmGetNamespaceModelByID *RepositoryMock) GetNamespaceModelByID(ctx context.Context, ownerPermalink string, id string, isBasicView bool, includeAvatar bool) (mp1 *datamodel.Model, err error) { mm_atomic.AddUint64(&mmGetNamespaceModelByID.beforeGetNamespaceModelByIDCounter, 1) defer mm_atomic.AddUint64(&mmGetNamespaceModelByID.afterGetNamespaceModelByIDCounter, 1) + mmGetNamespaceModelByID.t.Helper() + if mmGetNamespaceModelByID.inspectFuncGetNamespaceModelByID != nil { mmGetNamespaceModelByID.inspectFuncGetNamespaceModelByID(ctx, ownerPermalink, id, isBasicView, includeAvatar) } @@ -6787,27 +7293,33 @@ func (mmGetNamespaceModelByID *RepositoryMock) GetNamespaceModelByID(ctx context if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmGetNamespaceModelByID.t.Errorf("RepositoryMock.GetNamespaceModelByID got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmGetNamespaceModelByID.t.Errorf("RepositoryMock.GetNamespaceModelByID got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetNamespaceModelByID.GetNamespaceModelByIDMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.ownerPermalink != nil && !minimock.Equal(*mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink) { - mmGetNamespaceModelByID.t.Errorf("RepositoryMock.GetNamespaceModelByID got unexpected parameter ownerPermalink, want: %#v, got: %#v%s\n", *mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink, minimock.Diff(*mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink)) + mmGetNamespaceModelByID.t.Errorf("RepositoryMock.GetNamespaceModelByID got unexpected parameter ownerPermalink, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetNamespaceModelByID.GetNamespaceModelByIDMock.defaultExpectation.expectationOrigins.originOwnerPermalink, *mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink, minimock.Diff(*mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink)) } if mm_want_ptrs.id != nil && !minimock.Equal(*mm_want_ptrs.id, mm_got.id) { - mmGetNamespaceModelByID.t.Errorf("RepositoryMock.GetNamespaceModelByID got unexpected parameter id, want: %#v, got: %#v%s\n", *mm_want_ptrs.id, mm_got.id, minimock.Diff(*mm_want_ptrs.id, mm_got.id)) + mmGetNamespaceModelByID.t.Errorf("RepositoryMock.GetNamespaceModelByID got unexpected parameter id, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetNamespaceModelByID.GetNamespaceModelByIDMock.defaultExpectation.expectationOrigins.originId, *mm_want_ptrs.id, mm_got.id, minimock.Diff(*mm_want_ptrs.id, mm_got.id)) } if mm_want_ptrs.isBasicView != nil && !minimock.Equal(*mm_want_ptrs.isBasicView, mm_got.isBasicView) { - mmGetNamespaceModelByID.t.Errorf("RepositoryMock.GetNamespaceModelByID got unexpected parameter isBasicView, want: %#v, got: %#v%s\n", *mm_want_ptrs.isBasicView, mm_got.isBasicView, minimock.Diff(*mm_want_ptrs.isBasicView, mm_got.isBasicView)) + mmGetNamespaceModelByID.t.Errorf("RepositoryMock.GetNamespaceModelByID got unexpected parameter isBasicView, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetNamespaceModelByID.GetNamespaceModelByIDMock.defaultExpectation.expectationOrigins.originIsBasicView, *mm_want_ptrs.isBasicView, mm_got.isBasicView, minimock.Diff(*mm_want_ptrs.isBasicView, mm_got.isBasicView)) } if mm_want_ptrs.includeAvatar != nil && !minimock.Equal(*mm_want_ptrs.includeAvatar, mm_got.includeAvatar) { - mmGetNamespaceModelByID.t.Errorf("RepositoryMock.GetNamespaceModelByID got unexpected parameter includeAvatar, want: %#v, got: %#v%s\n", *mm_want_ptrs.includeAvatar, mm_got.includeAvatar, minimock.Diff(*mm_want_ptrs.includeAvatar, mm_got.includeAvatar)) + mmGetNamespaceModelByID.t.Errorf("RepositoryMock.GetNamespaceModelByID got unexpected parameter includeAvatar, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetNamespaceModelByID.GetNamespaceModelByIDMock.defaultExpectation.expectationOrigins.originIncludeAvatar, *mm_want_ptrs.includeAvatar, mm_got.includeAvatar, minimock.Diff(*mm_want_ptrs.includeAvatar, mm_got.includeAvatar)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmGetNamespaceModelByID.t.Errorf("RepositoryMock.GetNamespaceModelByID got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmGetNamespaceModelByID.t.Errorf("RepositoryMock.GetNamespaceModelByID got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmGetNamespaceModelByID.GetNamespaceModelByIDMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmGetNamespaceModelByID.GetNamespaceModelByIDMock.defaultExpectation.results @@ -6867,7 +7379,7 @@ func (m *RepositoryMock) MinimockGetNamespaceModelByIDDone() bool { func (m *RepositoryMock) MinimockGetNamespaceModelByIDInspect() { for _, e := range m.GetNamespaceModelByIDMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.GetNamespaceModelByID with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.GetNamespaceModelByID at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -6875,19 +7387,19 @@ func (m *RepositoryMock) MinimockGetNamespaceModelByIDInspect() { // if default expectation was set then invocations count should be greater than zero if m.GetNamespaceModelByIDMock.defaultExpectation != nil && afterGetNamespaceModelByIDCounter < 1 { if m.GetNamespaceModelByIDMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.GetNamespaceModelByID") + m.t.Errorf("Expected call to RepositoryMock.GetNamespaceModelByID at\n%s", m.GetNamespaceModelByIDMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.GetNamespaceModelByID with params: %#v", *m.GetNamespaceModelByIDMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.GetNamespaceModelByID at\n%s with params: %#v", m.GetNamespaceModelByIDMock.defaultExpectation.expectationOrigins.origin, *m.GetNamespaceModelByIDMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcGetNamespaceModelByID != nil && afterGetNamespaceModelByIDCounter < 1 { - m.t.Error("Expected call to RepositoryMock.GetNamespaceModelByID") + m.t.Errorf("Expected call to RepositoryMock.GetNamespaceModelByID at\n%s", m.funcGetNamespaceModelByIDOrigin) } if !m.GetNamespaceModelByIDMock.invocationsDone() && afterGetNamespaceModelByIDCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.GetNamespaceModelByID but found %d calls", - mm_atomic.LoadUint64(&m.GetNamespaceModelByIDMock.expectedInvocations), afterGetNamespaceModelByIDCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.GetNamespaceModelByID at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.GetNamespaceModelByIDMock.expectedInvocations), m.GetNamespaceModelByIDMock.expectedInvocationsOrigin, afterGetNamespaceModelByIDCounter) } } @@ -6900,16 +7412,19 @@ type mRepositoryMockListModelDefinitions struct { callArgs []*RepositoryMockListModelDefinitionsParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockListModelDefinitionsExpectation specifies expectation struct of the Repository.ListModelDefinitions type RepositoryMockListModelDefinitionsExpectation struct { - mock *RepositoryMock - params *RepositoryMockListModelDefinitionsParams - paramPtrs *RepositoryMockListModelDefinitionsParamPtrs - results *RepositoryMockListModelDefinitionsResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockListModelDefinitionsParams + paramPtrs *RepositoryMockListModelDefinitionsParamPtrs + expectationOrigins RepositoryMockListModelDefinitionsExpectationOrigins + results *RepositoryMockListModelDefinitionsResults + returnOrigin string + Counter uint64 } // RepositoryMockListModelDefinitionsParams contains parameters of the Repository.ListModelDefinitions @@ -6934,6 +7449,14 @@ type RepositoryMockListModelDefinitionsResults struct { err error } +// RepositoryMockListModelDefinitionsOrigins contains origins of expectations of the Repository.ListModelDefinitions +type RepositoryMockListModelDefinitionsExpectationOrigins struct { + origin string + originView string + originPageSize string + originPageToken string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -6959,6 +7482,7 @@ func (mmListModelDefinitions *mRepositoryMockListModelDefinitions) Expect(view m } mmListModelDefinitions.defaultExpectation.params = &RepositoryMockListModelDefinitionsParams{view, pageSize, pageToken} + mmListModelDefinitions.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmListModelDefinitions.expectations { if minimock.Equal(e.params, mmListModelDefinitions.defaultExpectation.params) { mmListModelDefinitions.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmListModelDefinitions.defaultExpectation.params) @@ -6986,6 +7510,7 @@ func (mmListModelDefinitions *mRepositoryMockListModelDefinitions) ExpectViewPar mmListModelDefinitions.defaultExpectation.paramPtrs = &RepositoryMockListModelDefinitionsParamPtrs{} } mmListModelDefinitions.defaultExpectation.paramPtrs.view = &view + mmListModelDefinitions.defaultExpectation.expectationOrigins.originView = minimock.CallerInfo(1) return mmListModelDefinitions } @@ -7008,6 +7533,7 @@ func (mmListModelDefinitions *mRepositoryMockListModelDefinitions) ExpectPageSiz mmListModelDefinitions.defaultExpectation.paramPtrs = &RepositoryMockListModelDefinitionsParamPtrs{} } mmListModelDefinitions.defaultExpectation.paramPtrs.pageSize = &pageSize + mmListModelDefinitions.defaultExpectation.expectationOrigins.originPageSize = minimock.CallerInfo(1) return mmListModelDefinitions } @@ -7030,6 +7556,7 @@ func (mmListModelDefinitions *mRepositoryMockListModelDefinitions) ExpectPageTok mmListModelDefinitions.defaultExpectation.paramPtrs = &RepositoryMockListModelDefinitionsParamPtrs{} } mmListModelDefinitions.defaultExpectation.paramPtrs.pageToken = &pageToken + mmListModelDefinitions.defaultExpectation.expectationOrigins.originPageToken = minimock.CallerInfo(1) return mmListModelDefinitions } @@ -7055,6 +7582,7 @@ func (mmListModelDefinitions *mRepositoryMockListModelDefinitions) Return(defini mmListModelDefinitions.defaultExpectation = &RepositoryMockListModelDefinitionsExpectation{mock: mmListModelDefinitions.mock} } mmListModelDefinitions.defaultExpectation.results = &RepositoryMockListModelDefinitionsResults{definitions, nextPageToken, totalSize, err} + mmListModelDefinitions.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmListModelDefinitions.mock } @@ -7069,6 +7597,7 @@ func (mmListModelDefinitions *mRepositoryMockListModelDefinitions) Set(f func(vi } mmListModelDefinitions.mock.funcListModelDefinitions = f + mmListModelDefinitions.mock.funcListModelDefinitionsOrigin = minimock.CallerInfo(1) return mmListModelDefinitions.mock } @@ -7080,8 +7609,9 @@ func (mmListModelDefinitions *mRepositoryMockListModelDefinitions) When(view mod } expectation := &RepositoryMockListModelDefinitionsExpectation{ - mock: mmListModelDefinitions.mock, - params: &RepositoryMockListModelDefinitionsParams{view, pageSize, pageToken}, + mock: mmListModelDefinitions.mock, + params: &RepositoryMockListModelDefinitionsParams{view, pageSize, pageToken}, + expectationOrigins: RepositoryMockListModelDefinitionsExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmListModelDefinitions.expectations = append(mmListModelDefinitions.expectations, expectation) return expectation @@ -7099,6 +7629,7 @@ func (mmListModelDefinitions *mRepositoryMockListModelDefinitions) Times(n uint6 mmListModelDefinitions.mock.t.Fatalf("Times of RepositoryMock.ListModelDefinitions mock can not be zero") } mm_atomic.StoreUint64(&mmListModelDefinitions.expectedInvocations, n) + mmListModelDefinitions.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmListModelDefinitions } @@ -7113,11 +7644,13 @@ func (mmListModelDefinitions *mRepositoryMockListModelDefinitions) invocationsDo return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// ListModelDefinitions implements repository.Repository +// ListModelDefinitions implements mm_repository.Repository func (mmListModelDefinitions *RepositoryMock) ListModelDefinitions(view modelpb.View, pageSize int64, pageToken string) (definitions []*datamodel.ModelDefinition, nextPageToken string, totalSize int64, err error) { mm_atomic.AddUint64(&mmListModelDefinitions.beforeListModelDefinitionsCounter, 1) defer mm_atomic.AddUint64(&mmListModelDefinitions.afterListModelDefinitionsCounter, 1) + mmListModelDefinitions.t.Helper() + if mmListModelDefinitions.inspectFuncListModelDefinitions != nil { mmListModelDefinitions.inspectFuncListModelDefinitions(view, pageSize, pageToken) } @@ -7146,19 +7679,23 @@ func (mmListModelDefinitions *RepositoryMock) ListModelDefinitions(view modelpb. if mm_want_ptrs != nil { if mm_want_ptrs.view != nil && !minimock.Equal(*mm_want_ptrs.view, mm_got.view) { - mmListModelDefinitions.t.Errorf("RepositoryMock.ListModelDefinitions got unexpected parameter view, want: %#v, got: %#v%s\n", *mm_want_ptrs.view, mm_got.view, minimock.Diff(*mm_want_ptrs.view, mm_got.view)) + mmListModelDefinitions.t.Errorf("RepositoryMock.ListModelDefinitions got unexpected parameter view, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelDefinitions.ListModelDefinitionsMock.defaultExpectation.expectationOrigins.originView, *mm_want_ptrs.view, mm_got.view, minimock.Diff(*mm_want_ptrs.view, mm_got.view)) } if mm_want_ptrs.pageSize != nil && !minimock.Equal(*mm_want_ptrs.pageSize, mm_got.pageSize) { - mmListModelDefinitions.t.Errorf("RepositoryMock.ListModelDefinitions got unexpected parameter pageSize, want: %#v, got: %#v%s\n", *mm_want_ptrs.pageSize, mm_got.pageSize, minimock.Diff(*mm_want_ptrs.pageSize, mm_got.pageSize)) + mmListModelDefinitions.t.Errorf("RepositoryMock.ListModelDefinitions got unexpected parameter pageSize, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelDefinitions.ListModelDefinitionsMock.defaultExpectation.expectationOrigins.originPageSize, *mm_want_ptrs.pageSize, mm_got.pageSize, minimock.Diff(*mm_want_ptrs.pageSize, mm_got.pageSize)) } if mm_want_ptrs.pageToken != nil && !minimock.Equal(*mm_want_ptrs.pageToken, mm_got.pageToken) { - mmListModelDefinitions.t.Errorf("RepositoryMock.ListModelDefinitions got unexpected parameter pageToken, want: %#v, got: %#v%s\n", *mm_want_ptrs.pageToken, mm_got.pageToken, minimock.Diff(*mm_want_ptrs.pageToken, mm_got.pageToken)) + mmListModelDefinitions.t.Errorf("RepositoryMock.ListModelDefinitions got unexpected parameter pageToken, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelDefinitions.ListModelDefinitionsMock.defaultExpectation.expectationOrigins.originPageToken, *mm_want_ptrs.pageToken, mm_got.pageToken, minimock.Diff(*mm_want_ptrs.pageToken, mm_got.pageToken)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmListModelDefinitions.t.Errorf("RepositoryMock.ListModelDefinitions got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmListModelDefinitions.t.Errorf("RepositoryMock.ListModelDefinitions got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelDefinitions.ListModelDefinitionsMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmListModelDefinitions.ListModelDefinitionsMock.defaultExpectation.results @@ -7218,7 +7755,7 @@ func (m *RepositoryMock) MinimockListModelDefinitionsDone() bool { func (m *RepositoryMock) MinimockListModelDefinitionsInspect() { for _, e := range m.ListModelDefinitionsMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.ListModelDefinitions with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.ListModelDefinitions at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -7226,19 +7763,19 @@ func (m *RepositoryMock) MinimockListModelDefinitionsInspect() { // if default expectation was set then invocations count should be greater than zero if m.ListModelDefinitionsMock.defaultExpectation != nil && afterListModelDefinitionsCounter < 1 { if m.ListModelDefinitionsMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.ListModelDefinitions") + m.t.Errorf("Expected call to RepositoryMock.ListModelDefinitions at\n%s", m.ListModelDefinitionsMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.ListModelDefinitions with params: %#v", *m.ListModelDefinitionsMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.ListModelDefinitions at\n%s with params: %#v", m.ListModelDefinitionsMock.defaultExpectation.expectationOrigins.origin, *m.ListModelDefinitionsMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcListModelDefinitions != nil && afterListModelDefinitionsCounter < 1 { - m.t.Error("Expected call to RepositoryMock.ListModelDefinitions") + m.t.Errorf("Expected call to RepositoryMock.ListModelDefinitions at\n%s", m.funcListModelDefinitionsOrigin) } if !m.ListModelDefinitionsMock.invocationsDone() && afterListModelDefinitionsCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.ListModelDefinitions but found %d calls", - mm_atomic.LoadUint64(&m.ListModelDefinitionsMock.expectedInvocations), afterListModelDefinitionsCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.ListModelDefinitions at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.ListModelDefinitionsMock.expectedInvocations), m.ListModelDefinitionsMock.expectedInvocationsOrigin, afterListModelDefinitionsCounter) } } @@ -7251,16 +7788,19 @@ type mRepositoryMockListModelRuns struct { callArgs []*RepositoryMockListModelRunsParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockListModelRunsExpectation specifies expectation struct of the Repository.ListModelRuns type RepositoryMockListModelRunsExpectation struct { - mock *RepositoryMock - params *RepositoryMockListModelRunsParams - paramPtrs *RepositoryMockListModelRunsParamPtrs - results *RepositoryMockListModelRunsResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockListModelRunsParams + paramPtrs *RepositoryMockListModelRunsParamPtrs + expectationOrigins RepositoryMockListModelRunsExpectationOrigins + results *RepositoryMockListModelRunsResults + returnOrigin string + Counter uint64 } // RepositoryMockListModelRunsParams contains parameters of the Repository.ListModelRuns @@ -7289,9 +7829,22 @@ type RepositoryMockListModelRunsParamPtrs struct { // RepositoryMockListModelRunsResults contains results of the Repository.ListModelRuns type RepositoryMockListModelRunsResults struct { - modelTriggers []*datamodel.ModelRun - totalSize int64 - err error + modelRuns []*datamodel.ModelRun + totalSize int64 + err error +} + +// RepositoryMockListModelRunsOrigins contains origins of expectations of the Repository.ListModelRuns +type RepositoryMockListModelRunsExpectationOrigins struct { + origin string + originCtx string + originPageSize string + originPage string + originFilter string + originOrder string + originRequesterUID string + originIsOwner string + originModelUID string } // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning @@ -7319,6 +7872,7 @@ func (mmListModelRuns *mRepositoryMockListModelRuns) Expect(ctx context.Context, } mmListModelRuns.defaultExpectation.params = &RepositoryMockListModelRunsParams{ctx, pageSize, page, filter, order, requesterUID, isOwner, modelUID} + mmListModelRuns.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmListModelRuns.expectations { if minimock.Equal(e.params, mmListModelRuns.defaultExpectation.params) { mmListModelRuns.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmListModelRuns.defaultExpectation.params) @@ -7346,6 +7900,7 @@ func (mmListModelRuns *mRepositoryMockListModelRuns) ExpectCtxParam1(ctx context mmListModelRuns.defaultExpectation.paramPtrs = &RepositoryMockListModelRunsParamPtrs{} } mmListModelRuns.defaultExpectation.paramPtrs.ctx = &ctx + mmListModelRuns.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmListModelRuns } @@ -7368,6 +7923,7 @@ func (mmListModelRuns *mRepositoryMockListModelRuns) ExpectPageSizeParam2(pageSi mmListModelRuns.defaultExpectation.paramPtrs = &RepositoryMockListModelRunsParamPtrs{} } mmListModelRuns.defaultExpectation.paramPtrs.pageSize = &pageSize + mmListModelRuns.defaultExpectation.expectationOrigins.originPageSize = minimock.CallerInfo(1) return mmListModelRuns } @@ -7390,6 +7946,7 @@ func (mmListModelRuns *mRepositoryMockListModelRuns) ExpectPageParam3(page int64 mmListModelRuns.defaultExpectation.paramPtrs = &RepositoryMockListModelRunsParamPtrs{} } mmListModelRuns.defaultExpectation.paramPtrs.page = &page + mmListModelRuns.defaultExpectation.expectationOrigins.originPage = minimock.CallerInfo(1) return mmListModelRuns } @@ -7412,6 +7969,7 @@ func (mmListModelRuns *mRepositoryMockListModelRuns) ExpectFilterParam4(filter f mmListModelRuns.defaultExpectation.paramPtrs = &RepositoryMockListModelRunsParamPtrs{} } mmListModelRuns.defaultExpectation.paramPtrs.filter = &filter + mmListModelRuns.defaultExpectation.expectationOrigins.originFilter = minimock.CallerInfo(1) return mmListModelRuns } @@ -7434,6 +7992,7 @@ func (mmListModelRuns *mRepositoryMockListModelRuns) ExpectOrderParam5(order ord mmListModelRuns.defaultExpectation.paramPtrs = &RepositoryMockListModelRunsParamPtrs{} } mmListModelRuns.defaultExpectation.paramPtrs.order = &order + mmListModelRuns.defaultExpectation.expectationOrigins.originOrder = minimock.CallerInfo(1) return mmListModelRuns } @@ -7456,6 +8015,7 @@ func (mmListModelRuns *mRepositoryMockListModelRuns) ExpectRequesterUIDParam6(re mmListModelRuns.defaultExpectation.paramPtrs = &RepositoryMockListModelRunsParamPtrs{} } mmListModelRuns.defaultExpectation.paramPtrs.requesterUID = &requesterUID + mmListModelRuns.defaultExpectation.expectationOrigins.originRequesterUID = minimock.CallerInfo(1) return mmListModelRuns } @@ -7478,6 +8038,7 @@ func (mmListModelRuns *mRepositoryMockListModelRuns) ExpectIsOwnerParam7(isOwner mmListModelRuns.defaultExpectation.paramPtrs = &RepositoryMockListModelRunsParamPtrs{} } mmListModelRuns.defaultExpectation.paramPtrs.isOwner = &isOwner + mmListModelRuns.defaultExpectation.expectationOrigins.originIsOwner = minimock.CallerInfo(1) return mmListModelRuns } @@ -7500,6 +8061,7 @@ func (mmListModelRuns *mRepositoryMockListModelRuns) ExpectModelUIDParam8(modelU mmListModelRuns.defaultExpectation.paramPtrs = &RepositoryMockListModelRunsParamPtrs{} } mmListModelRuns.defaultExpectation.paramPtrs.modelUID = &modelUID + mmListModelRuns.defaultExpectation.expectationOrigins.originModelUID = minimock.CallerInfo(1) return mmListModelRuns } @@ -7516,7 +8078,7 @@ func (mmListModelRuns *mRepositoryMockListModelRuns) Inspect(f func(ctx context. } // Return sets up results that will be returned by Repository.ListModelRuns -func (mmListModelRuns *mRepositoryMockListModelRuns) Return(modelTriggers []*datamodel.ModelRun, totalSize int64, err error) *RepositoryMock { +func (mmListModelRuns *mRepositoryMockListModelRuns) Return(modelRuns []*datamodel.ModelRun, totalSize int64, err error) *RepositoryMock { if mmListModelRuns.mock.funcListModelRuns != nil { mmListModelRuns.mock.t.Fatalf("RepositoryMock.ListModelRuns mock is already set by Set") } @@ -7524,12 +8086,13 @@ func (mmListModelRuns *mRepositoryMockListModelRuns) Return(modelTriggers []*dat if mmListModelRuns.defaultExpectation == nil { mmListModelRuns.defaultExpectation = &RepositoryMockListModelRunsExpectation{mock: mmListModelRuns.mock} } - mmListModelRuns.defaultExpectation.results = &RepositoryMockListModelRunsResults{modelTriggers, totalSize, err} + mmListModelRuns.defaultExpectation.results = &RepositoryMockListModelRunsResults{modelRuns, totalSize, err} + mmListModelRuns.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmListModelRuns.mock } // Set uses given function f to mock the Repository.ListModelRuns method -func (mmListModelRuns *mRepositoryMockListModelRuns) Set(f func(ctx context.Context, pageSize int64, page int64, filter filtering.Filter, order ordering.OrderBy, requesterUID string, isOwner bool, modelUID string) (modelTriggers []*datamodel.ModelRun, totalSize int64, err error)) *RepositoryMock { +func (mmListModelRuns *mRepositoryMockListModelRuns) Set(f func(ctx context.Context, pageSize int64, page int64, filter filtering.Filter, order ordering.OrderBy, requesterUID string, isOwner bool, modelUID string) (modelRuns []*datamodel.ModelRun, totalSize int64, err error)) *RepositoryMock { if mmListModelRuns.defaultExpectation != nil { mmListModelRuns.mock.t.Fatalf("Default expectation is already set for the Repository.ListModelRuns method") } @@ -7539,6 +8102,7 @@ func (mmListModelRuns *mRepositoryMockListModelRuns) Set(f func(ctx context.Cont } mmListModelRuns.mock.funcListModelRuns = f + mmListModelRuns.mock.funcListModelRunsOrigin = minimock.CallerInfo(1) return mmListModelRuns.mock } @@ -7550,16 +8114,17 @@ func (mmListModelRuns *mRepositoryMockListModelRuns) When(ctx context.Context, p } expectation := &RepositoryMockListModelRunsExpectation{ - mock: mmListModelRuns.mock, - params: &RepositoryMockListModelRunsParams{ctx, pageSize, page, filter, order, requesterUID, isOwner, modelUID}, + mock: mmListModelRuns.mock, + params: &RepositoryMockListModelRunsParams{ctx, pageSize, page, filter, order, requesterUID, isOwner, modelUID}, + expectationOrigins: RepositoryMockListModelRunsExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmListModelRuns.expectations = append(mmListModelRuns.expectations, expectation) return expectation } // Then sets up Repository.ListModelRuns return parameters for the expectation previously defined by the When method -func (e *RepositoryMockListModelRunsExpectation) Then(modelTriggers []*datamodel.ModelRun, totalSize int64, err error) *RepositoryMock { - e.results = &RepositoryMockListModelRunsResults{modelTriggers, totalSize, err} +func (e *RepositoryMockListModelRunsExpectation) Then(modelRuns []*datamodel.ModelRun, totalSize int64, err error) *RepositoryMock { + e.results = &RepositoryMockListModelRunsResults{modelRuns, totalSize, err} return e.mock } @@ -7569,6 +8134,7 @@ func (mmListModelRuns *mRepositoryMockListModelRuns) Times(n uint64) *mRepositor mmListModelRuns.mock.t.Fatalf("Times of RepositoryMock.ListModelRuns mock can not be zero") } mm_atomic.StoreUint64(&mmListModelRuns.expectedInvocations, n) + mmListModelRuns.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmListModelRuns } @@ -7583,11 +8149,13 @@ func (mmListModelRuns *mRepositoryMockListModelRuns) invocationsDone() bool { return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// ListModelRuns implements repository.Repository -func (mmListModelRuns *RepositoryMock) ListModelRuns(ctx context.Context, pageSize int64, page int64, filter filtering.Filter, order ordering.OrderBy, requesterUID string, isOwner bool, modelUID string) (modelTriggers []*datamodel.ModelRun, totalSize int64, err error) { +// ListModelRuns implements mm_repository.Repository +func (mmListModelRuns *RepositoryMock) ListModelRuns(ctx context.Context, pageSize int64, page int64, filter filtering.Filter, order ordering.OrderBy, requesterUID string, isOwner bool, modelUID string) (modelRuns []*datamodel.ModelRun, totalSize int64, err error) { mm_atomic.AddUint64(&mmListModelRuns.beforeListModelRunsCounter, 1) defer mm_atomic.AddUint64(&mmListModelRuns.afterListModelRunsCounter, 1) + mmListModelRuns.t.Helper() + if mmListModelRuns.inspectFuncListModelRuns != nil { mmListModelRuns.inspectFuncListModelRuns(ctx, pageSize, page, filter, order, requesterUID, isOwner, modelUID) } @@ -7602,7 +8170,7 @@ func (mmListModelRuns *RepositoryMock) ListModelRuns(ctx context.Context, pageSi for _, e := range mmListModelRuns.ListModelRunsMock.expectations { if minimock.Equal(*e.params, mm_params) { mm_atomic.AddUint64(&e.Counter, 1) - return e.results.modelTriggers, e.results.totalSize, e.results.err + return e.results.modelRuns, e.results.totalSize, e.results.err } } @@ -7616,46 +8184,55 @@ func (mmListModelRuns *RepositoryMock) ListModelRuns(ctx context.Context, pageSi if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmListModelRuns.t.Errorf("RepositoryMock.ListModelRuns got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmListModelRuns.t.Errorf("RepositoryMock.ListModelRuns got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelRuns.ListModelRunsMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.pageSize != nil && !minimock.Equal(*mm_want_ptrs.pageSize, mm_got.pageSize) { - mmListModelRuns.t.Errorf("RepositoryMock.ListModelRuns got unexpected parameter pageSize, want: %#v, got: %#v%s\n", *mm_want_ptrs.pageSize, mm_got.pageSize, minimock.Diff(*mm_want_ptrs.pageSize, mm_got.pageSize)) + mmListModelRuns.t.Errorf("RepositoryMock.ListModelRuns got unexpected parameter pageSize, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelRuns.ListModelRunsMock.defaultExpectation.expectationOrigins.originPageSize, *mm_want_ptrs.pageSize, mm_got.pageSize, minimock.Diff(*mm_want_ptrs.pageSize, mm_got.pageSize)) } if mm_want_ptrs.page != nil && !minimock.Equal(*mm_want_ptrs.page, mm_got.page) { - mmListModelRuns.t.Errorf("RepositoryMock.ListModelRuns got unexpected parameter page, want: %#v, got: %#v%s\n", *mm_want_ptrs.page, mm_got.page, minimock.Diff(*mm_want_ptrs.page, mm_got.page)) + mmListModelRuns.t.Errorf("RepositoryMock.ListModelRuns got unexpected parameter page, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelRuns.ListModelRunsMock.defaultExpectation.expectationOrigins.originPage, *mm_want_ptrs.page, mm_got.page, minimock.Diff(*mm_want_ptrs.page, mm_got.page)) } if mm_want_ptrs.filter != nil && !minimock.Equal(*mm_want_ptrs.filter, mm_got.filter) { - mmListModelRuns.t.Errorf("RepositoryMock.ListModelRuns got unexpected parameter filter, want: %#v, got: %#v%s\n", *mm_want_ptrs.filter, mm_got.filter, minimock.Diff(*mm_want_ptrs.filter, mm_got.filter)) + mmListModelRuns.t.Errorf("RepositoryMock.ListModelRuns got unexpected parameter filter, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelRuns.ListModelRunsMock.defaultExpectation.expectationOrigins.originFilter, *mm_want_ptrs.filter, mm_got.filter, minimock.Diff(*mm_want_ptrs.filter, mm_got.filter)) } if mm_want_ptrs.order != nil && !minimock.Equal(*mm_want_ptrs.order, mm_got.order) { - mmListModelRuns.t.Errorf("RepositoryMock.ListModelRuns got unexpected parameter order, want: %#v, got: %#v%s\n", *mm_want_ptrs.order, mm_got.order, minimock.Diff(*mm_want_ptrs.order, mm_got.order)) + mmListModelRuns.t.Errorf("RepositoryMock.ListModelRuns got unexpected parameter order, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelRuns.ListModelRunsMock.defaultExpectation.expectationOrigins.originOrder, *mm_want_ptrs.order, mm_got.order, minimock.Diff(*mm_want_ptrs.order, mm_got.order)) } if mm_want_ptrs.requesterUID != nil && !minimock.Equal(*mm_want_ptrs.requesterUID, mm_got.requesterUID) { - mmListModelRuns.t.Errorf("RepositoryMock.ListModelRuns got unexpected parameter requesterUID, want: %#v, got: %#v%s\n", *mm_want_ptrs.requesterUID, mm_got.requesterUID, minimock.Diff(*mm_want_ptrs.requesterUID, mm_got.requesterUID)) + mmListModelRuns.t.Errorf("RepositoryMock.ListModelRuns got unexpected parameter requesterUID, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelRuns.ListModelRunsMock.defaultExpectation.expectationOrigins.originRequesterUID, *mm_want_ptrs.requesterUID, mm_got.requesterUID, minimock.Diff(*mm_want_ptrs.requesterUID, mm_got.requesterUID)) } if mm_want_ptrs.isOwner != nil && !minimock.Equal(*mm_want_ptrs.isOwner, mm_got.isOwner) { - mmListModelRuns.t.Errorf("RepositoryMock.ListModelRuns got unexpected parameter isOwner, want: %#v, got: %#v%s\n", *mm_want_ptrs.isOwner, mm_got.isOwner, minimock.Diff(*mm_want_ptrs.isOwner, mm_got.isOwner)) + mmListModelRuns.t.Errorf("RepositoryMock.ListModelRuns got unexpected parameter isOwner, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelRuns.ListModelRunsMock.defaultExpectation.expectationOrigins.originIsOwner, *mm_want_ptrs.isOwner, mm_got.isOwner, minimock.Diff(*mm_want_ptrs.isOwner, mm_got.isOwner)) } if mm_want_ptrs.modelUID != nil && !minimock.Equal(*mm_want_ptrs.modelUID, mm_got.modelUID) { - mmListModelRuns.t.Errorf("RepositoryMock.ListModelRuns got unexpected parameter modelUID, want: %#v, got: %#v%s\n", *mm_want_ptrs.modelUID, mm_got.modelUID, minimock.Diff(*mm_want_ptrs.modelUID, mm_got.modelUID)) + mmListModelRuns.t.Errorf("RepositoryMock.ListModelRuns got unexpected parameter modelUID, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelRuns.ListModelRunsMock.defaultExpectation.expectationOrigins.originModelUID, *mm_want_ptrs.modelUID, mm_got.modelUID, minimock.Diff(*mm_want_ptrs.modelUID, mm_got.modelUID)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmListModelRuns.t.Errorf("RepositoryMock.ListModelRuns got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmListModelRuns.t.Errorf("RepositoryMock.ListModelRuns got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelRuns.ListModelRunsMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmListModelRuns.ListModelRunsMock.defaultExpectation.results if mm_results == nil { mmListModelRuns.t.Fatal("No results are set for the RepositoryMock.ListModelRuns") } - return (*mm_results).modelTriggers, (*mm_results).totalSize, (*mm_results).err + return (*mm_results).modelRuns, (*mm_results).totalSize, (*mm_results).err } if mmListModelRuns.funcListModelRuns != nil { return mmListModelRuns.funcListModelRuns(ctx, pageSize, page, filter, order, requesterUID, isOwner, modelUID) @@ -7708,7 +8285,7 @@ func (m *RepositoryMock) MinimockListModelRunsDone() bool { func (m *RepositoryMock) MinimockListModelRunsInspect() { for _, e := range m.ListModelRunsMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.ListModelRuns with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.ListModelRuns at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -7716,19 +8293,549 @@ func (m *RepositoryMock) MinimockListModelRunsInspect() { // if default expectation was set then invocations count should be greater than zero if m.ListModelRunsMock.defaultExpectation != nil && afterListModelRunsCounter < 1 { if m.ListModelRunsMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.ListModelRuns") + m.t.Errorf("Expected call to RepositoryMock.ListModelRuns at\n%s", m.ListModelRunsMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.ListModelRuns with params: %#v", *m.ListModelRunsMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.ListModelRuns at\n%s with params: %#v", m.ListModelRunsMock.defaultExpectation.expectationOrigins.origin, *m.ListModelRunsMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcListModelRuns != nil && afterListModelRunsCounter < 1 { - m.t.Error("Expected call to RepositoryMock.ListModelRuns") + m.t.Errorf("Expected call to RepositoryMock.ListModelRuns at\n%s", m.funcListModelRunsOrigin) } if !m.ListModelRunsMock.invocationsDone() && afterListModelRunsCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.ListModelRuns but found %d calls", - mm_atomic.LoadUint64(&m.ListModelRunsMock.expectedInvocations), afterListModelRunsCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.ListModelRuns at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.ListModelRunsMock.expectedInvocations), m.ListModelRunsMock.expectedInvocationsOrigin, afterListModelRunsCounter) + } +} + +type mRepositoryMockListModelRunsByCreditOwner struct { + optional bool + mock *RepositoryMock + defaultExpectation *RepositoryMockListModelRunsByCreditOwnerExpectation + expectations []*RepositoryMockListModelRunsByCreditOwnerExpectation + + callArgs []*RepositoryMockListModelRunsByCreditOwnerParams + mutex sync.RWMutex + + expectedInvocations uint64 + expectedInvocationsOrigin string +} + +// RepositoryMockListModelRunsByCreditOwnerExpectation specifies expectation struct of the Repository.ListModelRunsByCreditOwner +type RepositoryMockListModelRunsByCreditOwnerExpectation struct { + mock *RepositoryMock + params *RepositoryMockListModelRunsByCreditOwnerParams + paramPtrs *RepositoryMockListModelRunsByCreditOwnerParamPtrs + expectationOrigins RepositoryMockListModelRunsByCreditOwnerExpectationOrigins + results *RepositoryMockListModelRunsByCreditOwnerResults + returnOrigin string + Counter uint64 +} + +// RepositoryMockListModelRunsByCreditOwnerParams contains parameters of the Repository.ListModelRunsByCreditOwner +type RepositoryMockListModelRunsByCreditOwnerParams struct { + ctx context.Context + pageSize int64 + page int64 + filter filtering.Filter + order ordering.OrderBy + requesterUID string + startedTimeBegin time.Time + startedTimeEnd time.Time +} + +// RepositoryMockListModelRunsByCreditOwnerParamPtrs contains pointers to parameters of the Repository.ListModelRunsByCreditOwner +type RepositoryMockListModelRunsByCreditOwnerParamPtrs struct { + ctx *context.Context + pageSize *int64 + page *int64 + filter *filtering.Filter + order *ordering.OrderBy + requesterUID *string + startedTimeBegin *time.Time + startedTimeEnd *time.Time +} + +// RepositoryMockListModelRunsByCreditOwnerResults contains results of the Repository.ListModelRunsByCreditOwner +type RepositoryMockListModelRunsByCreditOwnerResults struct { + modelTriggers []*datamodel.ModelRun + totalSize int64 + err error +} + +// RepositoryMockListModelRunsByCreditOwnerOrigins contains origins of expectations of the Repository.ListModelRunsByCreditOwner +type RepositoryMockListModelRunsByCreditOwnerExpectationOrigins struct { + origin string + originCtx string + originPageSize string + originPage string + originFilter string + originOrder string + originRequesterUID string + originStartedTimeBegin string + originStartedTimeEnd string +} + +// Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning +// the test will fail minimock's automatic final call check if the mocked method was not called at least once. +// Optional() makes method check to work in '0 or more' mode. +// It is NOT RECOMMENDED to use this option unless you really need it, as default behaviour helps to +// catch the problems when the expected method call is totally skipped during test run. +func (mmListModelRunsByCreditOwner *mRepositoryMockListModelRunsByCreditOwner) Optional() *mRepositoryMockListModelRunsByCreditOwner { + mmListModelRunsByCreditOwner.optional = true + return mmListModelRunsByCreditOwner +} + +// Expect sets up expected params for Repository.ListModelRunsByCreditOwner +func (mmListModelRunsByCreditOwner *mRepositoryMockListModelRunsByCreditOwner) Expect(ctx context.Context, pageSize int64, page int64, filter filtering.Filter, order ordering.OrderBy, requesterUID string, startedTimeBegin time.Time, startedTimeEnd time.Time) *mRepositoryMockListModelRunsByCreditOwner { + if mmListModelRunsByCreditOwner.mock.funcListModelRunsByCreditOwner != nil { + mmListModelRunsByCreditOwner.mock.t.Fatalf("RepositoryMock.ListModelRunsByCreditOwner mock is already set by Set") + } + + if mmListModelRunsByCreditOwner.defaultExpectation == nil { + mmListModelRunsByCreditOwner.defaultExpectation = &RepositoryMockListModelRunsByCreditOwnerExpectation{} + } + + if mmListModelRunsByCreditOwner.defaultExpectation.paramPtrs != nil { + mmListModelRunsByCreditOwner.mock.t.Fatalf("RepositoryMock.ListModelRunsByCreditOwner mock is already set by ExpectParams functions") + } + + mmListModelRunsByCreditOwner.defaultExpectation.params = &RepositoryMockListModelRunsByCreditOwnerParams{ctx, pageSize, page, filter, order, requesterUID, startedTimeBegin, startedTimeEnd} + mmListModelRunsByCreditOwner.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) + for _, e := range mmListModelRunsByCreditOwner.expectations { + if minimock.Equal(e.params, mmListModelRunsByCreditOwner.defaultExpectation.params) { + mmListModelRunsByCreditOwner.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmListModelRunsByCreditOwner.defaultExpectation.params) + } + } + + return mmListModelRunsByCreditOwner +} + +// ExpectCtxParam1 sets up expected param ctx for Repository.ListModelRunsByCreditOwner +func (mmListModelRunsByCreditOwner *mRepositoryMockListModelRunsByCreditOwner) ExpectCtxParam1(ctx context.Context) *mRepositoryMockListModelRunsByCreditOwner { + if mmListModelRunsByCreditOwner.mock.funcListModelRunsByCreditOwner != nil { + mmListModelRunsByCreditOwner.mock.t.Fatalf("RepositoryMock.ListModelRunsByCreditOwner mock is already set by Set") + } + + if mmListModelRunsByCreditOwner.defaultExpectation == nil { + mmListModelRunsByCreditOwner.defaultExpectation = &RepositoryMockListModelRunsByCreditOwnerExpectation{} + } + + if mmListModelRunsByCreditOwner.defaultExpectation.params != nil { + mmListModelRunsByCreditOwner.mock.t.Fatalf("RepositoryMock.ListModelRunsByCreditOwner mock is already set by Expect") + } + + if mmListModelRunsByCreditOwner.defaultExpectation.paramPtrs == nil { + mmListModelRunsByCreditOwner.defaultExpectation.paramPtrs = &RepositoryMockListModelRunsByCreditOwnerParamPtrs{} + } + mmListModelRunsByCreditOwner.defaultExpectation.paramPtrs.ctx = &ctx + mmListModelRunsByCreditOwner.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) + + return mmListModelRunsByCreditOwner +} + +// ExpectPageSizeParam2 sets up expected param pageSize for Repository.ListModelRunsByCreditOwner +func (mmListModelRunsByCreditOwner *mRepositoryMockListModelRunsByCreditOwner) ExpectPageSizeParam2(pageSize int64) *mRepositoryMockListModelRunsByCreditOwner { + if mmListModelRunsByCreditOwner.mock.funcListModelRunsByCreditOwner != nil { + mmListModelRunsByCreditOwner.mock.t.Fatalf("RepositoryMock.ListModelRunsByCreditOwner mock is already set by Set") + } + + if mmListModelRunsByCreditOwner.defaultExpectation == nil { + mmListModelRunsByCreditOwner.defaultExpectation = &RepositoryMockListModelRunsByCreditOwnerExpectation{} + } + + if mmListModelRunsByCreditOwner.defaultExpectation.params != nil { + mmListModelRunsByCreditOwner.mock.t.Fatalf("RepositoryMock.ListModelRunsByCreditOwner mock is already set by Expect") + } + + if mmListModelRunsByCreditOwner.defaultExpectation.paramPtrs == nil { + mmListModelRunsByCreditOwner.defaultExpectation.paramPtrs = &RepositoryMockListModelRunsByCreditOwnerParamPtrs{} + } + mmListModelRunsByCreditOwner.defaultExpectation.paramPtrs.pageSize = &pageSize + mmListModelRunsByCreditOwner.defaultExpectation.expectationOrigins.originPageSize = minimock.CallerInfo(1) + + return mmListModelRunsByCreditOwner +} + +// ExpectPageParam3 sets up expected param page for Repository.ListModelRunsByCreditOwner +func (mmListModelRunsByCreditOwner *mRepositoryMockListModelRunsByCreditOwner) ExpectPageParam3(page int64) *mRepositoryMockListModelRunsByCreditOwner { + if mmListModelRunsByCreditOwner.mock.funcListModelRunsByCreditOwner != nil { + mmListModelRunsByCreditOwner.mock.t.Fatalf("RepositoryMock.ListModelRunsByCreditOwner mock is already set by Set") + } + + if mmListModelRunsByCreditOwner.defaultExpectation == nil { + mmListModelRunsByCreditOwner.defaultExpectation = &RepositoryMockListModelRunsByCreditOwnerExpectation{} + } + + if mmListModelRunsByCreditOwner.defaultExpectation.params != nil { + mmListModelRunsByCreditOwner.mock.t.Fatalf("RepositoryMock.ListModelRunsByCreditOwner mock is already set by Expect") + } + + if mmListModelRunsByCreditOwner.defaultExpectation.paramPtrs == nil { + mmListModelRunsByCreditOwner.defaultExpectation.paramPtrs = &RepositoryMockListModelRunsByCreditOwnerParamPtrs{} + } + mmListModelRunsByCreditOwner.defaultExpectation.paramPtrs.page = &page + mmListModelRunsByCreditOwner.defaultExpectation.expectationOrigins.originPage = minimock.CallerInfo(1) + + return mmListModelRunsByCreditOwner +} + +// ExpectFilterParam4 sets up expected param filter for Repository.ListModelRunsByCreditOwner +func (mmListModelRunsByCreditOwner *mRepositoryMockListModelRunsByCreditOwner) ExpectFilterParam4(filter filtering.Filter) *mRepositoryMockListModelRunsByCreditOwner { + if mmListModelRunsByCreditOwner.mock.funcListModelRunsByCreditOwner != nil { + mmListModelRunsByCreditOwner.mock.t.Fatalf("RepositoryMock.ListModelRunsByCreditOwner mock is already set by Set") + } + + if mmListModelRunsByCreditOwner.defaultExpectation == nil { + mmListModelRunsByCreditOwner.defaultExpectation = &RepositoryMockListModelRunsByCreditOwnerExpectation{} + } + + if mmListModelRunsByCreditOwner.defaultExpectation.params != nil { + mmListModelRunsByCreditOwner.mock.t.Fatalf("RepositoryMock.ListModelRunsByCreditOwner mock is already set by Expect") + } + + if mmListModelRunsByCreditOwner.defaultExpectation.paramPtrs == nil { + mmListModelRunsByCreditOwner.defaultExpectation.paramPtrs = &RepositoryMockListModelRunsByCreditOwnerParamPtrs{} + } + mmListModelRunsByCreditOwner.defaultExpectation.paramPtrs.filter = &filter + mmListModelRunsByCreditOwner.defaultExpectation.expectationOrigins.originFilter = minimock.CallerInfo(1) + + return mmListModelRunsByCreditOwner +} + +// ExpectOrderParam5 sets up expected param order for Repository.ListModelRunsByCreditOwner +func (mmListModelRunsByCreditOwner *mRepositoryMockListModelRunsByCreditOwner) ExpectOrderParam5(order ordering.OrderBy) *mRepositoryMockListModelRunsByCreditOwner { + if mmListModelRunsByCreditOwner.mock.funcListModelRunsByCreditOwner != nil { + mmListModelRunsByCreditOwner.mock.t.Fatalf("RepositoryMock.ListModelRunsByCreditOwner mock is already set by Set") + } + + if mmListModelRunsByCreditOwner.defaultExpectation == nil { + mmListModelRunsByCreditOwner.defaultExpectation = &RepositoryMockListModelRunsByCreditOwnerExpectation{} + } + + if mmListModelRunsByCreditOwner.defaultExpectation.params != nil { + mmListModelRunsByCreditOwner.mock.t.Fatalf("RepositoryMock.ListModelRunsByCreditOwner mock is already set by Expect") + } + + if mmListModelRunsByCreditOwner.defaultExpectation.paramPtrs == nil { + mmListModelRunsByCreditOwner.defaultExpectation.paramPtrs = &RepositoryMockListModelRunsByCreditOwnerParamPtrs{} + } + mmListModelRunsByCreditOwner.defaultExpectation.paramPtrs.order = &order + mmListModelRunsByCreditOwner.defaultExpectation.expectationOrigins.originOrder = minimock.CallerInfo(1) + + return mmListModelRunsByCreditOwner +} + +// ExpectRequesterUIDParam6 sets up expected param requesterUID for Repository.ListModelRunsByCreditOwner +func (mmListModelRunsByCreditOwner *mRepositoryMockListModelRunsByCreditOwner) ExpectRequesterUIDParam6(requesterUID string) *mRepositoryMockListModelRunsByCreditOwner { + if mmListModelRunsByCreditOwner.mock.funcListModelRunsByCreditOwner != nil { + mmListModelRunsByCreditOwner.mock.t.Fatalf("RepositoryMock.ListModelRunsByCreditOwner mock is already set by Set") + } + + if mmListModelRunsByCreditOwner.defaultExpectation == nil { + mmListModelRunsByCreditOwner.defaultExpectation = &RepositoryMockListModelRunsByCreditOwnerExpectation{} + } + + if mmListModelRunsByCreditOwner.defaultExpectation.params != nil { + mmListModelRunsByCreditOwner.mock.t.Fatalf("RepositoryMock.ListModelRunsByCreditOwner mock is already set by Expect") + } + + if mmListModelRunsByCreditOwner.defaultExpectation.paramPtrs == nil { + mmListModelRunsByCreditOwner.defaultExpectation.paramPtrs = &RepositoryMockListModelRunsByCreditOwnerParamPtrs{} + } + mmListModelRunsByCreditOwner.defaultExpectation.paramPtrs.requesterUID = &requesterUID + mmListModelRunsByCreditOwner.defaultExpectation.expectationOrigins.originRequesterUID = minimock.CallerInfo(1) + + return mmListModelRunsByCreditOwner +} + +// ExpectStartedTimeBeginParam7 sets up expected param startedTimeBegin for Repository.ListModelRunsByCreditOwner +func (mmListModelRunsByCreditOwner *mRepositoryMockListModelRunsByCreditOwner) ExpectStartedTimeBeginParam7(startedTimeBegin time.Time) *mRepositoryMockListModelRunsByCreditOwner { + if mmListModelRunsByCreditOwner.mock.funcListModelRunsByCreditOwner != nil { + mmListModelRunsByCreditOwner.mock.t.Fatalf("RepositoryMock.ListModelRunsByCreditOwner mock is already set by Set") + } + + if mmListModelRunsByCreditOwner.defaultExpectation == nil { + mmListModelRunsByCreditOwner.defaultExpectation = &RepositoryMockListModelRunsByCreditOwnerExpectation{} + } + + if mmListModelRunsByCreditOwner.defaultExpectation.params != nil { + mmListModelRunsByCreditOwner.mock.t.Fatalf("RepositoryMock.ListModelRunsByCreditOwner mock is already set by Expect") + } + + if mmListModelRunsByCreditOwner.defaultExpectation.paramPtrs == nil { + mmListModelRunsByCreditOwner.defaultExpectation.paramPtrs = &RepositoryMockListModelRunsByCreditOwnerParamPtrs{} + } + mmListModelRunsByCreditOwner.defaultExpectation.paramPtrs.startedTimeBegin = &startedTimeBegin + mmListModelRunsByCreditOwner.defaultExpectation.expectationOrigins.originStartedTimeBegin = minimock.CallerInfo(1) + + return mmListModelRunsByCreditOwner +} + +// ExpectStartedTimeEndParam8 sets up expected param startedTimeEnd for Repository.ListModelRunsByCreditOwner +func (mmListModelRunsByCreditOwner *mRepositoryMockListModelRunsByCreditOwner) ExpectStartedTimeEndParam8(startedTimeEnd time.Time) *mRepositoryMockListModelRunsByCreditOwner { + if mmListModelRunsByCreditOwner.mock.funcListModelRunsByCreditOwner != nil { + mmListModelRunsByCreditOwner.mock.t.Fatalf("RepositoryMock.ListModelRunsByCreditOwner mock is already set by Set") + } + + if mmListModelRunsByCreditOwner.defaultExpectation == nil { + mmListModelRunsByCreditOwner.defaultExpectation = &RepositoryMockListModelRunsByCreditOwnerExpectation{} + } + + if mmListModelRunsByCreditOwner.defaultExpectation.params != nil { + mmListModelRunsByCreditOwner.mock.t.Fatalf("RepositoryMock.ListModelRunsByCreditOwner mock is already set by Expect") + } + + if mmListModelRunsByCreditOwner.defaultExpectation.paramPtrs == nil { + mmListModelRunsByCreditOwner.defaultExpectation.paramPtrs = &RepositoryMockListModelRunsByCreditOwnerParamPtrs{} + } + mmListModelRunsByCreditOwner.defaultExpectation.paramPtrs.startedTimeEnd = &startedTimeEnd + mmListModelRunsByCreditOwner.defaultExpectation.expectationOrigins.originStartedTimeEnd = minimock.CallerInfo(1) + + return mmListModelRunsByCreditOwner +} + +// Inspect accepts an inspector function that has same arguments as the Repository.ListModelRunsByCreditOwner +func (mmListModelRunsByCreditOwner *mRepositoryMockListModelRunsByCreditOwner) Inspect(f func(ctx context.Context, pageSize int64, page int64, filter filtering.Filter, order ordering.OrderBy, requesterUID string, startedTimeBegin time.Time, startedTimeEnd time.Time)) *mRepositoryMockListModelRunsByCreditOwner { + if mmListModelRunsByCreditOwner.mock.inspectFuncListModelRunsByCreditOwner != nil { + mmListModelRunsByCreditOwner.mock.t.Fatalf("Inspect function is already set for RepositoryMock.ListModelRunsByCreditOwner") + } + + mmListModelRunsByCreditOwner.mock.inspectFuncListModelRunsByCreditOwner = f + + return mmListModelRunsByCreditOwner +} + +// Return sets up results that will be returned by Repository.ListModelRunsByCreditOwner +func (mmListModelRunsByCreditOwner *mRepositoryMockListModelRunsByCreditOwner) Return(modelTriggers []*datamodel.ModelRun, totalSize int64, err error) *RepositoryMock { + if mmListModelRunsByCreditOwner.mock.funcListModelRunsByCreditOwner != nil { + mmListModelRunsByCreditOwner.mock.t.Fatalf("RepositoryMock.ListModelRunsByCreditOwner mock is already set by Set") + } + + if mmListModelRunsByCreditOwner.defaultExpectation == nil { + mmListModelRunsByCreditOwner.defaultExpectation = &RepositoryMockListModelRunsByCreditOwnerExpectation{mock: mmListModelRunsByCreditOwner.mock} + } + mmListModelRunsByCreditOwner.defaultExpectation.results = &RepositoryMockListModelRunsByCreditOwnerResults{modelTriggers, totalSize, err} + mmListModelRunsByCreditOwner.defaultExpectation.returnOrigin = minimock.CallerInfo(1) + return mmListModelRunsByCreditOwner.mock +} + +// Set uses given function f to mock the Repository.ListModelRunsByCreditOwner method +func (mmListModelRunsByCreditOwner *mRepositoryMockListModelRunsByCreditOwner) Set(f func(ctx context.Context, pageSize int64, page int64, filter filtering.Filter, order ordering.OrderBy, requesterUID string, startedTimeBegin time.Time, startedTimeEnd time.Time) (modelTriggers []*datamodel.ModelRun, totalSize int64, err error)) *RepositoryMock { + if mmListModelRunsByCreditOwner.defaultExpectation != nil { + mmListModelRunsByCreditOwner.mock.t.Fatalf("Default expectation is already set for the Repository.ListModelRunsByCreditOwner method") + } + + if len(mmListModelRunsByCreditOwner.expectations) > 0 { + mmListModelRunsByCreditOwner.mock.t.Fatalf("Some expectations are already set for the Repository.ListModelRunsByCreditOwner method") + } + + mmListModelRunsByCreditOwner.mock.funcListModelRunsByCreditOwner = f + mmListModelRunsByCreditOwner.mock.funcListModelRunsByCreditOwnerOrigin = minimock.CallerInfo(1) + return mmListModelRunsByCreditOwner.mock +} + +// When sets expectation for the Repository.ListModelRunsByCreditOwner which will trigger the result defined by the following +// Then helper +func (mmListModelRunsByCreditOwner *mRepositoryMockListModelRunsByCreditOwner) When(ctx context.Context, pageSize int64, page int64, filter filtering.Filter, order ordering.OrderBy, requesterUID string, startedTimeBegin time.Time, startedTimeEnd time.Time) *RepositoryMockListModelRunsByCreditOwnerExpectation { + if mmListModelRunsByCreditOwner.mock.funcListModelRunsByCreditOwner != nil { + mmListModelRunsByCreditOwner.mock.t.Fatalf("RepositoryMock.ListModelRunsByCreditOwner mock is already set by Set") + } + + expectation := &RepositoryMockListModelRunsByCreditOwnerExpectation{ + mock: mmListModelRunsByCreditOwner.mock, + params: &RepositoryMockListModelRunsByCreditOwnerParams{ctx, pageSize, page, filter, order, requesterUID, startedTimeBegin, startedTimeEnd}, + expectationOrigins: RepositoryMockListModelRunsByCreditOwnerExpectationOrigins{origin: minimock.CallerInfo(1)}, + } + mmListModelRunsByCreditOwner.expectations = append(mmListModelRunsByCreditOwner.expectations, expectation) + return expectation +} + +// Then sets up Repository.ListModelRunsByCreditOwner return parameters for the expectation previously defined by the When method +func (e *RepositoryMockListModelRunsByCreditOwnerExpectation) Then(modelTriggers []*datamodel.ModelRun, totalSize int64, err error) *RepositoryMock { + e.results = &RepositoryMockListModelRunsByCreditOwnerResults{modelTriggers, totalSize, err} + return e.mock +} + +// Times sets number of times Repository.ListModelRunsByCreditOwner should be invoked +func (mmListModelRunsByCreditOwner *mRepositoryMockListModelRunsByCreditOwner) Times(n uint64) *mRepositoryMockListModelRunsByCreditOwner { + if n == 0 { + mmListModelRunsByCreditOwner.mock.t.Fatalf("Times of RepositoryMock.ListModelRunsByCreditOwner mock can not be zero") + } + mm_atomic.StoreUint64(&mmListModelRunsByCreditOwner.expectedInvocations, n) + mmListModelRunsByCreditOwner.expectedInvocationsOrigin = minimock.CallerInfo(1) + return mmListModelRunsByCreditOwner +} + +func (mmListModelRunsByCreditOwner *mRepositoryMockListModelRunsByCreditOwner) invocationsDone() bool { + if len(mmListModelRunsByCreditOwner.expectations) == 0 && mmListModelRunsByCreditOwner.defaultExpectation == nil && mmListModelRunsByCreditOwner.mock.funcListModelRunsByCreditOwner == nil { + return true + } + + totalInvocations := mm_atomic.LoadUint64(&mmListModelRunsByCreditOwner.mock.afterListModelRunsByCreditOwnerCounter) + expectedInvocations := mm_atomic.LoadUint64(&mmListModelRunsByCreditOwner.expectedInvocations) + + return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) +} + +// ListModelRunsByCreditOwner implements mm_repository.Repository +func (mmListModelRunsByCreditOwner *RepositoryMock) ListModelRunsByCreditOwner(ctx context.Context, pageSize int64, page int64, filter filtering.Filter, order ordering.OrderBy, requesterUID string, startedTimeBegin time.Time, startedTimeEnd time.Time) (modelTriggers []*datamodel.ModelRun, totalSize int64, err error) { + mm_atomic.AddUint64(&mmListModelRunsByCreditOwner.beforeListModelRunsByCreditOwnerCounter, 1) + defer mm_atomic.AddUint64(&mmListModelRunsByCreditOwner.afterListModelRunsByCreditOwnerCounter, 1) + + mmListModelRunsByCreditOwner.t.Helper() + + if mmListModelRunsByCreditOwner.inspectFuncListModelRunsByCreditOwner != nil { + mmListModelRunsByCreditOwner.inspectFuncListModelRunsByCreditOwner(ctx, pageSize, page, filter, order, requesterUID, startedTimeBegin, startedTimeEnd) + } + + mm_params := RepositoryMockListModelRunsByCreditOwnerParams{ctx, pageSize, page, filter, order, requesterUID, startedTimeBegin, startedTimeEnd} + + // Record call args + mmListModelRunsByCreditOwner.ListModelRunsByCreditOwnerMock.mutex.Lock() + mmListModelRunsByCreditOwner.ListModelRunsByCreditOwnerMock.callArgs = append(mmListModelRunsByCreditOwner.ListModelRunsByCreditOwnerMock.callArgs, &mm_params) + mmListModelRunsByCreditOwner.ListModelRunsByCreditOwnerMock.mutex.Unlock() + + for _, e := range mmListModelRunsByCreditOwner.ListModelRunsByCreditOwnerMock.expectations { + if minimock.Equal(*e.params, mm_params) { + mm_atomic.AddUint64(&e.Counter, 1) + return e.results.modelTriggers, e.results.totalSize, e.results.err + } + } + + if mmListModelRunsByCreditOwner.ListModelRunsByCreditOwnerMock.defaultExpectation != nil { + mm_atomic.AddUint64(&mmListModelRunsByCreditOwner.ListModelRunsByCreditOwnerMock.defaultExpectation.Counter, 1) + mm_want := mmListModelRunsByCreditOwner.ListModelRunsByCreditOwnerMock.defaultExpectation.params + mm_want_ptrs := mmListModelRunsByCreditOwner.ListModelRunsByCreditOwnerMock.defaultExpectation.paramPtrs + + mm_got := RepositoryMockListModelRunsByCreditOwnerParams{ctx, pageSize, page, filter, order, requesterUID, startedTimeBegin, startedTimeEnd} + + if mm_want_ptrs != nil { + + if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { + mmListModelRunsByCreditOwner.t.Errorf("RepositoryMock.ListModelRunsByCreditOwner got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelRunsByCreditOwner.ListModelRunsByCreditOwnerMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + } + + if mm_want_ptrs.pageSize != nil && !minimock.Equal(*mm_want_ptrs.pageSize, mm_got.pageSize) { + mmListModelRunsByCreditOwner.t.Errorf("RepositoryMock.ListModelRunsByCreditOwner got unexpected parameter pageSize, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelRunsByCreditOwner.ListModelRunsByCreditOwnerMock.defaultExpectation.expectationOrigins.originPageSize, *mm_want_ptrs.pageSize, mm_got.pageSize, minimock.Diff(*mm_want_ptrs.pageSize, mm_got.pageSize)) + } + + if mm_want_ptrs.page != nil && !minimock.Equal(*mm_want_ptrs.page, mm_got.page) { + mmListModelRunsByCreditOwner.t.Errorf("RepositoryMock.ListModelRunsByCreditOwner got unexpected parameter page, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelRunsByCreditOwner.ListModelRunsByCreditOwnerMock.defaultExpectation.expectationOrigins.originPage, *mm_want_ptrs.page, mm_got.page, minimock.Diff(*mm_want_ptrs.page, mm_got.page)) + } + + if mm_want_ptrs.filter != nil && !minimock.Equal(*mm_want_ptrs.filter, mm_got.filter) { + mmListModelRunsByCreditOwner.t.Errorf("RepositoryMock.ListModelRunsByCreditOwner got unexpected parameter filter, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelRunsByCreditOwner.ListModelRunsByCreditOwnerMock.defaultExpectation.expectationOrigins.originFilter, *mm_want_ptrs.filter, mm_got.filter, minimock.Diff(*mm_want_ptrs.filter, mm_got.filter)) + } + + if mm_want_ptrs.order != nil && !minimock.Equal(*mm_want_ptrs.order, mm_got.order) { + mmListModelRunsByCreditOwner.t.Errorf("RepositoryMock.ListModelRunsByCreditOwner got unexpected parameter order, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelRunsByCreditOwner.ListModelRunsByCreditOwnerMock.defaultExpectation.expectationOrigins.originOrder, *mm_want_ptrs.order, mm_got.order, minimock.Diff(*mm_want_ptrs.order, mm_got.order)) + } + + if mm_want_ptrs.requesterUID != nil && !minimock.Equal(*mm_want_ptrs.requesterUID, mm_got.requesterUID) { + mmListModelRunsByCreditOwner.t.Errorf("RepositoryMock.ListModelRunsByCreditOwner got unexpected parameter requesterUID, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelRunsByCreditOwner.ListModelRunsByCreditOwnerMock.defaultExpectation.expectationOrigins.originRequesterUID, *mm_want_ptrs.requesterUID, mm_got.requesterUID, minimock.Diff(*mm_want_ptrs.requesterUID, mm_got.requesterUID)) + } + + if mm_want_ptrs.startedTimeBegin != nil && !minimock.Equal(*mm_want_ptrs.startedTimeBegin, mm_got.startedTimeBegin) { + mmListModelRunsByCreditOwner.t.Errorf("RepositoryMock.ListModelRunsByCreditOwner got unexpected parameter startedTimeBegin, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelRunsByCreditOwner.ListModelRunsByCreditOwnerMock.defaultExpectation.expectationOrigins.originStartedTimeBegin, *mm_want_ptrs.startedTimeBegin, mm_got.startedTimeBegin, minimock.Diff(*mm_want_ptrs.startedTimeBegin, mm_got.startedTimeBegin)) + } + + if mm_want_ptrs.startedTimeEnd != nil && !minimock.Equal(*mm_want_ptrs.startedTimeEnd, mm_got.startedTimeEnd) { + mmListModelRunsByCreditOwner.t.Errorf("RepositoryMock.ListModelRunsByCreditOwner got unexpected parameter startedTimeEnd, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelRunsByCreditOwner.ListModelRunsByCreditOwnerMock.defaultExpectation.expectationOrigins.originStartedTimeEnd, *mm_want_ptrs.startedTimeEnd, mm_got.startedTimeEnd, minimock.Diff(*mm_want_ptrs.startedTimeEnd, mm_got.startedTimeEnd)) + } + + } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { + mmListModelRunsByCreditOwner.t.Errorf("RepositoryMock.ListModelRunsByCreditOwner got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelRunsByCreditOwner.ListModelRunsByCreditOwnerMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + } + + mm_results := mmListModelRunsByCreditOwner.ListModelRunsByCreditOwnerMock.defaultExpectation.results + if mm_results == nil { + mmListModelRunsByCreditOwner.t.Fatal("No results are set for the RepositoryMock.ListModelRunsByCreditOwner") + } + return (*mm_results).modelTriggers, (*mm_results).totalSize, (*mm_results).err + } + if mmListModelRunsByCreditOwner.funcListModelRunsByCreditOwner != nil { + return mmListModelRunsByCreditOwner.funcListModelRunsByCreditOwner(ctx, pageSize, page, filter, order, requesterUID, startedTimeBegin, startedTimeEnd) + } + mmListModelRunsByCreditOwner.t.Fatalf("Unexpected call to RepositoryMock.ListModelRunsByCreditOwner. %v %v %v %v %v %v %v %v", ctx, pageSize, page, filter, order, requesterUID, startedTimeBegin, startedTimeEnd) + return +} + +// ListModelRunsByCreditOwnerAfterCounter returns a count of finished RepositoryMock.ListModelRunsByCreditOwner invocations +func (mmListModelRunsByCreditOwner *RepositoryMock) ListModelRunsByCreditOwnerAfterCounter() uint64 { + return mm_atomic.LoadUint64(&mmListModelRunsByCreditOwner.afterListModelRunsByCreditOwnerCounter) +} + +// ListModelRunsByCreditOwnerBeforeCounter returns a count of RepositoryMock.ListModelRunsByCreditOwner invocations +func (mmListModelRunsByCreditOwner *RepositoryMock) ListModelRunsByCreditOwnerBeforeCounter() uint64 { + return mm_atomic.LoadUint64(&mmListModelRunsByCreditOwner.beforeListModelRunsByCreditOwnerCounter) +} + +// Calls returns a list of arguments used in each call to RepositoryMock.ListModelRunsByCreditOwner. +// The list is in the same order as the calls were made (i.e. recent calls have a higher index) +func (mmListModelRunsByCreditOwner *mRepositoryMockListModelRunsByCreditOwner) Calls() []*RepositoryMockListModelRunsByCreditOwnerParams { + mmListModelRunsByCreditOwner.mutex.RLock() + + argCopy := make([]*RepositoryMockListModelRunsByCreditOwnerParams, len(mmListModelRunsByCreditOwner.callArgs)) + copy(argCopy, mmListModelRunsByCreditOwner.callArgs) + + mmListModelRunsByCreditOwner.mutex.RUnlock() + + return argCopy +} + +// MinimockListModelRunsByCreditOwnerDone returns true if the count of the ListModelRunsByCreditOwner invocations corresponds +// the number of defined expectations +func (m *RepositoryMock) MinimockListModelRunsByCreditOwnerDone() bool { + if m.ListModelRunsByCreditOwnerMock.optional { + // Optional methods provide '0 or more' call count restriction. + return true + } + + for _, e := range m.ListModelRunsByCreditOwnerMock.expectations { + if mm_atomic.LoadUint64(&e.Counter) < 1 { + return false + } + } + + return m.ListModelRunsByCreditOwnerMock.invocationsDone() +} + +// MinimockListModelRunsByCreditOwnerInspect logs each unmet expectation +func (m *RepositoryMock) MinimockListModelRunsByCreditOwnerInspect() { + for _, e := range m.ListModelRunsByCreditOwnerMock.expectations { + if mm_atomic.LoadUint64(&e.Counter) < 1 { + m.t.Errorf("Expected call to RepositoryMock.ListModelRunsByCreditOwner at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) + } + } + + afterListModelRunsByCreditOwnerCounter := mm_atomic.LoadUint64(&m.afterListModelRunsByCreditOwnerCounter) + // if default expectation was set then invocations count should be greater than zero + if m.ListModelRunsByCreditOwnerMock.defaultExpectation != nil && afterListModelRunsByCreditOwnerCounter < 1 { + if m.ListModelRunsByCreditOwnerMock.defaultExpectation.params == nil { + m.t.Errorf("Expected call to RepositoryMock.ListModelRunsByCreditOwner at\n%s", m.ListModelRunsByCreditOwnerMock.defaultExpectation.returnOrigin) + } else { + m.t.Errorf("Expected call to RepositoryMock.ListModelRunsByCreditOwner at\n%s with params: %#v", m.ListModelRunsByCreditOwnerMock.defaultExpectation.expectationOrigins.origin, *m.ListModelRunsByCreditOwnerMock.defaultExpectation.params) + } + } + // if func was set then invocations count should be greater than zero + if m.funcListModelRunsByCreditOwner != nil && afterListModelRunsByCreditOwnerCounter < 1 { + m.t.Errorf("Expected call to RepositoryMock.ListModelRunsByCreditOwner at\n%s", m.funcListModelRunsByCreditOwnerOrigin) + } + + if !m.ListModelRunsByCreditOwnerMock.invocationsDone() && afterListModelRunsByCreditOwnerCounter > 0 { + m.t.Errorf("Expected %d calls to RepositoryMock.ListModelRunsByCreditOwner at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.ListModelRunsByCreditOwnerMock.expectedInvocations), m.ListModelRunsByCreditOwnerMock.expectedInvocationsOrigin, afterListModelRunsByCreditOwnerCounter) } } @@ -7741,16 +8848,19 @@ type mRepositoryMockListModelTags struct { callArgs []*RepositoryMockListModelTagsParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockListModelTagsExpectation specifies expectation struct of the Repository.ListModelTags type RepositoryMockListModelTagsExpectation struct { - mock *RepositoryMock - params *RepositoryMockListModelTagsParams - paramPtrs *RepositoryMockListModelTagsParamPtrs - results *RepositoryMockListModelTagsResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockListModelTagsParams + paramPtrs *RepositoryMockListModelTagsParamPtrs + expectationOrigins RepositoryMockListModelTagsExpectationOrigins + results *RepositoryMockListModelTagsResults + returnOrigin string + Counter uint64 } // RepositoryMockListModelTagsParams contains parameters of the Repository.ListModelTags @@ -7771,6 +8881,13 @@ type RepositoryMockListModelTagsResults struct { err error } +// RepositoryMockListModelTagsOrigins contains origins of expectations of the Repository.ListModelTags +type RepositoryMockListModelTagsExpectationOrigins struct { + origin string + originCtx string + originModelUID string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -7796,6 +8913,7 @@ func (mmListModelTags *mRepositoryMockListModelTags) Expect(ctx context.Context, } mmListModelTags.defaultExpectation.params = &RepositoryMockListModelTagsParams{ctx, modelUID} + mmListModelTags.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmListModelTags.expectations { if minimock.Equal(e.params, mmListModelTags.defaultExpectation.params) { mmListModelTags.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmListModelTags.defaultExpectation.params) @@ -7823,6 +8941,7 @@ func (mmListModelTags *mRepositoryMockListModelTags) ExpectCtxParam1(ctx context mmListModelTags.defaultExpectation.paramPtrs = &RepositoryMockListModelTagsParamPtrs{} } mmListModelTags.defaultExpectation.paramPtrs.ctx = &ctx + mmListModelTags.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmListModelTags } @@ -7845,6 +8964,7 @@ func (mmListModelTags *mRepositoryMockListModelTags) ExpectModelUIDParam2(modelU mmListModelTags.defaultExpectation.paramPtrs = &RepositoryMockListModelTagsParamPtrs{} } mmListModelTags.defaultExpectation.paramPtrs.modelUID = &modelUID + mmListModelTags.defaultExpectation.expectationOrigins.originModelUID = minimock.CallerInfo(1) return mmListModelTags } @@ -7870,6 +8990,7 @@ func (mmListModelTags *mRepositoryMockListModelTags) Return(ma1 []datamodel.Mode mmListModelTags.defaultExpectation = &RepositoryMockListModelTagsExpectation{mock: mmListModelTags.mock} } mmListModelTags.defaultExpectation.results = &RepositoryMockListModelTagsResults{ma1, err} + mmListModelTags.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmListModelTags.mock } @@ -7884,6 +9005,7 @@ func (mmListModelTags *mRepositoryMockListModelTags) Set(f func(ctx context.Cont } mmListModelTags.mock.funcListModelTags = f + mmListModelTags.mock.funcListModelTagsOrigin = minimock.CallerInfo(1) return mmListModelTags.mock } @@ -7895,8 +9017,9 @@ func (mmListModelTags *mRepositoryMockListModelTags) When(ctx context.Context, m } expectation := &RepositoryMockListModelTagsExpectation{ - mock: mmListModelTags.mock, - params: &RepositoryMockListModelTagsParams{ctx, modelUID}, + mock: mmListModelTags.mock, + params: &RepositoryMockListModelTagsParams{ctx, modelUID}, + expectationOrigins: RepositoryMockListModelTagsExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmListModelTags.expectations = append(mmListModelTags.expectations, expectation) return expectation @@ -7914,6 +9037,7 @@ func (mmListModelTags *mRepositoryMockListModelTags) Times(n uint64) *mRepositor mmListModelTags.mock.t.Fatalf("Times of RepositoryMock.ListModelTags mock can not be zero") } mm_atomic.StoreUint64(&mmListModelTags.expectedInvocations, n) + mmListModelTags.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmListModelTags } @@ -7928,11 +9052,13 @@ func (mmListModelTags *mRepositoryMockListModelTags) invocationsDone() bool { return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// ListModelTags implements repository.Repository +// ListModelTags implements mm_repository.Repository func (mmListModelTags *RepositoryMock) ListModelTags(ctx context.Context, modelUID uuid.UUID) (ma1 []datamodel.ModelTag, err error) { mm_atomic.AddUint64(&mmListModelTags.beforeListModelTagsCounter, 1) defer mm_atomic.AddUint64(&mmListModelTags.afterListModelTagsCounter, 1) + mmListModelTags.t.Helper() + if mmListModelTags.inspectFuncListModelTags != nil { mmListModelTags.inspectFuncListModelTags(ctx, modelUID) } @@ -7961,15 +9087,18 @@ func (mmListModelTags *RepositoryMock) ListModelTags(ctx context.Context, modelU if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmListModelTags.t.Errorf("RepositoryMock.ListModelTags got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmListModelTags.t.Errorf("RepositoryMock.ListModelTags got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelTags.ListModelTagsMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.modelUID != nil && !minimock.Equal(*mm_want_ptrs.modelUID, mm_got.modelUID) { - mmListModelTags.t.Errorf("RepositoryMock.ListModelTags got unexpected parameter modelUID, want: %#v, got: %#v%s\n", *mm_want_ptrs.modelUID, mm_got.modelUID, minimock.Diff(*mm_want_ptrs.modelUID, mm_got.modelUID)) + mmListModelTags.t.Errorf("RepositoryMock.ListModelTags got unexpected parameter modelUID, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelTags.ListModelTagsMock.defaultExpectation.expectationOrigins.originModelUID, *mm_want_ptrs.modelUID, mm_got.modelUID, minimock.Diff(*mm_want_ptrs.modelUID, mm_got.modelUID)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmListModelTags.t.Errorf("RepositoryMock.ListModelTags got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmListModelTags.t.Errorf("RepositoryMock.ListModelTags got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelTags.ListModelTagsMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmListModelTags.ListModelTagsMock.defaultExpectation.results @@ -8029,7 +9158,7 @@ func (m *RepositoryMock) MinimockListModelTagsDone() bool { func (m *RepositoryMock) MinimockListModelTagsInspect() { for _, e := range m.ListModelTagsMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.ListModelTags with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.ListModelTags at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -8037,19 +9166,19 @@ func (m *RepositoryMock) MinimockListModelTagsInspect() { // if default expectation was set then invocations count should be greater than zero if m.ListModelTagsMock.defaultExpectation != nil && afterListModelTagsCounter < 1 { if m.ListModelTagsMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.ListModelTags") + m.t.Errorf("Expected call to RepositoryMock.ListModelTags at\n%s", m.ListModelTagsMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.ListModelTags with params: %#v", *m.ListModelTagsMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.ListModelTags at\n%s with params: %#v", m.ListModelTagsMock.defaultExpectation.expectationOrigins.origin, *m.ListModelTagsMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcListModelTags != nil && afterListModelTagsCounter < 1 { - m.t.Error("Expected call to RepositoryMock.ListModelTags") + m.t.Errorf("Expected call to RepositoryMock.ListModelTags at\n%s", m.funcListModelTagsOrigin) } if !m.ListModelTagsMock.invocationsDone() && afterListModelTagsCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.ListModelTags but found %d calls", - mm_atomic.LoadUint64(&m.ListModelTagsMock.expectedInvocations), afterListModelTagsCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.ListModelTags at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.ListModelTagsMock.expectedInvocations), m.ListModelTagsMock.expectedInvocationsOrigin, afterListModelTagsCounter) } } @@ -8062,16 +9191,19 @@ type mRepositoryMockListModelVersions struct { callArgs []*RepositoryMockListModelVersionsParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockListModelVersionsExpectation specifies expectation struct of the Repository.ListModelVersions type RepositoryMockListModelVersionsExpectation struct { - mock *RepositoryMock - params *RepositoryMockListModelVersionsParams - paramPtrs *RepositoryMockListModelVersionsParamPtrs - results *RepositoryMockListModelVersionsResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockListModelVersionsParams + paramPtrs *RepositoryMockListModelVersionsParamPtrs + expectationOrigins RepositoryMockListModelVersionsExpectationOrigins + results *RepositoryMockListModelVersionsResults + returnOrigin string + Counter uint64 } // RepositoryMockListModelVersionsParams contains parameters of the Repository.ListModelVersions @@ -8094,6 +9226,14 @@ type RepositoryMockListModelVersionsResults struct { err error } +// RepositoryMockListModelVersionsOrigins contains origins of expectations of the Repository.ListModelVersions +type RepositoryMockListModelVersionsExpectationOrigins struct { + origin string + originCtx string + originModelUID string + originGroupDigest string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -8119,6 +9259,7 @@ func (mmListModelVersions *mRepositoryMockListModelVersions) Expect(ctx context. } mmListModelVersions.defaultExpectation.params = &RepositoryMockListModelVersionsParams{ctx, modelUID, groupDigest} + mmListModelVersions.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmListModelVersions.expectations { if minimock.Equal(e.params, mmListModelVersions.defaultExpectation.params) { mmListModelVersions.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmListModelVersions.defaultExpectation.params) @@ -8146,6 +9287,7 @@ func (mmListModelVersions *mRepositoryMockListModelVersions) ExpectCtxParam1(ctx mmListModelVersions.defaultExpectation.paramPtrs = &RepositoryMockListModelVersionsParamPtrs{} } mmListModelVersions.defaultExpectation.paramPtrs.ctx = &ctx + mmListModelVersions.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmListModelVersions } @@ -8168,6 +9310,7 @@ func (mmListModelVersions *mRepositoryMockListModelVersions) ExpectModelUIDParam mmListModelVersions.defaultExpectation.paramPtrs = &RepositoryMockListModelVersionsParamPtrs{} } mmListModelVersions.defaultExpectation.paramPtrs.modelUID = &modelUID + mmListModelVersions.defaultExpectation.expectationOrigins.originModelUID = minimock.CallerInfo(1) return mmListModelVersions } @@ -8190,6 +9333,7 @@ func (mmListModelVersions *mRepositoryMockListModelVersions) ExpectGroupDigestPa mmListModelVersions.defaultExpectation.paramPtrs = &RepositoryMockListModelVersionsParamPtrs{} } mmListModelVersions.defaultExpectation.paramPtrs.groupDigest = &groupDigest + mmListModelVersions.defaultExpectation.expectationOrigins.originGroupDigest = minimock.CallerInfo(1) return mmListModelVersions } @@ -8215,6 +9359,7 @@ func (mmListModelVersions *mRepositoryMockListModelVersions) Return(versions []* mmListModelVersions.defaultExpectation = &RepositoryMockListModelVersionsExpectation{mock: mmListModelVersions.mock} } mmListModelVersions.defaultExpectation.results = &RepositoryMockListModelVersionsResults{versions, err} + mmListModelVersions.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmListModelVersions.mock } @@ -8229,6 +9374,7 @@ func (mmListModelVersions *mRepositoryMockListModelVersions) Set(f func(ctx cont } mmListModelVersions.mock.funcListModelVersions = f + mmListModelVersions.mock.funcListModelVersionsOrigin = minimock.CallerInfo(1) return mmListModelVersions.mock } @@ -8240,8 +9386,9 @@ func (mmListModelVersions *mRepositoryMockListModelVersions) When(ctx context.Co } expectation := &RepositoryMockListModelVersionsExpectation{ - mock: mmListModelVersions.mock, - params: &RepositoryMockListModelVersionsParams{ctx, modelUID, groupDigest}, + mock: mmListModelVersions.mock, + params: &RepositoryMockListModelVersionsParams{ctx, modelUID, groupDigest}, + expectationOrigins: RepositoryMockListModelVersionsExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmListModelVersions.expectations = append(mmListModelVersions.expectations, expectation) return expectation @@ -8259,6 +9406,7 @@ func (mmListModelVersions *mRepositoryMockListModelVersions) Times(n uint64) *mR mmListModelVersions.mock.t.Fatalf("Times of RepositoryMock.ListModelVersions mock can not be zero") } mm_atomic.StoreUint64(&mmListModelVersions.expectedInvocations, n) + mmListModelVersions.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmListModelVersions } @@ -8273,11 +9421,13 @@ func (mmListModelVersions *mRepositoryMockListModelVersions) invocationsDone() b return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// ListModelVersions implements repository.Repository +// ListModelVersions implements mm_repository.Repository func (mmListModelVersions *RepositoryMock) ListModelVersions(ctx context.Context, modelUID uuid.UUID, groupDigest bool) (versions []*datamodel.ModelVersion, err error) { mm_atomic.AddUint64(&mmListModelVersions.beforeListModelVersionsCounter, 1) defer mm_atomic.AddUint64(&mmListModelVersions.afterListModelVersionsCounter, 1) + mmListModelVersions.t.Helper() + if mmListModelVersions.inspectFuncListModelVersions != nil { mmListModelVersions.inspectFuncListModelVersions(ctx, modelUID, groupDigest) } @@ -8306,19 +9456,23 @@ func (mmListModelVersions *RepositoryMock) ListModelVersions(ctx context.Context if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmListModelVersions.t.Errorf("RepositoryMock.ListModelVersions got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmListModelVersions.t.Errorf("RepositoryMock.ListModelVersions got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelVersions.ListModelVersionsMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.modelUID != nil && !minimock.Equal(*mm_want_ptrs.modelUID, mm_got.modelUID) { - mmListModelVersions.t.Errorf("RepositoryMock.ListModelVersions got unexpected parameter modelUID, want: %#v, got: %#v%s\n", *mm_want_ptrs.modelUID, mm_got.modelUID, minimock.Diff(*mm_want_ptrs.modelUID, mm_got.modelUID)) + mmListModelVersions.t.Errorf("RepositoryMock.ListModelVersions got unexpected parameter modelUID, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelVersions.ListModelVersionsMock.defaultExpectation.expectationOrigins.originModelUID, *mm_want_ptrs.modelUID, mm_got.modelUID, minimock.Diff(*mm_want_ptrs.modelUID, mm_got.modelUID)) } if mm_want_ptrs.groupDigest != nil && !minimock.Equal(*mm_want_ptrs.groupDigest, mm_got.groupDigest) { - mmListModelVersions.t.Errorf("RepositoryMock.ListModelVersions got unexpected parameter groupDigest, want: %#v, got: %#v%s\n", *mm_want_ptrs.groupDigest, mm_got.groupDigest, minimock.Diff(*mm_want_ptrs.groupDigest, mm_got.groupDigest)) + mmListModelVersions.t.Errorf("RepositoryMock.ListModelVersions got unexpected parameter groupDigest, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelVersions.ListModelVersionsMock.defaultExpectation.expectationOrigins.originGroupDigest, *mm_want_ptrs.groupDigest, mm_got.groupDigest, minimock.Diff(*mm_want_ptrs.groupDigest, mm_got.groupDigest)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmListModelVersions.t.Errorf("RepositoryMock.ListModelVersions got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmListModelVersions.t.Errorf("RepositoryMock.ListModelVersions got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelVersions.ListModelVersionsMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmListModelVersions.ListModelVersionsMock.defaultExpectation.results @@ -8378,7 +9532,7 @@ func (m *RepositoryMock) MinimockListModelVersionsDone() bool { func (m *RepositoryMock) MinimockListModelVersionsInspect() { for _, e := range m.ListModelVersionsMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.ListModelVersions with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.ListModelVersions at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -8386,19 +9540,19 @@ func (m *RepositoryMock) MinimockListModelVersionsInspect() { // if default expectation was set then invocations count should be greater than zero if m.ListModelVersionsMock.defaultExpectation != nil && afterListModelVersionsCounter < 1 { if m.ListModelVersionsMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.ListModelVersions") + m.t.Errorf("Expected call to RepositoryMock.ListModelVersions at\n%s", m.ListModelVersionsMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.ListModelVersions with params: %#v", *m.ListModelVersionsMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.ListModelVersions at\n%s with params: %#v", m.ListModelVersionsMock.defaultExpectation.expectationOrigins.origin, *m.ListModelVersionsMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcListModelVersions != nil && afterListModelVersionsCounter < 1 { - m.t.Error("Expected call to RepositoryMock.ListModelVersions") + m.t.Errorf("Expected call to RepositoryMock.ListModelVersions at\n%s", m.funcListModelVersionsOrigin) } if !m.ListModelVersionsMock.invocationsDone() && afterListModelVersionsCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.ListModelVersions but found %d calls", - mm_atomic.LoadUint64(&m.ListModelVersionsMock.expectedInvocations), afterListModelVersionsCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.ListModelVersions at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.ListModelVersionsMock.expectedInvocations), m.ListModelVersionsMock.expectedInvocationsOrigin, afterListModelVersionsCounter) } } @@ -8411,16 +9565,19 @@ type mRepositoryMockListModelVersionsByDigest struct { callArgs []*RepositoryMockListModelVersionsByDigestParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockListModelVersionsByDigestExpectation specifies expectation struct of the Repository.ListModelVersionsByDigest type RepositoryMockListModelVersionsByDigestExpectation struct { - mock *RepositoryMock - params *RepositoryMockListModelVersionsByDigestParams - paramPtrs *RepositoryMockListModelVersionsByDigestParamPtrs - results *RepositoryMockListModelVersionsByDigestResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockListModelVersionsByDigestParams + paramPtrs *RepositoryMockListModelVersionsByDigestParamPtrs + expectationOrigins RepositoryMockListModelVersionsByDigestExpectationOrigins + results *RepositoryMockListModelVersionsByDigestResults + returnOrigin string + Counter uint64 } // RepositoryMockListModelVersionsByDigestParams contains parameters of the Repository.ListModelVersionsByDigest @@ -8443,6 +9600,14 @@ type RepositoryMockListModelVersionsByDigestResults struct { err error } +// RepositoryMockListModelVersionsByDigestOrigins contains origins of expectations of the Repository.ListModelVersionsByDigest +type RepositoryMockListModelVersionsByDigestExpectationOrigins struct { + origin string + originCtx string + originModelUID string + originDigest string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -8468,6 +9633,7 @@ func (mmListModelVersionsByDigest *mRepositoryMockListModelVersionsByDigest) Exp } mmListModelVersionsByDigest.defaultExpectation.params = &RepositoryMockListModelVersionsByDigestParams{ctx, modelUID, digest} + mmListModelVersionsByDigest.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmListModelVersionsByDigest.expectations { if minimock.Equal(e.params, mmListModelVersionsByDigest.defaultExpectation.params) { mmListModelVersionsByDigest.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmListModelVersionsByDigest.defaultExpectation.params) @@ -8495,6 +9661,7 @@ func (mmListModelVersionsByDigest *mRepositoryMockListModelVersionsByDigest) Exp mmListModelVersionsByDigest.defaultExpectation.paramPtrs = &RepositoryMockListModelVersionsByDigestParamPtrs{} } mmListModelVersionsByDigest.defaultExpectation.paramPtrs.ctx = &ctx + mmListModelVersionsByDigest.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmListModelVersionsByDigest } @@ -8517,6 +9684,7 @@ func (mmListModelVersionsByDigest *mRepositoryMockListModelVersionsByDigest) Exp mmListModelVersionsByDigest.defaultExpectation.paramPtrs = &RepositoryMockListModelVersionsByDigestParamPtrs{} } mmListModelVersionsByDigest.defaultExpectation.paramPtrs.modelUID = &modelUID + mmListModelVersionsByDigest.defaultExpectation.expectationOrigins.originModelUID = minimock.CallerInfo(1) return mmListModelVersionsByDigest } @@ -8539,6 +9707,7 @@ func (mmListModelVersionsByDigest *mRepositoryMockListModelVersionsByDigest) Exp mmListModelVersionsByDigest.defaultExpectation.paramPtrs = &RepositoryMockListModelVersionsByDigestParamPtrs{} } mmListModelVersionsByDigest.defaultExpectation.paramPtrs.digest = &digest + mmListModelVersionsByDigest.defaultExpectation.expectationOrigins.originDigest = minimock.CallerInfo(1) return mmListModelVersionsByDigest } @@ -8564,6 +9733,7 @@ func (mmListModelVersionsByDigest *mRepositoryMockListModelVersionsByDigest) Ret mmListModelVersionsByDigest.defaultExpectation = &RepositoryMockListModelVersionsByDigestExpectation{mock: mmListModelVersionsByDigest.mock} } mmListModelVersionsByDigest.defaultExpectation.results = &RepositoryMockListModelVersionsByDigestResults{versions, err} + mmListModelVersionsByDigest.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmListModelVersionsByDigest.mock } @@ -8578,6 +9748,7 @@ func (mmListModelVersionsByDigest *mRepositoryMockListModelVersionsByDigest) Set } mmListModelVersionsByDigest.mock.funcListModelVersionsByDigest = f + mmListModelVersionsByDigest.mock.funcListModelVersionsByDigestOrigin = minimock.CallerInfo(1) return mmListModelVersionsByDigest.mock } @@ -8589,8 +9760,9 @@ func (mmListModelVersionsByDigest *mRepositoryMockListModelVersionsByDigest) Whe } expectation := &RepositoryMockListModelVersionsByDigestExpectation{ - mock: mmListModelVersionsByDigest.mock, - params: &RepositoryMockListModelVersionsByDigestParams{ctx, modelUID, digest}, + mock: mmListModelVersionsByDigest.mock, + params: &RepositoryMockListModelVersionsByDigestParams{ctx, modelUID, digest}, + expectationOrigins: RepositoryMockListModelVersionsByDigestExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmListModelVersionsByDigest.expectations = append(mmListModelVersionsByDigest.expectations, expectation) return expectation @@ -8608,6 +9780,7 @@ func (mmListModelVersionsByDigest *mRepositoryMockListModelVersionsByDigest) Tim mmListModelVersionsByDigest.mock.t.Fatalf("Times of RepositoryMock.ListModelVersionsByDigest mock can not be zero") } mm_atomic.StoreUint64(&mmListModelVersionsByDigest.expectedInvocations, n) + mmListModelVersionsByDigest.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmListModelVersionsByDigest } @@ -8622,11 +9795,13 @@ func (mmListModelVersionsByDigest *mRepositoryMockListModelVersionsByDigest) inv return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// ListModelVersionsByDigest implements repository.Repository +// ListModelVersionsByDigest implements mm_repository.Repository func (mmListModelVersionsByDigest *RepositoryMock) ListModelVersionsByDigest(ctx context.Context, modelUID uuid.UUID, digest string) (versions []*datamodel.ModelVersion, err error) { mm_atomic.AddUint64(&mmListModelVersionsByDigest.beforeListModelVersionsByDigestCounter, 1) defer mm_atomic.AddUint64(&mmListModelVersionsByDigest.afterListModelVersionsByDigestCounter, 1) + mmListModelVersionsByDigest.t.Helper() + if mmListModelVersionsByDigest.inspectFuncListModelVersionsByDigest != nil { mmListModelVersionsByDigest.inspectFuncListModelVersionsByDigest(ctx, modelUID, digest) } @@ -8655,19 +9830,23 @@ func (mmListModelVersionsByDigest *RepositoryMock) ListModelVersionsByDigest(ctx if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmListModelVersionsByDigest.t.Errorf("RepositoryMock.ListModelVersionsByDigest got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmListModelVersionsByDigest.t.Errorf("RepositoryMock.ListModelVersionsByDigest got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelVersionsByDigest.ListModelVersionsByDigestMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.modelUID != nil && !minimock.Equal(*mm_want_ptrs.modelUID, mm_got.modelUID) { - mmListModelVersionsByDigest.t.Errorf("RepositoryMock.ListModelVersionsByDigest got unexpected parameter modelUID, want: %#v, got: %#v%s\n", *mm_want_ptrs.modelUID, mm_got.modelUID, minimock.Diff(*mm_want_ptrs.modelUID, mm_got.modelUID)) + mmListModelVersionsByDigest.t.Errorf("RepositoryMock.ListModelVersionsByDigest got unexpected parameter modelUID, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelVersionsByDigest.ListModelVersionsByDigestMock.defaultExpectation.expectationOrigins.originModelUID, *mm_want_ptrs.modelUID, mm_got.modelUID, minimock.Diff(*mm_want_ptrs.modelUID, mm_got.modelUID)) } if mm_want_ptrs.digest != nil && !minimock.Equal(*mm_want_ptrs.digest, mm_got.digest) { - mmListModelVersionsByDigest.t.Errorf("RepositoryMock.ListModelVersionsByDigest got unexpected parameter digest, want: %#v, got: %#v%s\n", *mm_want_ptrs.digest, mm_got.digest, minimock.Diff(*mm_want_ptrs.digest, mm_got.digest)) + mmListModelVersionsByDigest.t.Errorf("RepositoryMock.ListModelVersionsByDigest got unexpected parameter digest, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelVersionsByDigest.ListModelVersionsByDigestMock.defaultExpectation.expectationOrigins.originDigest, *mm_want_ptrs.digest, mm_got.digest, minimock.Diff(*mm_want_ptrs.digest, mm_got.digest)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmListModelVersionsByDigest.t.Errorf("RepositoryMock.ListModelVersionsByDigest got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmListModelVersionsByDigest.t.Errorf("RepositoryMock.ListModelVersionsByDigest got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelVersionsByDigest.ListModelVersionsByDigestMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmListModelVersionsByDigest.ListModelVersionsByDigestMock.defaultExpectation.results @@ -8727,7 +9906,7 @@ func (m *RepositoryMock) MinimockListModelVersionsByDigestDone() bool { func (m *RepositoryMock) MinimockListModelVersionsByDigestInspect() { for _, e := range m.ListModelVersionsByDigestMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.ListModelVersionsByDigest with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.ListModelVersionsByDigest at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -8735,19 +9914,19 @@ func (m *RepositoryMock) MinimockListModelVersionsByDigestInspect() { // if default expectation was set then invocations count should be greater than zero if m.ListModelVersionsByDigestMock.defaultExpectation != nil && afterListModelVersionsByDigestCounter < 1 { if m.ListModelVersionsByDigestMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.ListModelVersionsByDigest") + m.t.Errorf("Expected call to RepositoryMock.ListModelVersionsByDigest at\n%s", m.ListModelVersionsByDigestMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.ListModelVersionsByDigest with params: %#v", *m.ListModelVersionsByDigestMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.ListModelVersionsByDigest at\n%s with params: %#v", m.ListModelVersionsByDigestMock.defaultExpectation.expectationOrigins.origin, *m.ListModelVersionsByDigestMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcListModelVersionsByDigest != nil && afterListModelVersionsByDigestCounter < 1 { - m.t.Error("Expected call to RepositoryMock.ListModelVersionsByDigest") + m.t.Errorf("Expected call to RepositoryMock.ListModelVersionsByDigest at\n%s", m.funcListModelVersionsByDigestOrigin) } if !m.ListModelVersionsByDigestMock.invocationsDone() && afterListModelVersionsByDigestCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.ListModelVersionsByDigest but found %d calls", - mm_atomic.LoadUint64(&m.ListModelVersionsByDigestMock.expectedInvocations), afterListModelVersionsByDigestCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.ListModelVersionsByDigest at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.ListModelVersionsByDigestMock.expectedInvocations), m.ListModelVersionsByDigestMock.expectedInvocationsOrigin, afterListModelVersionsByDigestCounter) } } @@ -8760,16 +9939,19 @@ type mRepositoryMockListModels struct { callArgs []*RepositoryMockListModelsParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockListModelsExpectation specifies expectation struct of the Repository.ListModels type RepositoryMockListModelsExpectation struct { - mock *RepositoryMock - params *RepositoryMockListModelsParams - paramPtrs *RepositoryMockListModelsParamPtrs - results *RepositoryMockListModelsResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockListModelsParams + paramPtrs *RepositoryMockListModelsParamPtrs + expectationOrigins RepositoryMockListModelsExpectationOrigins + results *RepositoryMockListModelsResults + returnOrigin string + Counter uint64 } // RepositoryMockListModelsParams contains parameters of the Repository.ListModels @@ -8806,6 +9988,20 @@ type RepositoryMockListModelsResults struct { err error } +// RepositoryMockListModelsOrigins contains origins of expectations of the Repository.ListModels +type RepositoryMockListModelsExpectationOrigins struct { + origin string + originCtx string + originPageSize string + originPageToken string + originIsBasicView string + originFilter string + originUidAllowList string + originShowDeleted string + originOrder string + originVisibility string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -8831,6 +10027,7 @@ func (mmListModels *mRepositoryMockListModels) Expect(ctx context.Context, pageS } mmListModels.defaultExpectation.params = &RepositoryMockListModelsParams{ctx, pageSize, pageToken, isBasicView, filter, uidAllowList, showDeleted, order, visibility} + mmListModels.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmListModels.expectations { if minimock.Equal(e.params, mmListModels.defaultExpectation.params) { mmListModels.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmListModels.defaultExpectation.params) @@ -8858,6 +10055,7 @@ func (mmListModels *mRepositoryMockListModels) ExpectCtxParam1(ctx context.Conte mmListModels.defaultExpectation.paramPtrs = &RepositoryMockListModelsParamPtrs{} } mmListModels.defaultExpectation.paramPtrs.ctx = &ctx + mmListModels.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmListModels } @@ -8880,6 +10078,7 @@ func (mmListModels *mRepositoryMockListModels) ExpectPageSizeParam2(pageSize int mmListModels.defaultExpectation.paramPtrs = &RepositoryMockListModelsParamPtrs{} } mmListModels.defaultExpectation.paramPtrs.pageSize = &pageSize + mmListModels.defaultExpectation.expectationOrigins.originPageSize = minimock.CallerInfo(1) return mmListModels } @@ -8902,6 +10101,7 @@ func (mmListModels *mRepositoryMockListModels) ExpectPageTokenParam3(pageToken s mmListModels.defaultExpectation.paramPtrs = &RepositoryMockListModelsParamPtrs{} } mmListModels.defaultExpectation.paramPtrs.pageToken = &pageToken + mmListModels.defaultExpectation.expectationOrigins.originPageToken = minimock.CallerInfo(1) return mmListModels } @@ -8924,6 +10124,7 @@ func (mmListModels *mRepositoryMockListModels) ExpectIsBasicViewParam4(isBasicVi mmListModels.defaultExpectation.paramPtrs = &RepositoryMockListModelsParamPtrs{} } mmListModels.defaultExpectation.paramPtrs.isBasicView = &isBasicView + mmListModels.defaultExpectation.expectationOrigins.originIsBasicView = minimock.CallerInfo(1) return mmListModels } @@ -8946,6 +10147,7 @@ func (mmListModels *mRepositoryMockListModels) ExpectFilterParam5(filter filteri mmListModels.defaultExpectation.paramPtrs = &RepositoryMockListModelsParamPtrs{} } mmListModels.defaultExpectation.paramPtrs.filter = &filter + mmListModels.defaultExpectation.expectationOrigins.originFilter = minimock.CallerInfo(1) return mmListModels } @@ -8968,6 +10170,7 @@ func (mmListModels *mRepositoryMockListModels) ExpectUidAllowListParam6(uidAllow mmListModels.defaultExpectation.paramPtrs = &RepositoryMockListModelsParamPtrs{} } mmListModels.defaultExpectation.paramPtrs.uidAllowList = &uidAllowList + mmListModels.defaultExpectation.expectationOrigins.originUidAllowList = minimock.CallerInfo(1) return mmListModels } @@ -8990,6 +10193,7 @@ func (mmListModels *mRepositoryMockListModels) ExpectShowDeletedParam7(showDelet mmListModels.defaultExpectation.paramPtrs = &RepositoryMockListModelsParamPtrs{} } mmListModels.defaultExpectation.paramPtrs.showDeleted = &showDeleted + mmListModels.defaultExpectation.expectationOrigins.originShowDeleted = minimock.CallerInfo(1) return mmListModels } @@ -9012,6 +10216,7 @@ func (mmListModels *mRepositoryMockListModels) ExpectOrderParam8(order ordering. mmListModels.defaultExpectation.paramPtrs = &RepositoryMockListModelsParamPtrs{} } mmListModels.defaultExpectation.paramPtrs.order = &order + mmListModels.defaultExpectation.expectationOrigins.originOrder = minimock.CallerInfo(1) return mmListModels } @@ -9034,6 +10239,7 @@ func (mmListModels *mRepositoryMockListModels) ExpectVisibilityParam9(visibility mmListModels.defaultExpectation.paramPtrs = &RepositoryMockListModelsParamPtrs{} } mmListModels.defaultExpectation.paramPtrs.visibility = &visibility + mmListModels.defaultExpectation.expectationOrigins.originVisibility = minimock.CallerInfo(1) return mmListModels } @@ -9059,6 +10265,7 @@ func (mmListModels *mRepositoryMockListModels) Return(models []*datamodel.Model, mmListModels.defaultExpectation = &RepositoryMockListModelsExpectation{mock: mmListModels.mock} } mmListModels.defaultExpectation.results = &RepositoryMockListModelsResults{models, totalSize, nextPageToken, err} + mmListModels.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmListModels.mock } @@ -9073,6 +10280,7 @@ func (mmListModels *mRepositoryMockListModels) Set(f func(ctx context.Context, p } mmListModels.mock.funcListModels = f + mmListModels.mock.funcListModelsOrigin = minimock.CallerInfo(1) return mmListModels.mock } @@ -9084,8 +10292,9 @@ func (mmListModels *mRepositoryMockListModels) When(ctx context.Context, pageSiz } expectation := &RepositoryMockListModelsExpectation{ - mock: mmListModels.mock, - params: &RepositoryMockListModelsParams{ctx, pageSize, pageToken, isBasicView, filter, uidAllowList, showDeleted, order, visibility}, + mock: mmListModels.mock, + params: &RepositoryMockListModelsParams{ctx, pageSize, pageToken, isBasicView, filter, uidAllowList, showDeleted, order, visibility}, + expectationOrigins: RepositoryMockListModelsExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmListModels.expectations = append(mmListModels.expectations, expectation) return expectation @@ -9103,6 +10312,7 @@ func (mmListModels *mRepositoryMockListModels) Times(n uint64) *mRepositoryMockL mmListModels.mock.t.Fatalf("Times of RepositoryMock.ListModels mock can not be zero") } mm_atomic.StoreUint64(&mmListModels.expectedInvocations, n) + mmListModels.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmListModels } @@ -9117,11 +10327,13 @@ func (mmListModels *mRepositoryMockListModels) invocationsDone() bool { return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// ListModels implements repository.Repository +// ListModels implements mm_repository.Repository func (mmListModels *RepositoryMock) ListModels(ctx context.Context, pageSize int64, pageToken string, isBasicView bool, filter filtering.Filter, uidAllowList []uuid.UUID, showDeleted bool, order ordering.OrderBy, visibility *modelpb.Model_Visibility) (models []*datamodel.Model, totalSize int64, nextPageToken string, err error) { mm_atomic.AddUint64(&mmListModels.beforeListModelsCounter, 1) defer mm_atomic.AddUint64(&mmListModels.afterListModelsCounter, 1) + mmListModels.t.Helper() + if mmListModels.inspectFuncListModels != nil { mmListModels.inspectFuncListModels(ctx, pageSize, pageToken, isBasicView, filter, uidAllowList, showDeleted, order, visibility) } @@ -9150,43 +10362,53 @@ func (mmListModels *RepositoryMock) ListModels(ctx context.Context, pageSize int if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmListModels.t.Errorf("RepositoryMock.ListModels got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmListModels.t.Errorf("RepositoryMock.ListModels got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModels.ListModelsMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.pageSize != nil && !minimock.Equal(*mm_want_ptrs.pageSize, mm_got.pageSize) { - mmListModels.t.Errorf("RepositoryMock.ListModels got unexpected parameter pageSize, want: %#v, got: %#v%s\n", *mm_want_ptrs.pageSize, mm_got.pageSize, minimock.Diff(*mm_want_ptrs.pageSize, mm_got.pageSize)) + mmListModels.t.Errorf("RepositoryMock.ListModels got unexpected parameter pageSize, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModels.ListModelsMock.defaultExpectation.expectationOrigins.originPageSize, *mm_want_ptrs.pageSize, mm_got.pageSize, minimock.Diff(*mm_want_ptrs.pageSize, mm_got.pageSize)) } if mm_want_ptrs.pageToken != nil && !minimock.Equal(*mm_want_ptrs.pageToken, mm_got.pageToken) { - mmListModels.t.Errorf("RepositoryMock.ListModels got unexpected parameter pageToken, want: %#v, got: %#v%s\n", *mm_want_ptrs.pageToken, mm_got.pageToken, minimock.Diff(*mm_want_ptrs.pageToken, mm_got.pageToken)) + mmListModels.t.Errorf("RepositoryMock.ListModels got unexpected parameter pageToken, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModels.ListModelsMock.defaultExpectation.expectationOrigins.originPageToken, *mm_want_ptrs.pageToken, mm_got.pageToken, minimock.Diff(*mm_want_ptrs.pageToken, mm_got.pageToken)) } if mm_want_ptrs.isBasicView != nil && !minimock.Equal(*mm_want_ptrs.isBasicView, mm_got.isBasicView) { - mmListModels.t.Errorf("RepositoryMock.ListModels got unexpected parameter isBasicView, want: %#v, got: %#v%s\n", *mm_want_ptrs.isBasicView, mm_got.isBasicView, minimock.Diff(*mm_want_ptrs.isBasicView, mm_got.isBasicView)) + mmListModels.t.Errorf("RepositoryMock.ListModels got unexpected parameter isBasicView, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModels.ListModelsMock.defaultExpectation.expectationOrigins.originIsBasicView, *mm_want_ptrs.isBasicView, mm_got.isBasicView, minimock.Diff(*mm_want_ptrs.isBasicView, mm_got.isBasicView)) } if mm_want_ptrs.filter != nil && !minimock.Equal(*mm_want_ptrs.filter, mm_got.filter) { - mmListModels.t.Errorf("RepositoryMock.ListModels got unexpected parameter filter, want: %#v, got: %#v%s\n", *mm_want_ptrs.filter, mm_got.filter, minimock.Diff(*mm_want_ptrs.filter, mm_got.filter)) + mmListModels.t.Errorf("RepositoryMock.ListModels got unexpected parameter filter, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModels.ListModelsMock.defaultExpectation.expectationOrigins.originFilter, *mm_want_ptrs.filter, mm_got.filter, minimock.Diff(*mm_want_ptrs.filter, mm_got.filter)) } if mm_want_ptrs.uidAllowList != nil && !minimock.Equal(*mm_want_ptrs.uidAllowList, mm_got.uidAllowList) { - mmListModels.t.Errorf("RepositoryMock.ListModels got unexpected parameter uidAllowList, want: %#v, got: %#v%s\n", *mm_want_ptrs.uidAllowList, mm_got.uidAllowList, minimock.Diff(*mm_want_ptrs.uidAllowList, mm_got.uidAllowList)) + mmListModels.t.Errorf("RepositoryMock.ListModels got unexpected parameter uidAllowList, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModels.ListModelsMock.defaultExpectation.expectationOrigins.originUidAllowList, *mm_want_ptrs.uidAllowList, mm_got.uidAllowList, minimock.Diff(*mm_want_ptrs.uidAllowList, mm_got.uidAllowList)) } if mm_want_ptrs.showDeleted != nil && !minimock.Equal(*mm_want_ptrs.showDeleted, mm_got.showDeleted) { - mmListModels.t.Errorf("RepositoryMock.ListModels got unexpected parameter showDeleted, want: %#v, got: %#v%s\n", *mm_want_ptrs.showDeleted, mm_got.showDeleted, minimock.Diff(*mm_want_ptrs.showDeleted, mm_got.showDeleted)) + mmListModels.t.Errorf("RepositoryMock.ListModels got unexpected parameter showDeleted, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModels.ListModelsMock.defaultExpectation.expectationOrigins.originShowDeleted, *mm_want_ptrs.showDeleted, mm_got.showDeleted, minimock.Diff(*mm_want_ptrs.showDeleted, mm_got.showDeleted)) } if mm_want_ptrs.order != nil && !minimock.Equal(*mm_want_ptrs.order, mm_got.order) { - mmListModels.t.Errorf("RepositoryMock.ListModels got unexpected parameter order, want: %#v, got: %#v%s\n", *mm_want_ptrs.order, mm_got.order, minimock.Diff(*mm_want_ptrs.order, mm_got.order)) + mmListModels.t.Errorf("RepositoryMock.ListModels got unexpected parameter order, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModels.ListModelsMock.defaultExpectation.expectationOrigins.originOrder, *mm_want_ptrs.order, mm_got.order, minimock.Diff(*mm_want_ptrs.order, mm_got.order)) } if mm_want_ptrs.visibility != nil && !minimock.Equal(*mm_want_ptrs.visibility, mm_got.visibility) { - mmListModels.t.Errorf("RepositoryMock.ListModels got unexpected parameter visibility, want: %#v, got: %#v%s\n", *mm_want_ptrs.visibility, mm_got.visibility, minimock.Diff(*mm_want_ptrs.visibility, mm_got.visibility)) + mmListModels.t.Errorf("RepositoryMock.ListModels got unexpected parameter visibility, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModels.ListModelsMock.defaultExpectation.expectationOrigins.originVisibility, *mm_want_ptrs.visibility, mm_got.visibility, minimock.Diff(*mm_want_ptrs.visibility, mm_got.visibility)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmListModels.t.Errorf("RepositoryMock.ListModels got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmListModels.t.Errorf("RepositoryMock.ListModels got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModels.ListModelsMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmListModels.ListModelsMock.defaultExpectation.results @@ -9246,7 +10468,7 @@ func (m *RepositoryMock) MinimockListModelsDone() bool { func (m *RepositoryMock) MinimockListModelsInspect() { for _, e := range m.ListModelsMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.ListModels with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.ListModels at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -9254,19 +10476,19 @@ func (m *RepositoryMock) MinimockListModelsInspect() { // if default expectation was set then invocations count should be greater than zero if m.ListModelsMock.defaultExpectation != nil && afterListModelsCounter < 1 { if m.ListModelsMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.ListModels") + m.t.Errorf("Expected call to RepositoryMock.ListModels at\n%s", m.ListModelsMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.ListModels with params: %#v", *m.ListModelsMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.ListModels at\n%s with params: %#v", m.ListModelsMock.defaultExpectation.expectationOrigins.origin, *m.ListModelsMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcListModels != nil && afterListModelsCounter < 1 { - m.t.Error("Expected call to RepositoryMock.ListModels") + m.t.Errorf("Expected call to RepositoryMock.ListModels at\n%s", m.funcListModelsOrigin) } if !m.ListModelsMock.invocationsDone() && afterListModelsCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.ListModels but found %d calls", - mm_atomic.LoadUint64(&m.ListModelsMock.expectedInvocations), afterListModelsCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.ListModels at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.ListModelsMock.expectedInvocations), m.ListModelsMock.expectedInvocationsOrigin, afterListModelsCounter) } } @@ -9279,16 +10501,19 @@ type mRepositoryMockListModelsAdmin struct { callArgs []*RepositoryMockListModelsAdminParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockListModelsAdminExpectation specifies expectation struct of the Repository.ListModelsAdmin type RepositoryMockListModelsAdminExpectation struct { - mock *RepositoryMock - params *RepositoryMockListModelsAdminParams - paramPtrs *RepositoryMockListModelsAdminParamPtrs - results *RepositoryMockListModelsAdminResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockListModelsAdminParams + paramPtrs *RepositoryMockListModelsAdminParamPtrs + expectationOrigins RepositoryMockListModelsAdminExpectationOrigins + results *RepositoryMockListModelsAdminResults + returnOrigin string + Counter uint64 } // RepositoryMockListModelsAdminParams contains parameters of the Repository.ListModelsAdmin @@ -9319,6 +10544,17 @@ type RepositoryMockListModelsAdminResults struct { err error } +// RepositoryMockListModelsAdminOrigins contains origins of expectations of the Repository.ListModelsAdmin +type RepositoryMockListModelsAdminExpectationOrigins struct { + origin string + originCtx string + originPageSize string + originPageToken string + originIsBasicView string + originFilter string + originShowDeleted string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -9344,6 +10580,7 @@ func (mmListModelsAdmin *mRepositoryMockListModelsAdmin) Expect(ctx context.Cont } mmListModelsAdmin.defaultExpectation.params = &RepositoryMockListModelsAdminParams{ctx, pageSize, pageToken, isBasicView, filter, showDeleted} + mmListModelsAdmin.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmListModelsAdmin.expectations { if minimock.Equal(e.params, mmListModelsAdmin.defaultExpectation.params) { mmListModelsAdmin.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmListModelsAdmin.defaultExpectation.params) @@ -9371,6 +10608,7 @@ func (mmListModelsAdmin *mRepositoryMockListModelsAdmin) ExpectCtxParam1(ctx con mmListModelsAdmin.defaultExpectation.paramPtrs = &RepositoryMockListModelsAdminParamPtrs{} } mmListModelsAdmin.defaultExpectation.paramPtrs.ctx = &ctx + mmListModelsAdmin.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmListModelsAdmin } @@ -9393,6 +10631,7 @@ func (mmListModelsAdmin *mRepositoryMockListModelsAdmin) ExpectPageSizeParam2(pa mmListModelsAdmin.defaultExpectation.paramPtrs = &RepositoryMockListModelsAdminParamPtrs{} } mmListModelsAdmin.defaultExpectation.paramPtrs.pageSize = &pageSize + mmListModelsAdmin.defaultExpectation.expectationOrigins.originPageSize = minimock.CallerInfo(1) return mmListModelsAdmin } @@ -9415,6 +10654,7 @@ func (mmListModelsAdmin *mRepositoryMockListModelsAdmin) ExpectPageTokenParam3(p mmListModelsAdmin.defaultExpectation.paramPtrs = &RepositoryMockListModelsAdminParamPtrs{} } mmListModelsAdmin.defaultExpectation.paramPtrs.pageToken = &pageToken + mmListModelsAdmin.defaultExpectation.expectationOrigins.originPageToken = minimock.CallerInfo(1) return mmListModelsAdmin } @@ -9437,6 +10677,7 @@ func (mmListModelsAdmin *mRepositoryMockListModelsAdmin) ExpectIsBasicViewParam4 mmListModelsAdmin.defaultExpectation.paramPtrs = &RepositoryMockListModelsAdminParamPtrs{} } mmListModelsAdmin.defaultExpectation.paramPtrs.isBasicView = &isBasicView + mmListModelsAdmin.defaultExpectation.expectationOrigins.originIsBasicView = minimock.CallerInfo(1) return mmListModelsAdmin } @@ -9459,6 +10700,7 @@ func (mmListModelsAdmin *mRepositoryMockListModelsAdmin) ExpectFilterParam5(filt mmListModelsAdmin.defaultExpectation.paramPtrs = &RepositoryMockListModelsAdminParamPtrs{} } mmListModelsAdmin.defaultExpectation.paramPtrs.filter = &filter + mmListModelsAdmin.defaultExpectation.expectationOrigins.originFilter = minimock.CallerInfo(1) return mmListModelsAdmin } @@ -9481,6 +10723,7 @@ func (mmListModelsAdmin *mRepositoryMockListModelsAdmin) ExpectShowDeletedParam6 mmListModelsAdmin.defaultExpectation.paramPtrs = &RepositoryMockListModelsAdminParamPtrs{} } mmListModelsAdmin.defaultExpectation.paramPtrs.showDeleted = &showDeleted + mmListModelsAdmin.defaultExpectation.expectationOrigins.originShowDeleted = minimock.CallerInfo(1) return mmListModelsAdmin } @@ -9506,6 +10749,7 @@ func (mmListModelsAdmin *mRepositoryMockListModelsAdmin) Return(mpa1 []*datamode mmListModelsAdmin.defaultExpectation = &RepositoryMockListModelsAdminExpectation{mock: mmListModelsAdmin.mock} } mmListModelsAdmin.defaultExpectation.results = &RepositoryMockListModelsAdminResults{mpa1, i1, s1, err} + mmListModelsAdmin.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmListModelsAdmin.mock } @@ -9520,6 +10764,7 @@ func (mmListModelsAdmin *mRepositoryMockListModelsAdmin) Set(f func(ctx context. } mmListModelsAdmin.mock.funcListModelsAdmin = f + mmListModelsAdmin.mock.funcListModelsAdminOrigin = minimock.CallerInfo(1) return mmListModelsAdmin.mock } @@ -9531,8 +10776,9 @@ func (mmListModelsAdmin *mRepositoryMockListModelsAdmin) When(ctx context.Contex } expectation := &RepositoryMockListModelsAdminExpectation{ - mock: mmListModelsAdmin.mock, - params: &RepositoryMockListModelsAdminParams{ctx, pageSize, pageToken, isBasicView, filter, showDeleted}, + mock: mmListModelsAdmin.mock, + params: &RepositoryMockListModelsAdminParams{ctx, pageSize, pageToken, isBasicView, filter, showDeleted}, + expectationOrigins: RepositoryMockListModelsAdminExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmListModelsAdmin.expectations = append(mmListModelsAdmin.expectations, expectation) return expectation @@ -9550,6 +10796,7 @@ func (mmListModelsAdmin *mRepositoryMockListModelsAdmin) Times(n uint64) *mRepos mmListModelsAdmin.mock.t.Fatalf("Times of RepositoryMock.ListModelsAdmin mock can not be zero") } mm_atomic.StoreUint64(&mmListModelsAdmin.expectedInvocations, n) + mmListModelsAdmin.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmListModelsAdmin } @@ -9564,11 +10811,13 @@ func (mmListModelsAdmin *mRepositoryMockListModelsAdmin) invocationsDone() bool return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// ListModelsAdmin implements repository.Repository +// ListModelsAdmin implements mm_repository.Repository func (mmListModelsAdmin *RepositoryMock) ListModelsAdmin(ctx context.Context, pageSize int64, pageToken string, isBasicView bool, filter filtering.Filter, showDeleted bool) (mpa1 []*datamodel.Model, i1 int64, s1 string, err error) { mm_atomic.AddUint64(&mmListModelsAdmin.beforeListModelsAdminCounter, 1) defer mm_atomic.AddUint64(&mmListModelsAdmin.afterListModelsAdminCounter, 1) + mmListModelsAdmin.t.Helper() + if mmListModelsAdmin.inspectFuncListModelsAdmin != nil { mmListModelsAdmin.inspectFuncListModelsAdmin(ctx, pageSize, pageToken, isBasicView, filter, showDeleted) } @@ -9597,31 +10846,38 @@ func (mmListModelsAdmin *RepositoryMock) ListModelsAdmin(ctx context.Context, pa if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmListModelsAdmin.t.Errorf("RepositoryMock.ListModelsAdmin got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmListModelsAdmin.t.Errorf("RepositoryMock.ListModelsAdmin got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelsAdmin.ListModelsAdminMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.pageSize != nil && !minimock.Equal(*mm_want_ptrs.pageSize, mm_got.pageSize) { - mmListModelsAdmin.t.Errorf("RepositoryMock.ListModelsAdmin got unexpected parameter pageSize, want: %#v, got: %#v%s\n", *mm_want_ptrs.pageSize, mm_got.pageSize, minimock.Diff(*mm_want_ptrs.pageSize, mm_got.pageSize)) + mmListModelsAdmin.t.Errorf("RepositoryMock.ListModelsAdmin got unexpected parameter pageSize, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelsAdmin.ListModelsAdminMock.defaultExpectation.expectationOrigins.originPageSize, *mm_want_ptrs.pageSize, mm_got.pageSize, minimock.Diff(*mm_want_ptrs.pageSize, mm_got.pageSize)) } if mm_want_ptrs.pageToken != nil && !minimock.Equal(*mm_want_ptrs.pageToken, mm_got.pageToken) { - mmListModelsAdmin.t.Errorf("RepositoryMock.ListModelsAdmin got unexpected parameter pageToken, want: %#v, got: %#v%s\n", *mm_want_ptrs.pageToken, mm_got.pageToken, minimock.Diff(*mm_want_ptrs.pageToken, mm_got.pageToken)) + mmListModelsAdmin.t.Errorf("RepositoryMock.ListModelsAdmin got unexpected parameter pageToken, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelsAdmin.ListModelsAdminMock.defaultExpectation.expectationOrigins.originPageToken, *mm_want_ptrs.pageToken, mm_got.pageToken, minimock.Diff(*mm_want_ptrs.pageToken, mm_got.pageToken)) } if mm_want_ptrs.isBasicView != nil && !minimock.Equal(*mm_want_ptrs.isBasicView, mm_got.isBasicView) { - mmListModelsAdmin.t.Errorf("RepositoryMock.ListModelsAdmin got unexpected parameter isBasicView, want: %#v, got: %#v%s\n", *mm_want_ptrs.isBasicView, mm_got.isBasicView, minimock.Diff(*mm_want_ptrs.isBasicView, mm_got.isBasicView)) + mmListModelsAdmin.t.Errorf("RepositoryMock.ListModelsAdmin got unexpected parameter isBasicView, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelsAdmin.ListModelsAdminMock.defaultExpectation.expectationOrigins.originIsBasicView, *mm_want_ptrs.isBasicView, mm_got.isBasicView, minimock.Diff(*mm_want_ptrs.isBasicView, mm_got.isBasicView)) } if mm_want_ptrs.filter != nil && !minimock.Equal(*mm_want_ptrs.filter, mm_got.filter) { - mmListModelsAdmin.t.Errorf("RepositoryMock.ListModelsAdmin got unexpected parameter filter, want: %#v, got: %#v%s\n", *mm_want_ptrs.filter, mm_got.filter, minimock.Diff(*mm_want_ptrs.filter, mm_got.filter)) + mmListModelsAdmin.t.Errorf("RepositoryMock.ListModelsAdmin got unexpected parameter filter, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelsAdmin.ListModelsAdminMock.defaultExpectation.expectationOrigins.originFilter, *mm_want_ptrs.filter, mm_got.filter, minimock.Diff(*mm_want_ptrs.filter, mm_got.filter)) } if mm_want_ptrs.showDeleted != nil && !minimock.Equal(*mm_want_ptrs.showDeleted, mm_got.showDeleted) { - mmListModelsAdmin.t.Errorf("RepositoryMock.ListModelsAdmin got unexpected parameter showDeleted, want: %#v, got: %#v%s\n", *mm_want_ptrs.showDeleted, mm_got.showDeleted, minimock.Diff(*mm_want_ptrs.showDeleted, mm_got.showDeleted)) + mmListModelsAdmin.t.Errorf("RepositoryMock.ListModelsAdmin got unexpected parameter showDeleted, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelsAdmin.ListModelsAdminMock.defaultExpectation.expectationOrigins.originShowDeleted, *mm_want_ptrs.showDeleted, mm_got.showDeleted, minimock.Diff(*mm_want_ptrs.showDeleted, mm_got.showDeleted)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmListModelsAdmin.t.Errorf("RepositoryMock.ListModelsAdmin got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmListModelsAdmin.t.Errorf("RepositoryMock.ListModelsAdmin got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListModelsAdmin.ListModelsAdminMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmListModelsAdmin.ListModelsAdminMock.defaultExpectation.results @@ -9681,7 +10937,7 @@ func (m *RepositoryMock) MinimockListModelsAdminDone() bool { func (m *RepositoryMock) MinimockListModelsAdminInspect() { for _, e := range m.ListModelsAdminMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.ListModelsAdmin with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.ListModelsAdmin at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -9689,19 +10945,19 @@ func (m *RepositoryMock) MinimockListModelsAdminInspect() { // if default expectation was set then invocations count should be greater than zero if m.ListModelsAdminMock.defaultExpectation != nil && afterListModelsAdminCounter < 1 { if m.ListModelsAdminMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.ListModelsAdmin") + m.t.Errorf("Expected call to RepositoryMock.ListModelsAdmin at\n%s", m.ListModelsAdminMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.ListModelsAdmin with params: %#v", *m.ListModelsAdminMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.ListModelsAdmin at\n%s with params: %#v", m.ListModelsAdminMock.defaultExpectation.expectationOrigins.origin, *m.ListModelsAdminMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcListModelsAdmin != nil && afterListModelsAdminCounter < 1 { - m.t.Error("Expected call to RepositoryMock.ListModelsAdmin") + m.t.Errorf("Expected call to RepositoryMock.ListModelsAdmin at\n%s", m.funcListModelsAdminOrigin) } if !m.ListModelsAdminMock.invocationsDone() && afterListModelsAdminCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.ListModelsAdmin but found %d calls", - mm_atomic.LoadUint64(&m.ListModelsAdminMock.expectedInvocations), afterListModelsAdminCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.ListModelsAdmin at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.ListModelsAdminMock.expectedInvocations), m.ListModelsAdminMock.expectedInvocationsOrigin, afterListModelsAdminCounter) } } @@ -9714,16 +10970,19 @@ type mRepositoryMockListNamespaceModels struct { callArgs []*RepositoryMockListNamespaceModelsParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockListNamespaceModelsExpectation specifies expectation struct of the Repository.ListNamespaceModels type RepositoryMockListNamespaceModelsExpectation struct { - mock *RepositoryMock - params *RepositoryMockListNamespaceModelsParams - paramPtrs *RepositoryMockListNamespaceModelsParamPtrs - results *RepositoryMockListNamespaceModelsResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockListNamespaceModelsParams + paramPtrs *RepositoryMockListNamespaceModelsParamPtrs + expectationOrigins RepositoryMockListNamespaceModelsExpectationOrigins + results *RepositoryMockListNamespaceModelsResults + returnOrigin string + Counter uint64 } // RepositoryMockListNamespaceModelsParams contains parameters of the Repository.ListNamespaceModels @@ -9762,6 +11021,21 @@ type RepositoryMockListNamespaceModelsResults struct { err error } +// RepositoryMockListNamespaceModelsOrigins contains origins of expectations of the Repository.ListNamespaceModels +type RepositoryMockListNamespaceModelsExpectationOrigins struct { + origin string + originCtx string + originOwnerPermalink string + originPageSize string + originPageToken string + originIsBasicView string + originFilter string + originUidAllowList string + originShowDeleted string + originOrder string + originVisibility string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -9787,6 +11061,7 @@ func (mmListNamespaceModels *mRepositoryMockListNamespaceModels) Expect(ctx cont } mmListNamespaceModels.defaultExpectation.params = &RepositoryMockListNamespaceModelsParams{ctx, ownerPermalink, pageSize, pageToken, isBasicView, filter, uidAllowList, showDeleted, order, visibility} + mmListNamespaceModels.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmListNamespaceModels.expectations { if minimock.Equal(e.params, mmListNamespaceModels.defaultExpectation.params) { mmListNamespaceModels.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmListNamespaceModels.defaultExpectation.params) @@ -9814,6 +11089,7 @@ func (mmListNamespaceModels *mRepositoryMockListNamespaceModels) ExpectCtxParam1 mmListNamespaceModels.defaultExpectation.paramPtrs = &RepositoryMockListNamespaceModelsParamPtrs{} } mmListNamespaceModels.defaultExpectation.paramPtrs.ctx = &ctx + mmListNamespaceModels.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmListNamespaceModels } @@ -9836,6 +11112,7 @@ func (mmListNamespaceModels *mRepositoryMockListNamespaceModels) ExpectOwnerPerm mmListNamespaceModels.defaultExpectation.paramPtrs = &RepositoryMockListNamespaceModelsParamPtrs{} } mmListNamespaceModels.defaultExpectation.paramPtrs.ownerPermalink = &ownerPermalink + mmListNamespaceModels.defaultExpectation.expectationOrigins.originOwnerPermalink = minimock.CallerInfo(1) return mmListNamespaceModels } @@ -9858,6 +11135,7 @@ func (mmListNamespaceModels *mRepositoryMockListNamespaceModels) ExpectPageSizeP mmListNamespaceModels.defaultExpectation.paramPtrs = &RepositoryMockListNamespaceModelsParamPtrs{} } mmListNamespaceModels.defaultExpectation.paramPtrs.pageSize = &pageSize + mmListNamespaceModels.defaultExpectation.expectationOrigins.originPageSize = minimock.CallerInfo(1) return mmListNamespaceModels } @@ -9880,6 +11158,7 @@ func (mmListNamespaceModels *mRepositoryMockListNamespaceModels) ExpectPageToken mmListNamespaceModels.defaultExpectation.paramPtrs = &RepositoryMockListNamespaceModelsParamPtrs{} } mmListNamespaceModels.defaultExpectation.paramPtrs.pageToken = &pageToken + mmListNamespaceModels.defaultExpectation.expectationOrigins.originPageToken = minimock.CallerInfo(1) return mmListNamespaceModels } @@ -9902,6 +11181,7 @@ func (mmListNamespaceModels *mRepositoryMockListNamespaceModels) ExpectIsBasicVi mmListNamespaceModels.defaultExpectation.paramPtrs = &RepositoryMockListNamespaceModelsParamPtrs{} } mmListNamespaceModels.defaultExpectation.paramPtrs.isBasicView = &isBasicView + mmListNamespaceModels.defaultExpectation.expectationOrigins.originIsBasicView = minimock.CallerInfo(1) return mmListNamespaceModels } @@ -9924,6 +11204,7 @@ func (mmListNamespaceModels *mRepositoryMockListNamespaceModels) ExpectFilterPar mmListNamespaceModels.defaultExpectation.paramPtrs = &RepositoryMockListNamespaceModelsParamPtrs{} } mmListNamespaceModels.defaultExpectation.paramPtrs.filter = &filter + mmListNamespaceModels.defaultExpectation.expectationOrigins.originFilter = minimock.CallerInfo(1) return mmListNamespaceModels } @@ -9946,6 +11227,7 @@ func (mmListNamespaceModels *mRepositoryMockListNamespaceModels) ExpectUidAllowL mmListNamespaceModels.defaultExpectation.paramPtrs = &RepositoryMockListNamespaceModelsParamPtrs{} } mmListNamespaceModels.defaultExpectation.paramPtrs.uidAllowList = &uidAllowList + mmListNamespaceModels.defaultExpectation.expectationOrigins.originUidAllowList = minimock.CallerInfo(1) return mmListNamespaceModels } @@ -9968,6 +11250,7 @@ func (mmListNamespaceModels *mRepositoryMockListNamespaceModels) ExpectShowDelet mmListNamespaceModels.defaultExpectation.paramPtrs = &RepositoryMockListNamespaceModelsParamPtrs{} } mmListNamespaceModels.defaultExpectation.paramPtrs.showDeleted = &showDeleted + mmListNamespaceModels.defaultExpectation.expectationOrigins.originShowDeleted = minimock.CallerInfo(1) return mmListNamespaceModels } @@ -9990,6 +11273,7 @@ func (mmListNamespaceModels *mRepositoryMockListNamespaceModels) ExpectOrderPara mmListNamespaceModels.defaultExpectation.paramPtrs = &RepositoryMockListNamespaceModelsParamPtrs{} } mmListNamespaceModels.defaultExpectation.paramPtrs.order = &order + mmListNamespaceModels.defaultExpectation.expectationOrigins.originOrder = minimock.CallerInfo(1) return mmListNamespaceModels } @@ -10012,6 +11296,7 @@ func (mmListNamespaceModels *mRepositoryMockListNamespaceModels) ExpectVisibilit mmListNamespaceModels.defaultExpectation.paramPtrs = &RepositoryMockListNamespaceModelsParamPtrs{} } mmListNamespaceModels.defaultExpectation.paramPtrs.visibility = &visibility + mmListNamespaceModels.defaultExpectation.expectationOrigins.originVisibility = minimock.CallerInfo(1) return mmListNamespaceModels } @@ -10037,6 +11322,7 @@ func (mmListNamespaceModels *mRepositoryMockListNamespaceModels) Return(models [ mmListNamespaceModels.defaultExpectation = &RepositoryMockListNamespaceModelsExpectation{mock: mmListNamespaceModels.mock} } mmListNamespaceModels.defaultExpectation.results = &RepositoryMockListNamespaceModelsResults{models, totalSize, nextPageToken, err} + mmListNamespaceModels.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmListNamespaceModels.mock } @@ -10051,6 +11337,7 @@ func (mmListNamespaceModels *mRepositoryMockListNamespaceModels) Set(f func(ctx } mmListNamespaceModels.mock.funcListNamespaceModels = f + mmListNamespaceModels.mock.funcListNamespaceModelsOrigin = minimock.CallerInfo(1) return mmListNamespaceModels.mock } @@ -10062,8 +11349,9 @@ func (mmListNamespaceModels *mRepositoryMockListNamespaceModels) When(ctx contex } expectation := &RepositoryMockListNamespaceModelsExpectation{ - mock: mmListNamespaceModels.mock, - params: &RepositoryMockListNamespaceModelsParams{ctx, ownerPermalink, pageSize, pageToken, isBasicView, filter, uidAllowList, showDeleted, order, visibility}, + mock: mmListNamespaceModels.mock, + params: &RepositoryMockListNamespaceModelsParams{ctx, ownerPermalink, pageSize, pageToken, isBasicView, filter, uidAllowList, showDeleted, order, visibility}, + expectationOrigins: RepositoryMockListNamespaceModelsExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmListNamespaceModels.expectations = append(mmListNamespaceModels.expectations, expectation) return expectation @@ -10081,6 +11369,7 @@ func (mmListNamespaceModels *mRepositoryMockListNamespaceModels) Times(n uint64) mmListNamespaceModels.mock.t.Fatalf("Times of RepositoryMock.ListNamespaceModels mock can not be zero") } mm_atomic.StoreUint64(&mmListNamespaceModels.expectedInvocations, n) + mmListNamespaceModels.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmListNamespaceModels } @@ -10095,11 +11384,13 @@ func (mmListNamespaceModels *mRepositoryMockListNamespaceModels) invocationsDone return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// ListNamespaceModels implements repository.Repository +// ListNamespaceModels implements mm_repository.Repository func (mmListNamespaceModels *RepositoryMock) ListNamespaceModels(ctx context.Context, ownerPermalink string, pageSize int64, pageToken string, isBasicView bool, filter filtering.Filter, uidAllowList []uuid.UUID, showDeleted bool, order ordering.OrderBy, visibility *modelpb.Model_Visibility) (models []*datamodel.Model, totalSize int64, nextPageToken string, err error) { mm_atomic.AddUint64(&mmListNamespaceModels.beforeListNamespaceModelsCounter, 1) defer mm_atomic.AddUint64(&mmListNamespaceModels.afterListNamespaceModelsCounter, 1) + mmListNamespaceModels.t.Helper() + if mmListNamespaceModels.inspectFuncListNamespaceModels != nil { mmListNamespaceModels.inspectFuncListNamespaceModels(ctx, ownerPermalink, pageSize, pageToken, isBasicView, filter, uidAllowList, showDeleted, order, visibility) } @@ -10128,47 +11419,58 @@ func (mmListNamespaceModels *RepositoryMock) ListNamespaceModels(ctx context.Con if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmListNamespaceModels.t.Errorf("RepositoryMock.ListNamespaceModels got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmListNamespaceModels.t.Errorf("RepositoryMock.ListNamespaceModels got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListNamespaceModels.ListNamespaceModelsMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.ownerPermalink != nil && !minimock.Equal(*mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink) { - mmListNamespaceModels.t.Errorf("RepositoryMock.ListNamespaceModels got unexpected parameter ownerPermalink, want: %#v, got: %#v%s\n", *mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink, minimock.Diff(*mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink)) + mmListNamespaceModels.t.Errorf("RepositoryMock.ListNamespaceModels got unexpected parameter ownerPermalink, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListNamespaceModels.ListNamespaceModelsMock.defaultExpectation.expectationOrigins.originOwnerPermalink, *mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink, minimock.Diff(*mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink)) } if mm_want_ptrs.pageSize != nil && !minimock.Equal(*mm_want_ptrs.pageSize, mm_got.pageSize) { - mmListNamespaceModels.t.Errorf("RepositoryMock.ListNamespaceModels got unexpected parameter pageSize, want: %#v, got: %#v%s\n", *mm_want_ptrs.pageSize, mm_got.pageSize, minimock.Diff(*mm_want_ptrs.pageSize, mm_got.pageSize)) + mmListNamespaceModels.t.Errorf("RepositoryMock.ListNamespaceModels got unexpected parameter pageSize, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListNamespaceModels.ListNamespaceModelsMock.defaultExpectation.expectationOrigins.originPageSize, *mm_want_ptrs.pageSize, mm_got.pageSize, minimock.Diff(*mm_want_ptrs.pageSize, mm_got.pageSize)) } if mm_want_ptrs.pageToken != nil && !minimock.Equal(*mm_want_ptrs.pageToken, mm_got.pageToken) { - mmListNamespaceModels.t.Errorf("RepositoryMock.ListNamespaceModels got unexpected parameter pageToken, want: %#v, got: %#v%s\n", *mm_want_ptrs.pageToken, mm_got.pageToken, minimock.Diff(*mm_want_ptrs.pageToken, mm_got.pageToken)) + mmListNamespaceModels.t.Errorf("RepositoryMock.ListNamespaceModels got unexpected parameter pageToken, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListNamespaceModels.ListNamespaceModelsMock.defaultExpectation.expectationOrigins.originPageToken, *mm_want_ptrs.pageToken, mm_got.pageToken, minimock.Diff(*mm_want_ptrs.pageToken, mm_got.pageToken)) } if mm_want_ptrs.isBasicView != nil && !minimock.Equal(*mm_want_ptrs.isBasicView, mm_got.isBasicView) { - mmListNamespaceModels.t.Errorf("RepositoryMock.ListNamespaceModels got unexpected parameter isBasicView, want: %#v, got: %#v%s\n", *mm_want_ptrs.isBasicView, mm_got.isBasicView, minimock.Diff(*mm_want_ptrs.isBasicView, mm_got.isBasicView)) + mmListNamespaceModels.t.Errorf("RepositoryMock.ListNamespaceModels got unexpected parameter isBasicView, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListNamespaceModels.ListNamespaceModelsMock.defaultExpectation.expectationOrigins.originIsBasicView, *mm_want_ptrs.isBasicView, mm_got.isBasicView, minimock.Diff(*mm_want_ptrs.isBasicView, mm_got.isBasicView)) } if mm_want_ptrs.filter != nil && !minimock.Equal(*mm_want_ptrs.filter, mm_got.filter) { - mmListNamespaceModels.t.Errorf("RepositoryMock.ListNamespaceModels got unexpected parameter filter, want: %#v, got: %#v%s\n", *mm_want_ptrs.filter, mm_got.filter, minimock.Diff(*mm_want_ptrs.filter, mm_got.filter)) + mmListNamespaceModels.t.Errorf("RepositoryMock.ListNamespaceModels got unexpected parameter filter, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListNamespaceModels.ListNamespaceModelsMock.defaultExpectation.expectationOrigins.originFilter, *mm_want_ptrs.filter, mm_got.filter, minimock.Diff(*mm_want_ptrs.filter, mm_got.filter)) } if mm_want_ptrs.uidAllowList != nil && !minimock.Equal(*mm_want_ptrs.uidAllowList, mm_got.uidAllowList) { - mmListNamespaceModels.t.Errorf("RepositoryMock.ListNamespaceModels got unexpected parameter uidAllowList, want: %#v, got: %#v%s\n", *mm_want_ptrs.uidAllowList, mm_got.uidAllowList, minimock.Diff(*mm_want_ptrs.uidAllowList, mm_got.uidAllowList)) + mmListNamespaceModels.t.Errorf("RepositoryMock.ListNamespaceModels got unexpected parameter uidAllowList, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListNamespaceModels.ListNamespaceModelsMock.defaultExpectation.expectationOrigins.originUidAllowList, *mm_want_ptrs.uidAllowList, mm_got.uidAllowList, minimock.Diff(*mm_want_ptrs.uidAllowList, mm_got.uidAllowList)) } if mm_want_ptrs.showDeleted != nil && !minimock.Equal(*mm_want_ptrs.showDeleted, mm_got.showDeleted) { - mmListNamespaceModels.t.Errorf("RepositoryMock.ListNamespaceModels got unexpected parameter showDeleted, want: %#v, got: %#v%s\n", *mm_want_ptrs.showDeleted, mm_got.showDeleted, minimock.Diff(*mm_want_ptrs.showDeleted, mm_got.showDeleted)) + mmListNamespaceModels.t.Errorf("RepositoryMock.ListNamespaceModels got unexpected parameter showDeleted, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListNamespaceModels.ListNamespaceModelsMock.defaultExpectation.expectationOrigins.originShowDeleted, *mm_want_ptrs.showDeleted, mm_got.showDeleted, minimock.Diff(*mm_want_ptrs.showDeleted, mm_got.showDeleted)) } if mm_want_ptrs.order != nil && !minimock.Equal(*mm_want_ptrs.order, mm_got.order) { - mmListNamespaceModels.t.Errorf("RepositoryMock.ListNamespaceModels got unexpected parameter order, want: %#v, got: %#v%s\n", *mm_want_ptrs.order, mm_got.order, minimock.Diff(*mm_want_ptrs.order, mm_got.order)) + mmListNamespaceModels.t.Errorf("RepositoryMock.ListNamespaceModels got unexpected parameter order, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListNamespaceModels.ListNamespaceModelsMock.defaultExpectation.expectationOrigins.originOrder, *mm_want_ptrs.order, mm_got.order, minimock.Diff(*mm_want_ptrs.order, mm_got.order)) } if mm_want_ptrs.visibility != nil && !minimock.Equal(*mm_want_ptrs.visibility, mm_got.visibility) { - mmListNamespaceModels.t.Errorf("RepositoryMock.ListNamespaceModels got unexpected parameter visibility, want: %#v, got: %#v%s\n", *mm_want_ptrs.visibility, mm_got.visibility, minimock.Diff(*mm_want_ptrs.visibility, mm_got.visibility)) + mmListNamespaceModels.t.Errorf("RepositoryMock.ListNamespaceModels got unexpected parameter visibility, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListNamespaceModels.ListNamespaceModelsMock.defaultExpectation.expectationOrigins.originVisibility, *mm_want_ptrs.visibility, mm_got.visibility, minimock.Diff(*mm_want_ptrs.visibility, mm_got.visibility)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmListNamespaceModels.t.Errorf("RepositoryMock.ListNamespaceModels got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmListNamespaceModels.t.Errorf("RepositoryMock.ListNamespaceModels got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmListNamespaceModels.ListNamespaceModelsMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmListNamespaceModels.ListNamespaceModelsMock.defaultExpectation.results @@ -10228,7 +11530,7 @@ func (m *RepositoryMock) MinimockListNamespaceModelsDone() bool { func (m *RepositoryMock) MinimockListNamespaceModelsInspect() { for _, e := range m.ListNamespaceModelsMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.ListNamespaceModels with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.ListNamespaceModels at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -10236,19 +11538,19 @@ func (m *RepositoryMock) MinimockListNamespaceModelsInspect() { // if default expectation was set then invocations count should be greater than zero if m.ListNamespaceModelsMock.defaultExpectation != nil && afterListNamespaceModelsCounter < 1 { if m.ListNamespaceModelsMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.ListNamespaceModels") + m.t.Errorf("Expected call to RepositoryMock.ListNamespaceModels at\n%s", m.ListNamespaceModelsMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.ListNamespaceModels with params: %#v", *m.ListNamespaceModelsMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.ListNamespaceModels at\n%s with params: %#v", m.ListNamespaceModelsMock.defaultExpectation.expectationOrigins.origin, *m.ListNamespaceModelsMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcListNamespaceModels != nil && afterListNamespaceModelsCounter < 1 { - m.t.Error("Expected call to RepositoryMock.ListNamespaceModels") + m.t.Errorf("Expected call to RepositoryMock.ListNamespaceModels at\n%s", m.funcListNamespaceModelsOrigin) } if !m.ListNamespaceModelsMock.invocationsDone() && afterListNamespaceModelsCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.ListNamespaceModels but found %d calls", - mm_atomic.LoadUint64(&m.ListNamespaceModelsMock.expectedInvocations), afterListNamespaceModelsCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.ListNamespaceModels at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.ListNamespaceModelsMock.expectedInvocations), m.ListNamespaceModelsMock.expectedInvocationsOrigin, afterListNamespaceModelsCounter) } } @@ -10261,16 +11563,19 @@ type mRepositoryMockPinUser struct { callArgs []*RepositoryMockPinUserParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockPinUserExpectation specifies expectation struct of the Repository.PinUser type RepositoryMockPinUserExpectation struct { - mock *RepositoryMock - params *RepositoryMockPinUserParams - paramPtrs *RepositoryMockPinUserParamPtrs + mock *RepositoryMock + params *RepositoryMockPinUserParams + paramPtrs *RepositoryMockPinUserParamPtrs + expectationOrigins RepositoryMockPinUserExpectationOrigins - Counter uint64 + returnOrigin string + Counter uint64 } // RepositoryMockPinUserParams contains parameters of the Repository.PinUser @@ -10285,6 +11590,13 @@ type RepositoryMockPinUserParamPtrs struct { table *string } +// RepositoryMockPinUserOrigins contains origins of expectations of the Repository.PinUser +type RepositoryMockPinUserExpectationOrigins struct { + origin string + originCtx string + originTable string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -10310,6 +11622,7 @@ func (mmPinUser *mRepositoryMockPinUser) Expect(ctx context.Context, table strin } mmPinUser.defaultExpectation.params = &RepositoryMockPinUserParams{ctx, table} + mmPinUser.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmPinUser.expectations { if minimock.Equal(e.params, mmPinUser.defaultExpectation.params) { mmPinUser.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmPinUser.defaultExpectation.params) @@ -10337,6 +11650,7 @@ func (mmPinUser *mRepositoryMockPinUser) ExpectCtxParam1(ctx context.Context) *m mmPinUser.defaultExpectation.paramPtrs = &RepositoryMockPinUserParamPtrs{} } mmPinUser.defaultExpectation.paramPtrs.ctx = &ctx + mmPinUser.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmPinUser } @@ -10359,6 +11673,7 @@ func (mmPinUser *mRepositoryMockPinUser) ExpectTableParam2(table string) *mRepos mmPinUser.defaultExpectation.paramPtrs = &RepositoryMockPinUserParamPtrs{} } mmPinUser.defaultExpectation.paramPtrs.table = &table + mmPinUser.defaultExpectation.expectationOrigins.originTable = minimock.CallerInfo(1) return mmPinUser } @@ -10384,6 +11699,7 @@ func (mmPinUser *mRepositoryMockPinUser) Return() *RepositoryMock { mmPinUser.defaultExpectation = &RepositoryMockPinUserExpectation{mock: mmPinUser.mock} } + mmPinUser.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmPinUser.mock } @@ -10398,6 +11714,7 @@ func (mmPinUser *mRepositoryMockPinUser) Set(f func(ctx context.Context, table s } mmPinUser.mock.funcPinUser = f + mmPinUser.mock.funcPinUserOrigin = minimock.CallerInfo(1) return mmPinUser.mock } @@ -10407,6 +11724,7 @@ func (mmPinUser *mRepositoryMockPinUser) Times(n uint64) *mRepositoryMockPinUser mmPinUser.mock.t.Fatalf("Times of RepositoryMock.PinUser mock can not be zero") } mm_atomic.StoreUint64(&mmPinUser.expectedInvocations, n) + mmPinUser.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmPinUser } @@ -10421,11 +11739,13 @@ func (mmPinUser *mRepositoryMockPinUser) invocationsDone() bool { return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// PinUser implements repository.Repository +// PinUser implements mm_repository.Repository func (mmPinUser *RepositoryMock) PinUser(ctx context.Context, table string) { mm_atomic.AddUint64(&mmPinUser.beforePinUserCounter, 1) defer mm_atomic.AddUint64(&mmPinUser.afterPinUserCounter, 1) + mmPinUser.t.Helper() + if mmPinUser.inspectFuncPinUser != nil { mmPinUser.inspectFuncPinUser(ctx, table) } @@ -10454,15 +11774,18 @@ func (mmPinUser *RepositoryMock) PinUser(ctx context.Context, table string) { if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmPinUser.t.Errorf("RepositoryMock.PinUser got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmPinUser.t.Errorf("RepositoryMock.PinUser got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmPinUser.PinUserMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.table != nil && !minimock.Equal(*mm_want_ptrs.table, mm_got.table) { - mmPinUser.t.Errorf("RepositoryMock.PinUser got unexpected parameter table, want: %#v, got: %#v%s\n", *mm_want_ptrs.table, mm_got.table, minimock.Diff(*mm_want_ptrs.table, mm_got.table)) + mmPinUser.t.Errorf("RepositoryMock.PinUser got unexpected parameter table, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmPinUser.PinUserMock.defaultExpectation.expectationOrigins.originTable, *mm_want_ptrs.table, mm_got.table, minimock.Diff(*mm_want_ptrs.table, mm_got.table)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmPinUser.t.Errorf("RepositoryMock.PinUser got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmPinUser.t.Errorf("RepositoryMock.PinUser got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmPinUser.PinUserMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } return @@ -10520,7 +11843,7 @@ func (m *RepositoryMock) MinimockPinUserDone() bool { func (m *RepositoryMock) MinimockPinUserInspect() { for _, e := range m.PinUserMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.PinUser with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.PinUser at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -10528,19 +11851,19 @@ func (m *RepositoryMock) MinimockPinUserInspect() { // if default expectation was set then invocations count should be greater than zero if m.PinUserMock.defaultExpectation != nil && afterPinUserCounter < 1 { if m.PinUserMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.PinUser") + m.t.Errorf("Expected call to RepositoryMock.PinUser at\n%s", m.PinUserMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.PinUser with params: %#v", *m.PinUserMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.PinUser at\n%s with params: %#v", m.PinUserMock.defaultExpectation.expectationOrigins.origin, *m.PinUserMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcPinUser != nil && afterPinUserCounter < 1 { - m.t.Error("Expected call to RepositoryMock.PinUser") + m.t.Errorf("Expected call to RepositoryMock.PinUser at\n%s", m.funcPinUserOrigin) } if !m.PinUserMock.invocationsDone() && afterPinUserCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.PinUser but found %d calls", - mm_atomic.LoadUint64(&m.PinUserMock.expectedInvocations), afterPinUserCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.PinUser at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.PinUserMock.expectedInvocations), m.PinUserMock.expectedInvocationsOrigin, afterPinUserCounter) } } @@ -10553,16 +11876,19 @@ type mRepositoryMockUpdateModelRun struct { callArgs []*RepositoryMockUpdateModelRunParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockUpdateModelRunExpectation specifies expectation struct of the Repository.UpdateModelRun type RepositoryMockUpdateModelRunExpectation struct { - mock *RepositoryMock - params *RepositoryMockUpdateModelRunParams - paramPtrs *RepositoryMockUpdateModelRunParamPtrs - results *RepositoryMockUpdateModelRunResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockUpdateModelRunParams + paramPtrs *RepositoryMockUpdateModelRunParamPtrs + expectationOrigins RepositoryMockUpdateModelRunExpectationOrigins + results *RepositoryMockUpdateModelRunResults + returnOrigin string + Counter uint64 } // RepositoryMockUpdateModelRunParams contains parameters of the Repository.UpdateModelRun @@ -10582,6 +11908,13 @@ type RepositoryMockUpdateModelRunResults struct { err error } +// RepositoryMockUpdateModelRunOrigins contains origins of expectations of the Repository.UpdateModelRun +type RepositoryMockUpdateModelRunExpectationOrigins struct { + origin string + originCtx string + originModelRun string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -10607,6 +11940,7 @@ func (mmUpdateModelRun *mRepositoryMockUpdateModelRun) Expect(ctx context.Contex } mmUpdateModelRun.defaultExpectation.params = &RepositoryMockUpdateModelRunParams{ctx, modelRun} + mmUpdateModelRun.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmUpdateModelRun.expectations { if minimock.Equal(e.params, mmUpdateModelRun.defaultExpectation.params) { mmUpdateModelRun.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmUpdateModelRun.defaultExpectation.params) @@ -10634,6 +11968,7 @@ func (mmUpdateModelRun *mRepositoryMockUpdateModelRun) ExpectCtxParam1(ctx conte mmUpdateModelRun.defaultExpectation.paramPtrs = &RepositoryMockUpdateModelRunParamPtrs{} } mmUpdateModelRun.defaultExpectation.paramPtrs.ctx = &ctx + mmUpdateModelRun.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmUpdateModelRun } @@ -10656,6 +11991,7 @@ func (mmUpdateModelRun *mRepositoryMockUpdateModelRun) ExpectModelRunParam2(mode mmUpdateModelRun.defaultExpectation.paramPtrs = &RepositoryMockUpdateModelRunParamPtrs{} } mmUpdateModelRun.defaultExpectation.paramPtrs.modelRun = &modelRun + mmUpdateModelRun.defaultExpectation.expectationOrigins.originModelRun = minimock.CallerInfo(1) return mmUpdateModelRun } @@ -10681,6 +12017,7 @@ func (mmUpdateModelRun *mRepositoryMockUpdateModelRun) Return(err error) *Reposi mmUpdateModelRun.defaultExpectation = &RepositoryMockUpdateModelRunExpectation{mock: mmUpdateModelRun.mock} } mmUpdateModelRun.defaultExpectation.results = &RepositoryMockUpdateModelRunResults{err} + mmUpdateModelRun.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmUpdateModelRun.mock } @@ -10695,6 +12032,7 @@ func (mmUpdateModelRun *mRepositoryMockUpdateModelRun) Set(f func(ctx context.Co } mmUpdateModelRun.mock.funcUpdateModelRun = f + mmUpdateModelRun.mock.funcUpdateModelRunOrigin = minimock.CallerInfo(1) return mmUpdateModelRun.mock } @@ -10706,8 +12044,9 @@ func (mmUpdateModelRun *mRepositoryMockUpdateModelRun) When(ctx context.Context, } expectation := &RepositoryMockUpdateModelRunExpectation{ - mock: mmUpdateModelRun.mock, - params: &RepositoryMockUpdateModelRunParams{ctx, modelRun}, + mock: mmUpdateModelRun.mock, + params: &RepositoryMockUpdateModelRunParams{ctx, modelRun}, + expectationOrigins: RepositoryMockUpdateModelRunExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmUpdateModelRun.expectations = append(mmUpdateModelRun.expectations, expectation) return expectation @@ -10725,6 +12064,7 @@ func (mmUpdateModelRun *mRepositoryMockUpdateModelRun) Times(n uint64) *mReposit mmUpdateModelRun.mock.t.Fatalf("Times of RepositoryMock.UpdateModelRun mock can not be zero") } mm_atomic.StoreUint64(&mmUpdateModelRun.expectedInvocations, n) + mmUpdateModelRun.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmUpdateModelRun } @@ -10739,11 +12079,13 @@ func (mmUpdateModelRun *mRepositoryMockUpdateModelRun) invocationsDone() bool { return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// UpdateModelRun implements repository.Repository +// UpdateModelRun implements mm_repository.Repository func (mmUpdateModelRun *RepositoryMock) UpdateModelRun(ctx context.Context, modelRun *datamodel.ModelRun) (err error) { mm_atomic.AddUint64(&mmUpdateModelRun.beforeUpdateModelRunCounter, 1) defer mm_atomic.AddUint64(&mmUpdateModelRun.afterUpdateModelRunCounter, 1) + mmUpdateModelRun.t.Helper() + if mmUpdateModelRun.inspectFuncUpdateModelRun != nil { mmUpdateModelRun.inspectFuncUpdateModelRun(ctx, modelRun) } @@ -10772,15 +12114,18 @@ func (mmUpdateModelRun *RepositoryMock) UpdateModelRun(ctx context.Context, mode if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmUpdateModelRun.t.Errorf("RepositoryMock.UpdateModelRun got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmUpdateModelRun.t.Errorf("RepositoryMock.UpdateModelRun got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmUpdateModelRun.UpdateModelRunMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.modelRun != nil && !minimock.Equal(*mm_want_ptrs.modelRun, mm_got.modelRun) { - mmUpdateModelRun.t.Errorf("RepositoryMock.UpdateModelRun got unexpected parameter modelRun, want: %#v, got: %#v%s\n", *mm_want_ptrs.modelRun, mm_got.modelRun, minimock.Diff(*mm_want_ptrs.modelRun, mm_got.modelRun)) + mmUpdateModelRun.t.Errorf("RepositoryMock.UpdateModelRun got unexpected parameter modelRun, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmUpdateModelRun.UpdateModelRunMock.defaultExpectation.expectationOrigins.originModelRun, *mm_want_ptrs.modelRun, mm_got.modelRun, minimock.Diff(*mm_want_ptrs.modelRun, mm_got.modelRun)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmUpdateModelRun.t.Errorf("RepositoryMock.UpdateModelRun got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmUpdateModelRun.t.Errorf("RepositoryMock.UpdateModelRun got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmUpdateModelRun.UpdateModelRunMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmUpdateModelRun.UpdateModelRunMock.defaultExpectation.results @@ -10840,7 +12185,7 @@ func (m *RepositoryMock) MinimockUpdateModelRunDone() bool { func (m *RepositoryMock) MinimockUpdateModelRunInspect() { for _, e := range m.UpdateModelRunMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.UpdateModelRun with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.UpdateModelRun at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -10848,19 +12193,19 @@ func (m *RepositoryMock) MinimockUpdateModelRunInspect() { // if default expectation was set then invocations count should be greater than zero if m.UpdateModelRunMock.defaultExpectation != nil && afterUpdateModelRunCounter < 1 { if m.UpdateModelRunMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.UpdateModelRun") + m.t.Errorf("Expected call to RepositoryMock.UpdateModelRun at\n%s", m.UpdateModelRunMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.UpdateModelRun with params: %#v", *m.UpdateModelRunMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.UpdateModelRun at\n%s with params: %#v", m.UpdateModelRunMock.defaultExpectation.expectationOrigins.origin, *m.UpdateModelRunMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcUpdateModelRun != nil && afterUpdateModelRunCounter < 1 { - m.t.Error("Expected call to RepositoryMock.UpdateModelRun") + m.t.Errorf("Expected call to RepositoryMock.UpdateModelRun at\n%s", m.funcUpdateModelRunOrigin) } if !m.UpdateModelRunMock.invocationsDone() && afterUpdateModelRunCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.UpdateModelRun but found %d calls", - mm_atomic.LoadUint64(&m.UpdateModelRunMock.expectedInvocations), afterUpdateModelRunCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.UpdateModelRun at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.UpdateModelRunMock.expectedInvocations), m.UpdateModelRunMock.expectedInvocationsOrigin, afterUpdateModelRunCounter) } } @@ -10873,16 +12218,19 @@ type mRepositoryMockUpdateModelVersionDigestByID struct { callArgs []*RepositoryMockUpdateModelVersionDigestByIDParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockUpdateModelVersionDigestByIDExpectation specifies expectation struct of the Repository.UpdateModelVersionDigestByID type RepositoryMockUpdateModelVersionDigestByIDExpectation struct { - mock *RepositoryMock - params *RepositoryMockUpdateModelVersionDigestByIDParams - paramPtrs *RepositoryMockUpdateModelVersionDigestByIDParamPtrs - results *RepositoryMockUpdateModelVersionDigestByIDResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockUpdateModelVersionDigestByIDParams + paramPtrs *RepositoryMockUpdateModelVersionDigestByIDParamPtrs + expectationOrigins RepositoryMockUpdateModelVersionDigestByIDExpectationOrigins + results *RepositoryMockUpdateModelVersionDigestByIDResults + returnOrigin string + Counter uint64 } // RepositoryMockUpdateModelVersionDigestByIDParams contains parameters of the Repository.UpdateModelVersionDigestByID @@ -10906,6 +12254,15 @@ type RepositoryMockUpdateModelVersionDigestByIDResults struct { err error } +// RepositoryMockUpdateModelVersionDigestByIDOrigins contains origins of expectations of the Repository.UpdateModelVersionDigestByID +type RepositoryMockUpdateModelVersionDigestByIDExpectationOrigins struct { + origin string + originCtx string + originModelUID string + originVersionID string + originDigest string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -10931,6 +12288,7 @@ func (mmUpdateModelVersionDigestByID *mRepositoryMockUpdateModelVersionDigestByI } mmUpdateModelVersionDigestByID.defaultExpectation.params = &RepositoryMockUpdateModelVersionDigestByIDParams{ctx, modelUID, versionID, digest} + mmUpdateModelVersionDigestByID.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmUpdateModelVersionDigestByID.expectations { if minimock.Equal(e.params, mmUpdateModelVersionDigestByID.defaultExpectation.params) { mmUpdateModelVersionDigestByID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmUpdateModelVersionDigestByID.defaultExpectation.params) @@ -10958,6 +12316,7 @@ func (mmUpdateModelVersionDigestByID *mRepositoryMockUpdateModelVersionDigestByI mmUpdateModelVersionDigestByID.defaultExpectation.paramPtrs = &RepositoryMockUpdateModelVersionDigestByIDParamPtrs{} } mmUpdateModelVersionDigestByID.defaultExpectation.paramPtrs.ctx = &ctx + mmUpdateModelVersionDigestByID.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmUpdateModelVersionDigestByID } @@ -10980,6 +12339,7 @@ func (mmUpdateModelVersionDigestByID *mRepositoryMockUpdateModelVersionDigestByI mmUpdateModelVersionDigestByID.defaultExpectation.paramPtrs = &RepositoryMockUpdateModelVersionDigestByIDParamPtrs{} } mmUpdateModelVersionDigestByID.defaultExpectation.paramPtrs.modelUID = &modelUID + mmUpdateModelVersionDigestByID.defaultExpectation.expectationOrigins.originModelUID = minimock.CallerInfo(1) return mmUpdateModelVersionDigestByID } @@ -11002,6 +12362,7 @@ func (mmUpdateModelVersionDigestByID *mRepositoryMockUpdateModelVersionDigestByI mmUpdateModelVersionDigestByID.defaultExpectation.paramPtrs = &RepositoryMockUpdateModelVersionDigestByIDParamPtrs{} } mmUpdateModelVersionDigestByID.defaultExpectation.paramPtrs.versionID = &versionID + mmUpdateModelVersionDigestByID.defaultExpectation.expectationOrigins.originVersionID = minimock.CallerInfo(1) return mmUpdateModelVersionDigestByID } @@ -11024,6 +12385,7 @@ func (mmUpdateModelVersionDigestByID *mRepositoryMockUpdateModelVersionDigestByI mmUpdateModelVersionDigestByID.defaultExpectation.paramPtrs = &RepositoryMockUpdateModelVersionDigestByIDParamPtrs{} } mmUpdateModelVersionDigestByID.defaultExpectation.paramPtrs.digest = &digest + mmUpdateModelVersionDigestByID.defaultExpectation.expectationOrigins.originDigest = minimock.CallerInfo(1) return mmUpdateModelVersionDigestByID } @@ -11049,6 +12411,7 @@ func (mmUpdateModelVersionDigestByID *mRepositoryMockUpdateModelVersionDigestByI mmUpdateModelVersionDigestByID.defaultExpectation = &RepositoryMockUpdateModelVersionDigestByIDExpectation{mock: mmUpdateModelVersionDigestByID.mock} } mmUpdateModelVersionDigestByID.defaultExpectation.results = &RepositoryMockUpdateModelVersionDigestByIDResults{err} + mmUpdateModelVersionDigestByID.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmUpdateModelVersionDigestByID.mock } @@ -11063,6 +12426,7 @@ func (mmUpdateModelVersionDigestByID *mRepositoryMockUpdateModelVersionDigestByI } mmUpdateModelVersionDigestByID.mock.funcUpdateModelVersionDigestByID = f + mmUpdateModelVersionDigestByID.mock.funcUpdateModelVersionDigestByIDOrigin = minimock.CallerInfo(1) return mmUpdateModelVersionDigestByID.mock } @@ -11074,8 +12438,9 @@ func (mmUpdateModelVersionDigestByID *mRepositoryMockUpdateModelVersionDigestByI } expectation := &RepositoryMockUpdateModelVersionDigestByIDExpectation{ - mock: mmUpdateModelVersionDigestByID.mock, - params: &RepositoryMockUpdateModelVersionDigestByIDParams{ctx, modelUID, versionID, digest}, + mock: mmUpdateModelVersionDigestByID.mock, + params: &RepositoryMockUpdateModelVersionDigestByIDParams{ctx, modelUID, versionID, digest}, + expectationOrigins: RepositoryMockUpdateModelVersionDigestByIDExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmUpdateModelVersionDigestByID.expectations = append(mmUpdateModelVersionDigestByID.expectations, expectation) return expectation @@ -11093,6 +12458,7 @@ func (mmUpdateModelVersionDigestByID *mRepositoryMockUpdateModelVersionDigestByI mmUpdateModelVersionDigestByID.mock.t.Fatalf("Times of RepositoryMock.UpdateModelVersionDigestByID mock can not be zero") } mm_atomic.StoreUint64(&mmUpdateModelVersionDigestByID.expectedInvocations, n) + mmUpdateModelVersionDigestByID.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmUpdateModelVersionDigestByID } @@ -11107,11 +12473,13 @@ func (mmUpdateModelVersionDigestByID *mRepositoryMockUpdateModelVersionDigestByI return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// UpdateModelVersionDigestByID implements repository.Repository +// UpdateModelVersionDigestByID implements mm_repository.Repository func (mmUpdateModelVersionDigestByID *RepositoryMock) UpdateModelVersionDigestByID(ctx context.Context, modelUID uuid.UUID, versionID string, digest string) (err error) { mm_atomic.AddUint64(&mmUpdateModelVersionDigestByID.beforeUpdateModelVersionDigestByIDCounter, 1) defer mm_atomic.AddUint64(&mmUpdateModelVersionDigestByID.afterUpdateModelVersionDigestByIDCounter, 1) + mmUpdateModelVersionDigestByID.t.Helper() + if mmUpdateModelVersionDigestByID.inspectFuncUpdateModelVersionDigestByID != nil { mmUpdateModelVersionDigestByID.inspectFuncUpdateModelVersionDigestByID(ctx, modelUID, versionID, digest) } @@ -11140,23 +12508,28 @@ func (mmUpdateModelVersionDigestByID *RepositoryMock) UpdateModelVersionDigestBy if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmUpdateModelVersionDigestByID.t.Errorf("RepositoryMock.UpdateModelVersionDigestByID got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmUpdateModelVersionDigestByID.t.Errorf("RepositoryMock.UpdateModelVersionDigestByID got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmUpdateModelVersionDigestByID.UpdateModelVersionDigestByIDMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.modelUID != nil && !minimock.Equal(*mm_want_ptrs.modelUID, mm_got.modelUID) { - mmUpdateModelVersionDigestByID.t.Errorf("RepositoryMock.UpdateModelVersionDigestByID got unexpected parameter modelUID, want: %#v, got: %#v%s\n", *mm_want_ptrs.modelUID, mm_got.modelUID, minimock.Diff(*mm_want_ptrs.modelUID, mm_got.modelUID)) + mmUpdateModelVersionDigestByID.t.Errorf("RepositoryMock.UpdateModelVersionDigestByID got unexpected parameter modelUID, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmUpdateModelVersionDigestByID.UpdateModelVersionDigestByIDMock.defaultExpectation.expectationOrigins.originModelUID, *mm_want_ptrs.modelUID, mm_got.modelUID, minimock.Diff(*mm_want_ptrs.modelUID, mm_got.modelUID)) } if mm_want_ptrs.versionID != nil && !minimock.Equal(*mm_want_ptrs.versionID, mm_got.versionID) { - mmUpdateModelVersionDigestByID.t.Errorf("RepositoryMock.UpdateModelVersionDigestByID got unexpected parameter versionID, want: %#v, got: %#v%s\n", *mm_want_ptrs.versionID, mm_got.versionID, minimock.Diff(*mm_want_ptrs.versionID, mm_got.versionID)) + mmUpdateModelVersionDigestByID.t.Errorf("RepositoryMock.UpdateModelVersionDigestByID got unexpected parameter versionID, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmUpdateModelVersionDigestByID.UpdateModelVersionDigestByIDMock.defaultExpectation.expectationOrigins.originVersionID, *mm_want_ptrs.versionID, mm_got.versionID, minimock.Diff(*mm_want_ptrs.versionID, mm_got.versionID)) } if mm_want_ptrs.digest != nil && !minimock.Equal(*mm_want_ptrs.digest, mm_got.digest) { - mmUpdateModelVersionDigestByID.t.Errorf("RepositoryMock.UpdateModelVersionDigestByID got unexpected parameter digest, want: %#v, got: %#v%s\n", *mm_want_ptrs.digest, mm_got.digest, minimock.Diff(*mm_want_ptrs.digest, mm_got.digest)) + mmUpdateModelVersionDigestByID.t.Errorf("RepositoryMock.UpdateModelVersionDigestByID got unexpected parameter digest, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmUpdateModelVersionDigestByID.UpdateModelVersionDigestByIDMock.defaultExpectation.expectationOrigins.originDigest, *mm_want_ptrs.digest, mm_got.digest, minimock.Diff(*mm_want_ptrs.digest, mm_got.digest)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmUpdateModelVersionDigestByID.t.Errorf("RepositoryMock.UpdateModelVersionDigestByID got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmUpdateModelVersionDigestByID.t.Errorf("RepositoryMock.UpdateModelVersionDigestByID got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmUpdateModelVersionDigestByID.UpdateModelVersionDigestByIDMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmUpdateModelVersionDigestByID.UpdateModelVersionDigestByIDMock.defaultExpectation.results @@ -11216,7 +12589,7 @@ func (m *RepositoryMock) MinimockUpdateModelVersionDigestByIDDone() bool { func (m *RepositoryMock) MinimockUpdateModelVersionDigestByIDInspect() { for _, e := range m.UpdateModelVersionDigestByIDMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.UpdateModelVersionDigestByID with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.UpdateModelVersionDigestByID at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -11224,19 +12597,19 @@ func (m *RepositoryMock) MinimockUpdateModelVersionDigestByIDInspect() { // if default expectation was set then invocations count should be greater than zero if m.UpdateModelVersionDigestByIDMock.defaultExpectation != nil && afterUpdateModelVersionDigestByIDCounter < 1 { if m.UpdateModelVersionDigestByIDMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.UpdateModelVersionDigestByID") + m.t.Errorf("Expected call to RepositoryMock.UpdateModelVersionDigestByID at\n%s", m.UpdateModelVersionDigestByIDMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.UpdateModelVersionDigestByID with params: %#v", *m.UpdateModelVersionDigestByIDMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.UpdateModelVersionDigestByID at\n%s with params: %#v", m.UpdateModelVersionDigestByIDMock.defaultExpectation.expectationOrigins.origin, *m.UpdateModelVersionDigestByIDMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcUpdateModelVersionDigestByID != nil && afterUpdateModelVersionDigestByIDCounter < 1 { - m.t.Error("Expected call to RepositoryMock.UpdateModelVersionDigestByID") + m.t.Errorf("Expected call to RepositoryMock.UpdateModelVersionDigestByID at\n%s", m.funcUpdateModelVersionDigestByIDOrigin) } if !m.UpdateModelVersionDigestByIDMock.invocationsDone() && afterUpdateModelVersionDigestByIDCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.UpdateModelVersionDigestByID but found %d calls", - mm_atomic.LoadUint64(&m.UpdateModelVersionDigestByIDMock.expectedInvocations), afterUpdateModelVersionDigestByIDCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.UpdateModelVersionDigestByID at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.UpdateModelVersionDigestByIDMock.expectedInvocations), m.UpdateModelVersionDigestByIDMock.expectedInvocationsOrigin, afterUpdateModelVersionDigestByIDCounter) } } @@ -11249,16 +12622,19 @@ type mRepositoryMockUpdateNamespaceModelByID struct { callArgs []*RepositoryMockUpdateNamespaceModelByIDParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockUpdateNamespaceModelByIDExpectation specifies expectation struct of the Repository.UpdateNamespaceModelByID type RepositoryMockUpdateNamespaceModelByIDExpectation struct { - mock *RepositoryMock - params *RepositoryMockUpdateNamespaceModelByIDParams - paramPtrs *RepositoryMockUpdateNamespaceModelByIDParamPtrs - results *RepositoryMockUpdateNamespaceModelByIDResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockUpdateNamespaceModelByIDParams + paramPtrs *RepositoryMockUpdateNamespaceModelByIDParamPtrs + expectationOrigins RepositoryMockUpdateNamespaceModelByIDExpectationOrigins + results *RepositoryMockUpdateNamespaceModelByIDResults + returnOrigin string + Counter uint64 } // RepositoryMockUpdateNamespaceModelByIDParams contains parameters of the Repository.UpdateNamespaceModelByID @@ -11282,6 +12658,15 @@ type RepositoryMockUpdateNamespaceModelByIDResults struct { err error } +// RepositoryMockUpdateNamespaceModelByIDOrigins contains origins of expectations of the Repository.UpdateNamespaceModelByID +type RepositoryMockUpdateNamespaceModelByIDExpectationOrigins struct { + origin string + originCtx string + originOwnerPermalink string + originId string + originModel string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -11307,6 +12692,7 @@ func (mmUpdateNamespaceModelByID *mRepositoryMockUpdateNamespaceModelByID) Expec } mmUpdateNamespaceModelByID.defaultExpectation.params = &RepositoryMockUpdateNamespaceModelByIDParams{ctx, ownerPermalink, id, model} + mmUpdateNamespaceModelByID.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmUpdateNamespaceModelByID.expectations { if minimock.Equal(e.params, mmUpdateNamespaceModelByID.defaultExpectation.params) { mmUpdateNamespaceModelByID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmUpdateNamespaceModelByID.defaultExpectation.params) @@ -11334,6 +12720,7 @@ func (mmUpdateNamespaceModelByID *mRepositoryMockUpdateNamespaceModelByID) Expec mmUpdateNamespaceModelByID.defaultExpectation.paramPtrs = &RepositoryMockUpdateNamespaceModelByIDParamPtrs{} } mmUpdateNamespaceModelByID.defaultExpectation.paramPtrs.ctx = &ctx + mmUpdateNamespaceModelByID.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmUpdateNamespaceModelByID } @@ -11356,6 +12743,7 @@ func (mmUpdateNamespaceModelByID *mRepositoryMockUpdateNamespaceModelByID) Expec mmUpdateNamespaceModelByID.defaultExpectation.paramPtrs = &RepositoryMockUpdateNamespaceModelByIDParamPtrs{} } mmUpdateNamespaceModelByID.defaultExpectation.paramPtrs.ownerPermalink = &ownerPermalink + mmUpdateNamespaceModelByID.defaultExpectation.expectationOrigins.originOwnerPermalink = minimock.CallerInfo(1) return mmUpdateNamespaceModelByID } @@ -11378,6 +12766,7 @@ func (mmUpdateNamespaceModelByID *mRepositoryMockUpdateNamespaceModelByID) Expec mmUpdateNamespaceModelByID.defaultExpectation.paramPtrs = &RepositoryMockUpdateNamespaceModelByIDParamPtrs{} } mmUpdateNamespaceModelByID.defaultExpectation.paramPtrs.id = &id + mmUpdateNamespaceModelByID.defaultExpectation.expectationOrigins.originId = minimock.CallerInfo(1) return mmUpdateNamespaceModelByID } @@ -11400,6 +12789,7 @@ func (mmUpdateNamespaceModelByID *mRepositoryMockUpdateNamespaceModelByID) Expec mmUpdateNamespaceModelByID.defaultExpectation.paramPtrs = &RepositoryMockUpdateNamespaceModelByIDParamPtrs{} } mmUpdateNamespaceModelByID.defaultExpectation.paramPtrs.model = &model + mmUpdateNamespaceModelByID.defaultExpectation.expectationOrigins.originModel = minimock.CallerInfo(1) return mmUpdateNamespaceModelByID } @@ -11425,6 +12815,7 @@ func (mmUpdateNamespaceModelByID *mRepositoryMockUpdateNamespaceModelByID) Retur mmUpdateNamespaceModelByID.defaultExpectation = &RepositoryMockUpdateNamespaceModelByIDExpectation{mock: mmUpdateNamespaceModelByID.mock} } mmUpdateNamespaceModelByID.defaultExpectation.results = &RepositoryMockUpdateNamespaceModelByIDResults{err} + mmUpdateNamespaceModelByID.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmUpdateNamespaceModelByID.mock } @@ -11439,6 +12830,7 @@ func (mmUpdateNamespaceModelByID *mRepositoryMockUpdateNamespaceModelByID) Set(f } mmUpdateNamespaceModelByID.mock.funcUpdateNamespaceModelByID = f + mmUpdateNamespaceModelByID.mock.funcUpdateNamespaceModelByIDOrigin = minimock.CallerInfo(1) return mmUpdateNamespaceModelByID.mock } @@ -11450,8 +12842,9 @@ func (mmUpdateNamespaceModelByID *mRepositoryMockUpdateNamespaceModelByID) When( } expectation := &RepositoryMockUpdateNamespaceModelByIDExpectation{ - mock: mmUpdateNamespaceModelByID.mock, - params: &RepositoryMockUpdateNamespaceModelByIDParams{ctx, ownerPermalink, id, model}, + mock: mmUpdateNamespaceModelByID.mock, + params: &RepositoryMockUpdateNamespaceModelByIDParams{ctx, ownerPermalink, id, model}, + expectationOrigins: RepositoryMockUpdateNamespaceModelByIDExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmUpdateNamespaceModelByID.expectations = append(mmUpdateNamespaceModelByID.expectations, expectation) return expectation @@ -11469,6 +12862,7 @@ func (mmUpdateNamespaceModelByID *mRepositoryMockUpdateNamespaceModelByID) Times mmUpdateNamespaceModelByID.mock.t.Fatalf("Times of RepositoryMock.UpdateNamespaceModelByID mock can not be zero") } mm_atomic.StoreUint64(&mmUpdateNamespaceModelByID.expectedInvocations, n) + mmUpdateNamespaceModelByID.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmUpdateNamespaceModelByID } @@ -11483,11 +12877,13 @@ func (mmUpdateNamespaceModelByID *mRepositoryMockUpdateNamespaceModelByID) invoc return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// UpdateNamespaceModelByID implements repository.Repository +// UpdateNamespaceModelByID implements mm_repository.Repository func (mmUpdateNamespaceModelByID *RepositoryMock) UpdateNamespaceModelByID(ctx context.Context, ownerPermalink string, id string, model *datamodel.Model) (err error) { mm_atomic.AddUint64(&mmUpdateNamespaceModelByID.beforeUpdateNamespaceModelByIDCounter, 1) defer mm_atomic.AddUint64(&mmUpdateNamespaceModelByID.afterUpdateNamespaceModelByIDCounter, 1) + mmUpdateNamespaceModelByID.t.Helper() + if mmUpdateNamespaceModelByID.inspectFuncUpdateNamespaceModelByID != nil { mmUpdateNamespaceModelByID.inspectFuncUpdateNamespaceModelByID(ctx, ownerPermalink, id, model) } @@ -11516,23 +12912,28 @@ func (mmUpdateNamespaceModelByID *RepositoryMock) UpdateNamespaceModelByID(ctx c if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmUpdateNamespaceModelByID.t.Errorf("RepositoryMock.UpdateNamespaceModelByID got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmUpdateNamespaceModelByID.t.Errorf("RepositoryMock.UpdateNamespaceModelByID got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmUpdateNamespaceModelByID.UpdateNamespaceModelByIDMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.ownerPermalink != nil && !minimock.Equal(*mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink) { - mmUpdateNamespaceModelByID.t.Errorf("RepositoryMock.UpdateNamespaceModelByID got unexpected parameter ownerPermalink, want: %#v, got: %#v%s\n", *mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink, minimock.Diff(*mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink)) + mmUpdateNamespaceModelByID.t.Errorf("RepositoryMock.UpdateNamespaceModelByID got unexpected parameter ownerPermalink, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmUpdateNamespaceModelByID.UpdateNamespaceModelByIDMock.defaultExpectation.expectationOrigins.originOwnerPermalink, *mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink, minimock.Diff(*mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink)) } if mm_want_ptrs.id != nil && !minimock.Equal(*mm_want_ptrs.id, mm_got.id) { - mmUpdateNamespaceModelByID.t.Errorf("RepositoryMock.UpdateNamespaceModelByID got unexpected parameter id, want: %#v, got: %#v%s\n", *mm_want_ptrs.id, mm_got.id, minimock.Diff(*mm_want_ptrs.id, mm_got.id)) + mmUpdateNamespaceModelByID.t.Errorf("RepositoryMock.UpdateNamespaceModelByID got unexpected parameter id, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmUpdateNamespaceModelByID.UpdateNamespaceModelByIDMock.defaultExpectation.expectationOrigins.originId, *mm_want_ptrs.id, mm_got.id, minimock.Diff(*mm_want_ptrs.id, mm_got.id)) } if mm_want_ptrs.model != nil && !minimock.Equal(*mm_want_ptrs.model, mm_got.model) { - mmUpdateNamespaceModelByID.t.Errorf("RepositoryMock.UpdateNamespaceModelByID got unexpected parameter model, want: %#v, got: %#v%s\n", *mm_want_ptrs.model, mm_got.model, minimock.Diff(*mm_want_ptrs.model, mm_got.model)) + mmUpdateNamespaceModelByID.t.Errorf("RepositoryMock.UpdateNamespaceModelByID got unexpected parameter model, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmUpdateNamespaceModelByID.UpdateNamespaceModelByIDMock.defaultExpectation.expectationOrigins.originModel, *mm_want_ptrs.model, mm_got.model, minimock.Diff(*mm_want_ptrs.model, mm_got.model)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmUpdateNamespaceModelByID.t.Errorf("RepositoryMock.UpdateNamespaceModelByID got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmUpdateNamespaceModelByID.t.Errorf("RepositoryMock.UpdateNamespaceModelByID got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmUpdateNamespaceModelByID.UpdateNamespaceModelByIDMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmUpdateNamespaceModelByID.UpdateNamespaceModelByIDMock.defaultExpectation.results @@ -11592,7 +12993,7 @@ func (m *RepositoryMock) MinimockUpdateNamespaceModelByIDDone() bool { func (m *RepositoryMock) MinimockUpdateNamespaceModelByIDInspect() { for _, e := range m.UpdateNamespaceModelByIDMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.UpdateNamespaceModelByID with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.UpdateNamespaceModelByID at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -11600,19 +13001,19 @@ func (m *RepositoryMock) MinimockUpdateNamespaceModelByIDInspect() { // if default expectation was set then invocations count should be greater than zero if m.UpdateNamespaceModelByIDMock.defaultExpectation != nil && afterUpdateNamespaceModelByIDCounter < 1 { if m.UpdateNamespaceModelByIDMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.UpdateNamespaceModelByID") + m.t.Errorf("Expected call to RepositoryMock.UpdateNamespaceModelByID at\n%s", m.UpdateNamespaceModelByIDMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.UpdateNamespaceModelByID with params: %#v", *m.UpdateNamespaceModelByIDMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.UpdateNamespaceModelByID at\n%s with params: %#v", m.UpdateNamespaceModelByIDMock.defaultExpectation.expectationOrigins.origin, *m.UpdateNamespaceModelByIDMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcUpdateNamespaceModelByID != nil && afterUpdateNamespaceModelByIDCounter < 1 { - m.t.Error("Expected call to RepositoryMock.UpdateNamespaceModelByID") + m.t.Errorf("Expected call to RepositoryMock.UpdateNamespaceModelByID at\n%s", m.funcUpdateNamespaceModelByIDOrigin) } if !m.UpdateNamespaceModelByIDMock.invocationsDone() && afterUpdateNamespaceModelByIDCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.UpdateNamespaceModelByID but found %d calls", - mm_atomic.LoadUint64(&m.UpdateNamespaceModelByIDMock.expectedInvocations), afterUpdateNamespaceModelByIDCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.UpdateNamespaceModelByID at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.UpdateNamespaceModelByIDMock.expectedInvocations), m.UpdateNamespaceModelByIDMock.expectedInvocationsOrigin, afterUpdateNamespaceModelByIDCounter) } } @@ -11625,16 +13026,19 @@ type mRepositoryMockUpdateNamespaceModelIDByID struct { callArgs []*RepositoryMockUpdateNamespaceModelIDByIDParams mutex sync.RWMutex - expectedInvocations uint64 + expectedInvocations uint64 + expectedInvocationsOrigin string } // RepositoryMockUpdateNamespaceModelIDByIDExpectation specifies expectation struct of the Repository.UpdateNamespaceModelIDByID type RepositoryMockUpdateNamespaceModelIDByIDExpectation struct { - mock *RepositoryMock - params *RepositoryMockUpdateNamespaceModelIDByIDParams - paramPtrs *RepositoryMockUpdateNamespaceModelIDByIDParamPtrs - results *RepositoryMockUpdateNamespaceModelIDByIDResults - Counter uint64 + mock *RepositoryMock + params *RepositoryMockUpdateNamespaceModelIDByIDParams + paramPtrs *RepositoryMockUpdateNamespaceModelIDByIDParamPtrs + expectationOrigins RepositoryMockUpdateNamespaceModelIDByIDExpectationOrigins + results *RepositoryMockUpdateNamespaceModelIDByIDResults + returnOrigin string + Counter uint64 } // RepositoryMockUpdateNamespaceModelIDByIDParams contains parameters of the Repository.UpdateNamespaceModelIDByID @@ -11658,6 +13062,15 @@ type RepositoryMockUpdateNamespaceModelIDByIDResults struct { err error } +// RepositoryMockUpdateNamespaceModelIDByIDOrigins contains origins of expectations of the Repository.UpdateNamespaceModelIDByID +type RepositoryMockUpdateNamespaceModelIDByIDExpectationOrigins struct { + origin string + originCtx string + originOwnerPermalink string + originId string + originNewID string +} + // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. @@ -11683,6 +13096,7 @@ func (mmUpdateNamespaceModelIDByID *mRepositoryMockUpdateNamespaceModelIDByID) E } mmUpdateNamespaceModelIDByID.defaultExpectation.params = &RepositoryMockUpdateNamespaceModelIDByIDParams{ctx, ownerPermalink, id, newID} + mmUpdateNamespaceModelIDByID.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1) for _, e := range mmUpdateNamespaceModelIDByID.expectations { if minimock.Equal(e.params, mmUpdateNamespaceModelIDByID.defaultExpectation.params) { mmUpdateNamespaceModelIDByID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmUpdateNamespaceModelIDByID.defaultExpectation.params) @@ -11710,6 +13124,7 @@ func (mmUpdateNamespaceModelIDByID *mRepositoryMockUpdateNamespaceModelIDByID) E mmUpdateNamespaceModelIDByID.defaultExpectation.paramPtrs = &RepositoryMockUpdateNamespaceModelIDByIDParamPtrs{} } mmUpdateNamespaceModelIDByID.defaultExpectation.paramPtrs.ctx = &ctx + mmUpdateNamespaceModelIDByID.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1) return mmUpdateNamespaceModelIDByID } @@ -11732,6 +13147,7 @@ func (mmUpdateNamespaceModelIDByID *mRepositoryMockUpdateNamespaceModelIDByID) E mmUpdateNamespaceModelIDByID.defaultExpectation.paramPtrs = &RepositoryMockUpdateNamespaceModelIDByIDParamPtrs{} } mmUpdateNamespaceModelIDByID.defaultExpectation.paramPtrs.ownerPermalink = &ownerPermalink + mmUpdateNamespaceModelIDByID.defaultExpectation.expectationOrigins.originOwnerPermalink = minimock.CallerInfo(1) return mmUpdateNamespaceModelIDByID } @@ -11754,6 +13170,7 @@ func (mmUpdateNamespaceModelIDByID *mRepositoryMockUpdateNamespaceModelIDByID) E mmUpdateNamespaceModelIDByID.defaultExpectation.paramPtrs = &RepositoryMockUpdateNamespaceModelIDByIDParamPtrs{} } mmUpdateNamespaceModelIDByID.defaultExpectation.paramPtrs.id = &id + mmUpdateNamespaceModelIDByID.defaultExpectation.expectationOrigins.originId = minimock.CallerInfo(1) return mmUpdateNamespaceModelIDByID } @@ -11776,6 +13193,7 @@ func (mmUpdateNamespaceModelIDByID *mRepositoryMockUpdateNamespaceModelIDByID) E mmUpdateNamespaceModelIDByID.defaultExpectation.paramPtrs = &RepositoryMockUpdateNamespaceModelIDByIDParamPtrs{} } mmUpdateNamespaceModelIDByID.defaultExpectation.paramPtrs.newID = &newID + mmUpdateNamespaceModelIDByID.defaultExpectation.expectationOrigins.originNewID = minimock.CallerInfo(1) return mmUpdateNamespaceModelIDByID } @@ -11801,6 +13219,7 @@ func (mmUpdateNamespaceModelIDByID *mRepositoryMockUpdateNamespaceModelIDByID) R mmUpdateNamespaceModelIDByID.defaultExpectation = &RepositoryMockUpdateNamespaceModelIDByIDExpectation{mock: mmUpdateNamespaceModelIDByID.mock} } mmUpdateNamespaceModelIDByID.defaultExpectation.results = &RepositoryMockUpdateNamespaceModelIDByIDResults{err} + mmUpdateNamespaceModelIDByID.defaultExpectation.returnOrigin = minimock.CallerInfo(1) return mmUpdateNamespaceModelIDByID.mock } @@ -11815,6 +13234,7 @@ func (mmUpdateNamespaceModelIDByID *mRepositoryMockUpdateNamespaceModelIDByID) S } mmUpdateNamespaceModelIDByID.mock.funcUpdateNamespaceModelIDByID = f + mmUpdateNamespaceModelIDByID.mock.funcUpdateNamespaceModelIDByIDOrigin = minimock.CallerInfo(1) return mmUpdateNamespaceModelIDByID.mock } @@ -11826,8 +13246,9 @@ func (mmUpdateNamespaceModelIDByID *mRepositoryMockUpdateNamespaceModelIDByID) W } expectation := &RepositoryMockUpdateNamespaceModelIDByIDExpectation{ - mock: mmUpdateNamespaceModelIDByID.mock, - params: &RepositoryMockUpdateNamespaceModelIDByIDParams{ctx, ownerPermalink, id, newID}, + mock: mmUpdateNamespaceModelIDByID.mock, + params: &RepositoryMockUpdateNamespaceModelIDByIDParams{ctx, ownerPermalink, id, newID}, + expectationOrigins: RepositoryMockUpdateNamespaceModelIDByIDExpectationOrigins{origin: minimock.CallerInfo(1)}, } mmUpdateNamespaceModelIDByID.expectations = append(mmUpdateNamespaceModelIDByID.expectations, expectation) return expectation @@ -11845,6 +13266,7 @@ func (mmUpdateNamespaceModelIDByID *mRepositoryMockUpdateNamespaceModelIDByID) T mmUpdateNamespaceModelIDByID.mock.t.Fatalf("Times of RepositoryMock.UpdateNamespaceModelIDByID mock can not be zero") } mm_atomic.StoreUint64(&mmUpdateNamespaceModelIDByID.expectedInvocations, n) + mmUpdateNamespaceModelIDByID.expectedInvocationsOrigin = minimock.CallerInfo(1) return mmUpdateNamespaceModelIDByID } @@ -11859,11 +13281,13 @@ func (mmUpdateNamespaceModelIDByID *mRepositoryMockUpdateNamespaceModelIDByID) i return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } -// UpdateNamespaceModelIDByID implements repository.Repository +// UpdateNamespaceModelIDByID implements mm_repository.Repository func (mmUpdateNamespaceModelIDByID *RepositoryMock) UpdateNamespaceModelIDByID(ctx context.Context, ownerPermalink string, id string, newID string) (err error) { mm_atomic.AddUint64(&mmUpdateNamespaceModelIDByID.beforeUpdateNamespaceModelIDByIDCounter, 1) defer mm_atomic.AddUint64(&mmUpdateNamespaceModelIDByID.afterUpdateNamespaceModelIDByIDCounter, 1) + mmUpdateNamespaceModelIDByID.t.Helper() + if mmUpdateNamespaceModelIDByID.inspectFuncUpdateNamespaceModelIDByID != nil { mmUpdateNamespaceModelIDByID.inspectFuncUpdateNamespaceModelIDByID(ctx, ownerPermalink, id, newID) } @@ -11892,23 +13316,28 @@ func (mmUpdateNamespaceModelIDByID *RepositoryMock) UpdateNamespaceModelIDByID(c if mm_want_ptrs != nil { if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) { - mmUpdateNamespaceModelIDByID.t.Errorf("RepositoryMock.UpdateNamespaceModelIDByID got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) + mmUpdateNamespaceModelIDByID.t.Errorf("RepositoryMock.UpdateNamespaceModelIDByID got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmUpdateNamespaceModelIDByID.UpdateNamespaceModelIDByIDMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx)) } if mm_want_ptrs.ownerPermalink != nil && !minimock.Equal(*mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink) { - mmUpdateNamespaceModelIDByID.t.Errorf("RepositoryMock.UpdateNamespaceModelIDByID got unexpected parameter ownerPermalink, want: %#v, got: %#v%s\n", *mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink, minimock.Diff(*mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink)) + mmUpdateNamespaceModelIDByID.t.Errorf("RepositoryMock.UpdateNamespaceModelIDByID got unexpected parameter ownerPermalink, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmUpdateNamespaceModelIDByID.UpdateNamespaceModelIDByIDMock.defaultExpectation.expectationOrigins.originOwnerPermalink, *mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink, minimock.Diff(*mm_want_ptrs.ownerPermalink, mm_got.ownerPermalink)) } if mm_want_ptrs.id != nil && !minimock.Equal(*mm_want_ptrs.id, mm_got.id) { - mmUpdateNamespaceModelIDByID.t.Errorf("RepositoryMock.UpdateNamespaceModelIDByID got unexpected parameter id, want: %#v, got: %#v%s\n", *mm_want_ptrs.id, mm_got.id, minimock.Diff(*mm_want_ptrs.id, mm_got.id)) + mmUpdateNamespaceModelIDByID.t.Errorf("RepositoryMock.UpdateNamespaceModelIDByID got unexpected parameter id, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmUpdateNamespaceModelIDByID.UpdateNamespaceModelIDByIDMock.defaultExpectation.expectationOrigins.originId, *mm_want_ptrs.id, mm_got.id, minimock.Diff(*mm_want_ptrs.id, mm_got.id)) } if mm_want_ptrs.newID != nil && !minimock.Equal(*mm_want_ptrs.newID, mm_got.newID) { - mmUpdateNamespaceModelIDByID.t.Errorf("RepositoryMock.UpdateNamespaceModelIDByID got unexpected parameter newID, want: %#v, got: %#v%s\n", *mm_want_ptrs.newID, mm_got.newID, minimock.Diff(*mm_want_ptrs.newID, mm_got.newID)) + mmUpdateNamespaceModelIDByID.t.Errorf("RepositoryMock.UpdateNamespaceModelIDByID got unexpected parameter newID, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmUpdateNamespaceModelIDByID.UpdateNamespaceModelIDByIDMock.defaultExpectation.expectationOrigins.originNewID, *mm_want_ptrs.newID, mm_got.newID, minimock.Diff(*mm_want_ptrs.newID, mm_got.newID)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { - mmUpdateNamespaceModelIDByID.t.Errorf("RepositoryMock.UpdateNamespaceModelIDByID got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) + mmUpdateNamespaceModelIDByID.t.Errorf("RepositoryMock.UpdateNamespaceModelIDByID got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n", + mmUpdateNamespaceModelIDByID.UpdateNamespaceModelIDByIDMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmUpdateNamespaceModelIDByID.UpdateNamespaceModelIDByIDMock.defaultExpectation.results @@ -11968,7 +13397,7 @@ func (m *RepositoryMock) MinimockUpdateNamespaceModelIDByIDDone() bool { func (m *RepositoryMock) MinimockUpdateNamespaceModelIDByIDInspect() { for _, e := range m.UpdateNamespaceModelIDByIDMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { - m.t.Errorf("Expected call to RepositoryMock.UpdateNamespaceModelIDByID with params: %#v", *e.params) + m.t.Errorf("Expected call to RepositoryMock.UpdateNamespaceModelIDByID at\n%s with params: %#v", e.expectationOrigins.origin, *e.params) } } @@ -11976,19 +13405,19 @@ func (m *RepositoryMock) MinimockUpdateNamespaceModelIDByIDInspect() { // if default expectation was set then invocations count should be greater than zero if m.UpdateNamespaceModelIDByIDMock.defaultExpectation != nil && afterUpdateNamespaceModelIDByIDCounter < 1 { if m.UpdateNamespaceModelIDByIDMock.defaultExpectation.params == nil { - m.t.Error("Expected call to RepositoryMock.UpdateNamespaceModelIDByID") + m.t.Errorf("Expected call to RepositoryMock.UpdateNamespaceModelIDByID at\n%s", m.UpdateNamespaceModelIDByIDMock.defaultExpectation.returnOrigin) } else { - m.t.Errorf("Expected call to RepositoryMock.UpdateNamespaceModelIDByID with params: %#v", *m.UpdateNamespaceModelIDByIDMock.defaultExpectation.params) + m.t.Errorf("Expected call to RepositoryMock.UpdateNamespaceModelIDByID at\n%s with params: %#v", m.UpdateNamespaceModelIDByIDMock.defaultExpectation.expectationOrigins.origin, *m.UpdateNamespaceModelIDByIDMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcUpdateNamespaceModelIDByID != nil && afterUpdateNamespaceModelIDByIDCounter < 1 { - m.t.Error("Expected call to RepositoryMock.UpdateNamespaceModelIDByID") + m.t.Errorf("Expected call to RepositoryMock.UpdateNamespaceModelIDByID at\n%s", m.funcUpdateNamespaceModelIDByIDOrigin) } if !m.UpdateNamespaceModelIDByIDMock.invocationsDone() && afterUpdateNamespaceModelIDByIDCounter > 0 { - m.t.Errorf("Expected %d calls to RepositoryMock.UpdateNamespaceModelIDByID but found %d calls", - mm_atomic.LoadUint64(&m.UpdateNamespaceModelIDByIDMock.expectedInvocations), afterUpdateNamespaceModelIDByIDCounter) + m.t.Errorf("Expected %d calls to RepositoryMock.UpdateNamespaceModelIDByID at\n%s but found %d calls", + mm_atomic.LoadUint64(&m.UpdateNamespaceModelIDByIDMock.expectedInvocations), m.UpdateNamespaceModelIDByIDMock.expectedInvocationsOrigin, afterUpdateNamespaceModelIDByIDCounter) } } @@ -12038,6 +13467,8 @@ func (m *RepositoryMock) MinimockFinish() { m.MinimockListModelRunsInspect() + m.MinimockListModelRunsByCreditOwnerInspect() + m.MinimockListModelTagsInspect() m.MinimockListModelVersionsInspect() @@ -12103,6 +13534,7 @@ func (m *RepositoryMock) minimockDone() bool { m.MinimockGetNamespaceModelByIDDone() && m.MinimockListModelDefinitionsDone() && m.MinimockListModelRunsDone() && + m.MinimockListModelRunsByCreditOwnerDone() && m.MinimockListModelTagsDone() && m.MinimockListModelVersionsDone() && m.MinimockListModelVersionsByDigestDone() && diff --git a/pkg/repository/repository.go b/pkg/repository/repository.go index b6f13458..c7dd3c48 100644 --- a/pkg/repository/repository.go +++ b/pkg/repository/repository.go @@ -70,9 +70,10 @@ type Repository interface { GetModelRunByUID(ctx context.Context, triggerUID string) (modelRun *datamodel.ModelRun, err error) GetLatestModelRunByModelUID(ctx context.Context, userUID string, modelUID string) (modelRun *datamodel.ModelRun, err error) GetLatestModelVersionRunByModelUID(ctx context.Context, userUID string, modelUID string, version string) (modelRun *datamodel.ModelRun, err error) - ListModelRuns(ctx context.Context, pageSize, page int64, filter filtering.Filter, order ordering.OrderBy, requesterUID string, isOwner bool, modelUID string) (modelTriggers []*datamodel.ModelRun, totalSize int64, err error) + ListModelRuns(ctx context.Context, pageSize, page int64, filter filtering.Filter, order ordering.OrderBy, requesterUID string, isOwner bool, modelUID string) (modelRuns []*datamodel.ModelRun, totalSize int64, err error) CreateModelRun(ctx context.Context, modelRun *datamodel.ModelRun) (*datamodel.ModelRun, error) UpdateModelRun(ctx context.Context, modelRun *datamodel.ModelRun) error + ListModelRunsByCreditOwner(ctx context.Context, pageSize, page int64, filter filtering.Filter, order ordering.OrderBy, requesterUID string, startedTimeBegin, startedTimeEnd time.Time) (modelTriggers []*datamodel.ModelRun, totalSize int64, err error) } // DefaultPageSize is the default pagination page size when page size is not assigned @@ -726,7 +727,7 @@ func (r *repository) getModelRunByModelUID(ctx context.Context, where string, wh if errors.Is(result.Error, gorm.ErrRecordNotFound) { return nil, status.Errorf(codes.NotFound, "The model trigger not found") } - return nil, status.Errorf(codes.Internal, err.Error()) + return nil, status.Errorf(codes.Internal, result.Error.Error()) } return &trigger, nil @@ -734,6 +735,7 @@ func (r *repository) getModelRunByModelUID(ctx context.Context, where string, wh func (r *repository) ListModelRuns(ctx context.Context, pageSize, page int64, filter filtering.Filter, order ordering.OrderBy, requesterUID string, isOwner bool, modelUID string) (modelRuns []*datamodel.ModelRun, totalSize int64, err error) { + logger, _ := custom_logger.GetZapLogger(ctx) db := r.CheckPinnedUser(ctx, r.db, tableModelRun) @@ -820,3 +822,57 @@ func (r *repository) UpdateModelRun(ctx context.Context, modelRun *datamodel.Mod } return nil } + +func (r *repository) ListModelRunsByCreditOwner(ctx context.Context, pageSize, page int64, filter filtering.Filter, order ordering.OrderBy, + requesterUID string, startedTimeBegin, startedTimeEnd time.Time) ([]*datamodel.ModelRun, int64, error) { + + logger, _ := custom_logger.GetZapLogger(ctx) + + var modelRuns []*datamodel.ModelRun + var totalSize int64 + var err error + + db := r.CheckPinnedUser(ctx, r.db, tableModelRun) + + whereConditions := []string{"requester_uid = ? and create_time >= ? and create_time <= ?"} + whereArgs := []any{requesterUID, startedTimeBegin, startedTimeEnd} + + var expr *clause.Expr + if expr, err = r.transpileFilter(filter, tableModelRun); err != nil { + return nil, 0, err + } + if expr != nil { + whereConditions = append(whereConditions, "(?)") + whereArgs = append(whereArgs, expr) + } + + var where string + if len(whereConditions) > 0 { + where = strings.Join(whereConditions, " and ") + } + + if err = db.Model(&datamodel.ModelRun{}).Where(where, whereArgs...).Count(&totalSize).Error; err != nil { + logger.Error("failed in count model run total size", zap.Error(err)) + return nil, 0, err + } + + queryBuilder := db.Preload(clause.Associations).Where(where, whereArgs...) + if order.Fields == nil || len(order.Fields) == 0 { + order.Fields = append(order.Fields, ordering.Field{ + Path: "create_time", + Desc: true, + }) + } + + for _, field := range order.Fields { + orderString := strcase.ToSnake(field.Path) + transformBoolToDescString(field.Desc) + queryBuilder.Order(orderString) + } + + if err = queryBuilder.Limit(int(pageSize)).Offset(int(pageSize * page)).Find(&modelRuns).Error; err != nil { + logger.Error("failed in querying model runs", zap.Error(err)) + return nil, 0, err + } + + return modelRuns, totalSize, nil +} diff --git a/pkg/repository/repository_test.go b/pkg/repository/repository_test.go index a93e37e5..9d5730f5 100644 --- a/pkg/repository/repository_test.go +++ b/pkg/repository/repository_test.go @@ -35,7 +35,7 @@ import ( var db *gorm.DB func TestMain(m *testing.M) { - if err := config.Init("../../config/config.local.yaml"); err != nil { + if err := config.Init("../../config/config.yaml"); err != nil { panic(err) } @@ -62,37 +62,16 @@ func TestRepository(t *testing.T) { c.Cleanup(func() { tx.Rollback() }) repo := repository.NewRepository(tx, rc) - recordUUID, _ := uuid.NewV4() - triggerUUID, _ := uuid.NewV4() - userUUID, _ := uuid.NewV4() - - defs, _, _, err := repo.ListModelDefinitions(modelpb.View_VIEW_FULL, 100, "") - require.NoError(t, err) - require.NotEmpty(t, defs) - + mockModel := MockNamespaceModel(t, repo) ctx := context.Background() - err = repo.CreateNamespaceModel(ctx, recordUUID.String(), &datamodel.Model{ - ID: recordUUID.String(), - ModelDefinitionUID: defs[0].UID, - Visibility: datamodel.ModelVisibility(modelpb.Model_VISIBILITY_PRIVATE), - Owner: recordUUID.String(), - Task: datamodel.ModelTask(commonpb.Task_TASK_CLASSIFICATION), - }) - require.NoError(t, err) - visibility := modelpb.Model_VISIBILITY_PRIVATE - models, _, _, err := repo.ListNamespaceModels(ctx, recordUUID.String(), 10, "", - true, filtering.Filter{}, nil, false, ordering.OrderBy{}, &visibility) - require.NoError(t, err) - require.NotEmpty(t, models) - require.Len(t, models, 1) - require.Equal(t, defs[0].UID, models[0].ModelDefinitionUID) - require.Equal(t, recordUUID.String(), models[0].Owner) + triggerUUID, _ := uuid.NewV4() + userUUID, _ := uuid.NewV4() res, err := repo.CreateModelRun(ctx, &datamodel.ModelRun{ BaseStaticHardDelete: datamodel.BaseStaticHardDelete{ UID: triggerUUID, }, - ModelUID: models[0].UID, + ModelUID: mockModel.UID, ModelVersion: "latest", Status: datamodel.RunStatus(runpb.RunStatus_RUN_STATUS_PROCESSING), Source: datamodel.RunSource(runpb.RunSource_RUN_SOURCE_API), @@ -103,7 +82,7 @@ func TestRepository(t *testing.T) { runLog := &datamodel.ModelRun{} runLog.UID = res.UID require.NoError(t, tx.First(runLog).Error) - require.Equal(t, models[0].UID, runLog.ModelUID) + require.Equal(t, mockModel.UID, runLog.ModelUID) require.Equal(t, triggerUUID, runLog.UID) require.Equal(t, userUUID, runLog.RequesterUID) @@ -121,5 +100,95 @@ func TestRepository(t *testing.T) { require.True(t, runLog.EndTime.Valid) require.True(t, runLog.TotalDuration.Valid) require.GreaterOrEqual(t, runLog.TotalDuration.Int64, int64(2000)) +} + +func MockNamespaceModel(t *testing.T, repo repository.Repository) *datamodel.Model { + orgUID := uuid.Must(uuid.NewV4()) + ownerPermalink := "organizations/" + orgUID.String() + + defs, _, _, err := repo.ListModelDefinitions(modelpb.View_VIEW_FULL, 100, "") + require.NoError(t, err) + require.NotEmpty(t, defs) + ctx := context.Background() + err = repo.CreateNamespaceModel(ctx, ownerPermalink, &datamodel.Model{ + ID: uuid.Must(uuid.NewV4()).String(), + ModelDefinitionUID: defs[0].UID, + Visibility: datamodel.ModelVisibility(modelpb.Model_VISIBILITY_PRIVATE), + Owner: ownerPermalink, + Task: datamodel.ModelTask(commonpb.Task_TASK_CLASSIFICATION), + }) + require.NoError(t, err) + + visibility := modelpb.Model_VISIBILITY_PRIVATE + models, totalSize, _, err := repo.ListNamespaceModels(ctx, ownerPermalink, 10, "", + true, filtering.Filter{}, nil, false, ordering.OrderBy{}, &visibility) + require.NoError(t, err) + require.NotEmpty(t, models) + require.Len(t, models, 1) + require.Zero(t, totalSize-1) + require.Equal(t, defs[0].UID, models[0].ModelDefinitionUID) + require.Equal(t, ownerPermalink, models[0].Owner) + + return models[0] +} + +func TestRepository_ListModelRunsByCreditOwner(t *testing.T) { + c := qt.New(t) + + s, err := miniredis.Run() + require.NoError(t, err) + defer s.Close() + + rc := redis.NewClient(&redis.Options{ + Addr: s.Addr(), + }) + + tx := db.Begin() + c.Cleanup(func() { tx.Rollback() }) + + repo := repository.NewRepository(tx, rc) + mockModel := MockNamespaceModel(t, repo) + ctx := context.Background() + + triggerUUID, _ := uuid.NewV4() + userUUID, _ := uuid.NewV4() + now := time.Now() + _, err = repo.CreateModelRun(ctx, &datamodel.ModelRun{ + BaseStaticHardDelete: datamodel.BaseStaticHardDelete{ + UID: triggerUUID, + CreateTime: now, + UpdateTime: now, + }, + ModelUID: mockModel.UID, + ModelVersion: "latest", + Status: datamodel.RunStatus(runpb.RunStatus_RUN_STATUS_PROCESSING), + Source: datamodel.RunSource(runpb.RunSource_RUN_SOURCE_API), + RequesterUID: userUUID, + }) + require.NoError(t, err) + + t.Run("got no result in given time range", func(t *testing.T) { + resp, totalSize, err := repo.ListModelRunsByCreditOwner(ctx, 10, 0, filtering.Filter{}, ordering.OrderBy{}, userUUID.String(), + now.Add(-2*time.Hour), now.Add(-1*time.Hour)) + require.NoError(t, err) + require.Zero(t, totalSize) + require.Empty(t, resp) + }) + + t.Run("got 1 result in given time range", func(t *testing.T) { + resp, totalSize, err := repo.ListModelRunsByCreditOwner(ctx, 10, 0, filtering.Filter{}, ordering.OrderBy{}, userUUID.String(), + now.Add(-1*time.Hour), now.Add(1*time.Hour)) + require.NoError(t, err) + require.Zero(t, totalSize-1) + require.Len(t, resp, 1) + }) + + t.Run("got no result with other's requester ID", func(t *testing.T) { + resp, totalSize, err := repo.ListModelRunsByCreditOwner(ctx, 10, 0, filtering.Filter{}, ordering.OrderBy{}, uuid.Must(uuid.NewV4()).String(), + now.Add(-1*time.Hour), now.Add(1*time.Hour)) + require.NoError(t, err) + require.Zero(t, totalSize) + require.Empty(t, resp) + }) } diff --git a/pkg/service/service.go b/pkg/service/service.go index 2ac8f74b..25d2f3f9 100644 --- a/pkg/service/service.go +++ b/pkg/service/service.go @@ -104,6 +104,7 @@ type Service interface { CreateModelRun(ctx context.Context, triggerUID uuid.UUID, userUID uuid.UUID, modelUID uuid.UUID, version string, inputJSON []byte) (runLog *datamodel.ModelRun, err error) UpdateModelRunWithError(ctx context.Context, runLog *datamodel.ModelRun, err error) *datamodel.ModelRun ListModelRuns(ctx context.Context, req *modelpb.ListModelRunsRequest, filter filtering.Filter) (*modelpb.ListModelRunsResponse, error) + ListModelRunsByCreditOwner(ctx context.Context, req *modelpb.ListModelRunsByCreditOwnerRequest, filter filtering.Filter) (*modelpb.ListModelRunsByCreditOwnerResponse, error) } type service struct { @@ -782,28 +783,11 @@ func (s *service) ListModelRuns(ctx context.Context, req *modelpb.ListModelRunsR } pbModelRuns := make([]*modelpb.ModelRun, len(runs)) + var pbModelRun *modelpb.ModelRun for i, run := range runs { - pbModelRun := &modelpb.ModelRun{ - Uid: run.UID.String(), - ModelUid: run.ModelUID.String(), - Version: run.ModelVersion, - Status: runpb.RunStatus(run.Status), - Source: runpb.RunSource(run.Source), - Error: run.Error.Ptr(), - CreateTime: timestamppb.New(run.CreateTime), - UpdateTime: timestamppb.New(run.UpdateTime), - } - + pbModelRun = convertModelRunToPB(run) pbModelRun.RunnerId = runnerMap[run.RunnerUID.String()] - if run.TotalDuration.Valid { - totalDuration := int32(run.TotalDuration.Int64) - pbModelRun.TotalDuration = &totalDuration - } - if run.EndTime.Valid { - pbModelRun.EndTime = timestamppb.New(run.EndTime.Time) - } - if CanViewPrivateData(run.RequesterUID.String(), requesterUID) { data, ok := metadataMap[run.InputReferenceID] if !ok { @@ -842,6 +826,70 @@ func (s *service) ListModelRuns(ctx context.Context, req *modelpb.ListModelRunsR }, nil } +func (s *service) ListModelRunsByCreditOwner(ctx context.Context, req *modelpb.ListModelRunsByCreditOwnerRequest, filter filtering.Filter) (*modelpb.ListModelRunsByCreditOwnerResponse, error) { + pageSize := s.pageSizeInRange(req.GetPageSize()) + page := s.pageInRange(req.GetPage()) + + orderBy, err := ordering.ParseOrderBy(req) + if err != nil { + return nil, err + } + + logger, _ := custom_logger.GetZapLogger(ctx) + requesterUID, _ := resourcex.GetRequesterUIDAndUserUID(ctx) + + now := time.Now().UTC() + startedTimeBegin := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.UTC) + if req.GetStart().IsValid() { + startedTimeBegin = req.GetStart().AsTime() + } + startedTimeEnd := now + if req.GetStop().IsValid() { + startedTimeEnd = req.GetStop().AsTime() + } + + if startedTimeBegin.After(startedTimeEnd) { + return nil, fmt.Errorf("time range end time %s is earlier than start time %s", startedTimeEnd.Format(time.RFC3339), startedTimeBegin.Format(time.RFC3339)) + } + logger.Info("ListModelRunsByCreditOwner", zap.Time("startedTimeBegin", startedTimeBegin), zap.Time("startedTimeEnd", startedTimeEnd)) + + runs, totalSize, err := s.repository.ListModelRunsByCreditOwner(ctx, int64(pageSize), int64(page), filter, orderBy, requesterUID, startedTimeBegin, startedTimeEnd) + if err != nil { + return nil, err + } + + runnerIDMap := make(map[string]struct{}) + for _, trigger := range runs { + runnerIDMap[trigger.RunnerUID.String()] = struct{}{} + } + + runnerMap := make(map[string]*string) + for runnerID := range runnerIDMap { + runner, err := s.mgmtPrivateServiceClient.CheckNamespaceByUIDAdmin(ctx, &mgmtpb.CheckNamespaceByUIDAdminRequest{Uid: runnerID}) + if err != nil { + return nil, err + } + logger.Info("CheckNamespaceByUIDAdmin finished", zap.String("runnerID", runnerID), zap.String("runnerId", runner.Id)) + runnerMap[runnerID] = &runner.Id + } + + pbModelRuns := make([]*modelpb.ModelRun, len(runs)) + var pbModelRun *modelpb.ModelRun + + for i, run := range runs { + pbModelRun = convertModelRunToPB(run) + pbModelRun.RunnerId = runnerMap[run.RunnerUID.String()] + pbModelRuns[i] = pbModelRun + } + + return &modelpb.ListModelRunsByCreditOwnerResponse{ + Runs: pbModelRuns, + TotalSize: int32(totalSize), + PageSize: pageSize, + Page: page, + }, nil +} + func (s *service) ListNamespaceModels(ctx context.Context, ns resource.Namespace, pageSize int32, pageToken string, view modelpb.View, visibility *modelpb.Model_Visibility, filter filtering.Filter, showDeleted bool, order ordering.OrderBy) ([]*modelpb.Model, int32, string, error) { ownerPermalink := ns.Permalink() diff --git a/pkg/service/service_test.go b/pkg/service/service_test.go index 4fe45cca..1d9d3b36 100644 --- a/pkg/service/service_test.go +++ b/pkg/service/service_test.go @@ -478,5 +478,5 @@ func TestListModelDefinitions(t *testing.T) { func TestService_ListNamespaceModelVersions(t *testing.T) { t.SkipNow() - // tod: implement this + // todo: implement this } diff --git a/pkg/service/utils.go b/pkg/service/utils.go index c6bd99f1..74289588 100644 --- a/pkg/service/utils.go +++ b/pkg/service/utils.go @@ -5,12 +5,16 @@ import ( "fmt" "github.com/gofrs/uuid" + "google.golang.org/protobuf/types/known/timestamppb" "github.com/instill-ai/model-backend/pkg/constant" + "github.com/instill-ai/model-backend/pkg/datamodel" "github.com/instill-ai/model-backend/pkg/repository" "github.com/instill-ai/model-backend/pkg/resource" + runpb "github.com/instill-ai/protogen-go/common/run/v1alpha" mgmtpb "github.com/instill-ai/protogen-go/core/mgmt/v1beta" + modelpb "github.com/instill-ai/protogen-go/model/model/v1alpha" ) func (s *service) checkNamespacePermission(ctx context.Context, ns resource.Namespace) error { @@ -77,3 +81,27 @@ func (s *service) pageInRange(page int32) int32 { func CanViewPrivateData(namespace, requesterUID string) bool { return namespace == requesterUID } + +func convertModelRunToPB(run *datamodel.ModelRun) *modelpb.ModelRun { + pbModelRun := &modelpb.ModelRun{ + Uid: run.UID.String(), + ModelUid: run.ModelUID.String(), + ModelId: &run.Model.ID, + Version: run.ModelVersion, + Status: runpb.RunStatus(run.Status), + Source: runpb.RunSource(run.Source), + Error: run.Error.Ptr(), + CreateTime: timestamppb.New(run.CreateTime), + UpdateTime: timestamppb.New(run.UpdateTime), + } + + if run.TotalDuration.Valid { + totalDuration := int32(run.TotalDuration.Int64) + pbModelRun.TotalDuration = &totalDuration + } + if run.EndTime.Valid { + pbModelRun.EndTime = timestamppb.New(run.EndTime.Time) + } + + return pbModelRun +}