From 1231441065c69e088b401c74c0b2dd2247393d23 Mon Sep 17 00:00:00 2001 From: Chris Martin Date: Thu, 2 Jan 2025 12:59:57 +0000 Subject: [PATCH] Replace github.com/golang/mock with go.uber.org/mock (#4084) * remove mocks * update gomock * update tools * lint --- go.mod | 2 +- go.sum | 11 +- .../controlplaneevents/mock_publisher.go | 67 -------- internal/common/mocks/generate.go | 3 +- .../mocks/jobsetevents/mock_publisher.go | 67 -------- internal/common/mocks/mock_executorapi.go | 51 +++--- internal/common/mocks/mock_publisher.go | 73 ++++++++ internal/common/mocks/mock_pulsar.go | 46 ++--- internal/common/pulsarutils/publisher_test.go | 2 +- .../executor/service/lease_requester_test.go | 2 +- internal/scheduler/api_test.go | 12 +- internal/scheduler/leader/leader_test.go | 2 +- internal/scheduler/metrics_test.go | 2 +- internal/scheduler/mocks/api.go | 159 +++++++++--------- .../scheduler/mocks/executor_repository.go | 40 +++-- internal/scheduler/mocks/grpc.go | 36 ++-- internal/scheduler/mocks/job_repository.go | 56 +++--- internal/scheduler/mocks/leases_getter.go | 91 +++++----- internal/scheduler/mocks/queue_cache.go | 16 +- internal/scheduler/publisher_test.go | 2 +- internal/scheduler/queue/queue_cache_test.go | 2 +- .../scheduling/scheduling_algo_test.go | 2 +- internal/scheduler/submitcheck_test.go | 2 +- internal/server/mocks/generate.go | 5 +- internal/server/mocks/mock_authorizer.go | 26 +-- internal/server/mocks/mock_deduplicator.go | 26 +-- internal/server/mocks/mock_repository.go | 80 +++++---- internal/server/queue/queue_cache_test.go | 2 +- internal/server/submit/submit_test.go | 8 +- tools.yaml | 2 +- 30 files changed, 449 insertions(+), 446 deletions(-) delete mode 100644 internal/common/mocks/controlplaneevents/mock_publisher.go delete mode 100644 internal/common/mocks/jobsetevents/mock_publisher.go create mode 100644 internal/common/mocks/mock_publisher.go diff --git a/go.mod b/go.mod index c01b5c50f49..7ee53d24406 100644 --- a/go.mod +++ b/go.mod @@ -71,7 +71,6 @@ require ( github.com/go-openapi/validate v0.22.6 github.com/go-playground/validator/v10 v10.15.4 github.com/gogo/status v1.1.1 - github.com/golang/mock v1.6.0 github.com/goreleaser/goreleaser v1.24.0 github.com/jackc/pgx/v5 v5.5.4 github.com/jessevdk/go-flags v1.5.0 @@ -83,6 +82,7 @@ require ( github.com/redis/go-redis/v9 v9.7.0 github.com/segmentio/fasthash v1.0.3 github.com/xitongsys/parquet-go v1.6.2 + go.uber.org/mock v0.5.0 golang.org/x/term v0.25.0 golang.org/x/time v0.5.0 google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 diff --git a/go.sum b/go.sum index f63c61de172..0b215ee5d93 100644 --- a/go.sum +++ b/go.sum @@ -202,8 +202,6 @@ github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -526,7 +524,6 @@ github.com/xlab/treeprint v1.1.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.3.7/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yuin/goldmark v1.5.4 h1:2uY/xC0roWy8IBEGLgB1ywIoEJFGmRrX21YQcvGZzjU= @@ -545,6 +542,8 @@ go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= @@ -592,7 +591,6 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= @@ -617,7 +615,6 @@ golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= @@ -636,7 +633,6 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= @@ -664,9 +660,7 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -728,7 +722,6 @@ golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapK golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/internal/common/mocks/controlplaneevents/mock_publisher.go b/internal/common/mocks/controlplaneevents/mock_publisher.go deleted file mode 100644 index 9b7e4fa41a5..00000000000 --- a/internal/common/mocks/controlplaneevents/mock_publisher.go +++ /dev/null @@ -1,67 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: github.com/armadaproject/armada/internal/common/pulsarutils/controlplaneevents (interfaces: Publisher) - -// Package controlplaneevents is a generated GoMock package. -package controlplaneevents - -import ( - reflect "reflect" - - armadacontext "github.com/armadaproject/armada/internal/common/armadacontext" - controlplaneevents "github.com/armadaproject/armada/pkg/controlplaneevents" - gomock "github.com/golang/mock/gomock" -) - -// MockPublisher is a mock of Publisher interface. -type MockPublisher struct { - ctrl *gomock.Controller - recorder *MockPublisherMockRecorder -} - -// MockPublisherMockRecorder is the mock recorder for MockPublisher. -type MockPublisherMockRecorder struct { - mock *MockPublisher -} - -// NewMockPublisher creates a new mock instance. -func NewMockPublisher(ctrl *gomock.Controller) *MockPublisher { - mock := &MockPublisher{ctrl: ctrl} - mock.recorder = &MockPublisherMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockPublisher) EXPECT() *MockPublisherMockRecorder { - return m.recorder -} - -// Close mocks base method. -func (m *MockPublisher) Close() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "Close") -} - -// Close indicates an expected call of Close. -func (mr *MockPublisherMockRecorder) Close() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockPublisher)(nil).Close)) -} - -// PublishMessages mocks base method. -func (m *MockPublisher) PublishMessages(arg0 *armadacontext.Context, arg1 ...*controlplaneevents.Event) error { - m.ctrl.T.Helper() - varargs := []interface{}{arg0} - for _, a := range arg1 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "PublishMessages", varargs...) - ret0, _ := ret[0].(error) - return ret0 -} - -// PublishMessages indicates an expected call of PublishMessages. -func (mr *MockPublisherMockRecorder) PublishMessages(arg0 interface{}, arg1 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0}, arg1...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PublishMessages", reflect.TypeOf((*MockPublisher)(nil).PublishMessages), varargs...) -} diff --git a/internal/common/mocks/generate.go b/internal/common/mocks/generate.go index 9f09f3ad54e..953b0532ffe 100644 --- a/internal/common/mocks/generate.go +++ b/internal/common/mocks/generate.go @@ -3,5 +3,4 @@ package mocks // Mock implementations used by tests //go:generate mockgen -destination=./mock_pulsar.go -package=mocks "github.com/apache/pulsar-client-go/pulsar" Client,Producer,Message //go:generate mockgen -destination=./mock_executorapi.go -package=mocks "github.com/armadaproject/armada/pkg/executorapi" ExecutorApiClient,ExecutorApi_LeaseJobRunsClient -//go:generate mockgen -destination=./controlplaneevents/mock_publisher.go -package=controlplaneevents "github.com/armadaproject/armada/internal/common/pulsarutils/controlplaneevents" Publisher -//go:generate mockgen -destination=./jobsetevents/mock_publisher.go -package=jobsetevents "github.com/armadaproject/armada/internal/common/pulsarutils/jobsetevents" Publisher +//go:generate mockgen -destination=./mock_publisher.go -package=mocks "github.com/armadaproject/armada/internal/common/pulsarutils" Publisher diff --git a/internal/common/mocks/jobsetevents/mock_publisher.go b/internal/common/mocks/jobsetevents/mock_publisher.go deleted file mode 100644 index 319ccb561a8..00000000000 --- a/internal/common/mocks/jobsetevents/mock_publisher.go +++ /dev/null @@ -1,67 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: github.com/armadaproject/armada/internal/common/pulsarutils/jobsetevents (interfaces: Publisher) - -// Package jobsetevents is a generated GoMock package. -package jobsetevents - -import ( - reflect "reflect" - - armadacontext "github.com/armadaproject/armada/internal/common/armadacontext" - armadaevents "github.com/armadaproject/armada/pkg/armadaevents" - gomock "github.com/golang/mock/gomock" -) - -// MockPublisher is a mock of Publisher interface. -type MockPublisher struct { - ctrl *gomock.Controller - recorder *MockPublisherMockRecorder -} - -// MockPublisherMockRecorder is the mock recorder for MockPublisher. -type MockPublisherMockRecorder struct { - mock *MockPublisher -} - -// NewMockPublisher creates a new mock instance. -func NewMockPublisher(ctrl *gomock.Controller) *MockPublisher { - mock := &MockPublisher{ctrl: ctrl} - mock.recorder = &MockPublisherMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockPublisher) EXPECT() *MockPublisherMockRecorder { - return m.recorder -} - -// Close mocks base method. -func (m *MockPublisher) Close() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "Close") -} - -// Close indicates an expected call of Close. -func (mr *MockPublisherMockRecorder) Close() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockPublisher)(nil).Close)) -} - -// PublishMessages mocks base method. -func (m *MockPublisher) PublishMessages(arg0 *armadacontext.Context, arg1 ...*armadaevents.EventSequence) error { - m.ctrl.T.Helper() - varargs := []interface{}{arg0} - for _, a := range arg1 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "PublishMessages", varargs...) - ret0, _ := ret[0].(error) - return ret0 -} - -// PublishMessages indicates an expected call of PublishMessages. -func (mr *MockPublisherMockRecorder) PublishMessages(arg0 interface{}, arg1 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0}, arg1...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PublishMessages", reflect.TypeOf((*MockPublisher)(nil).PublishMessages), varargs...) -} diff --git a/internal/common/mocks/mock_executorapi.go b/internal/common/mocks/mock_executorapi.go index 3d6081ead6d..b136f106371 100644 --- a/internal/common/mocks/mock_executorapi.go +++ b/internal/common/mocks/mock_executorapi.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/armadaproject/armada/pkg/executorapi (interfaces: ExecutorApiClient,ExecutorApi_LeaseJobRunsClient) +// +// Generated by this command: +// +// mockgen -destination=./mock_executorapi.go -package=mocks github.com/armadaproject/armada/pkg/executorapi ExecutorApiClient,ExecutorApi_LeaseJobRunsClient +// // Package mocks is a generated GoMock package. package mocks @@ -10,7 +15,7 @@ import ( executorapi "github.com/armadaproject/armada/pkg/executorapi" types "github.com/gogo/protobuf/types" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" grpc "google.golang.org/grpc" metadata "google.golang.org/grpc/metadata" ) @@ -19,6 +24,7 @@ import ( type MockExecutorApiClient struct { ctrl *gomock.Controller recorder *MockExecutorApiClientMockRecorder + isgomock struct{} } // MockExecutorApiClientMockRecorder is the mock recorder for MockExecutorApiClient. @@ -39,10 +45,10 @@ func (m *MockExecutorApiClient) EXPECT() *MockExecutorApiClientMockRecorder { } // LeaseJobRuns mocks base method. -func (m *MockExecutorApiClient) LeaseJobRuns(arg0 context.Context, arg1 ...grpc.CallOption) (executorapi.ExecutorApi_LeaseJobRunsClient, error) { +func (m *MockExecutorApiClient) LeaseJobRuns(ctx context.Context, opts ...grpc.CallOption) (executorapi.ExecutorApi_LeaseJobRunsClient, error) { m.ctrl.T.Helper() - varargs := []interface{}{arg0} - for _, a := range arg1 { + varargs := []any{ctx} + for _, a := range opts { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "LeaseJobRuns", varargs...) @@ -52,17 +58,17 @@ func (m *MockExecutorApiClient) LeaseJobRuns(arg0 context.Context, arg1 ...grpc. } // LeaseJobRuns indicates an expected call of LeaseJobRuns. -func (mr *MockExecutorApiClientMockRecorder) LeaseJobRuns(arg0 interface{}, arg1 ...interface{}) *gomock.Call { +func (mr *MockExecutorApiClientMockRecorder) LeaseJobRuns(ctx any, opts ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0}, arg1...) + varargs := append([]any{ctx}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LeaseJobRuns", reflect.TypeOf((*MockExecutorApiClient)(nil).LeaseJobRuns), varargs...) } // ReportEvents mocks base method. -func (m *MockExecutorApiClient) ReportEvents(arg0 context.Context, arg1 *executorapi.EventList, arg2 ...grpc.CallOption) (*types.Empty, error) { +func (m *MockExecutorApiClient) ReportEvents(ctx context.Context, in *executorapi.EventList, opts ...grpc.CallOption) (*types.Empty, error) { m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { + varargs := []any{ctx, in} + for _, a := range opts { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "ReportEvents", varargs...) @@ -72,9 +78,9 @@ func (m *MockExecutorApiClient) ReportEvents(arg0 context.Context, arg1 *executo } // ReportEvents indicates an expected call of ReportEvents. -func (mr *MockExecutorApiClientMockRecorder) ReportEvents(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { +func (mr *MockExecutorApiClientMockRecorder) ReportEvents(ctx, in any, opts ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) + varargs := append([]any{ctx, in}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReportEvents", reflect.TypeOf((*MockExecutorApiClient)(nil).ReportEvents), varargs...) } @@ -82,6 +88,7 @@ func (mr *MockExecutorApiClientMockRecorder) ReportEvents(arg0, arg1 interface{} type MockExecutorApi_LeaseJobRunsClient struct { ctrl *gomock.Controller recorder *MockExecutorApi_LeaseJobRunsClientMockRecorder + isgomock struct{} } // MockExecutorApi_LeaseJobRunsClientMockRecorder is the mock recorder for MockExecutorApi_LeaseJobRunsClient. @@ -160,17 +167,17 @@ func (mr *MockExecutorApi_LeaseJobRunsClientMockRecorder) Recv() *gomock.Call { } // RecvMsg mocks base method. -func (m *MockExecutorApi_LeaseJobRunsClient) RecvMsg(arg0 interface{}) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RecvMsg", arg0) +func (m_2 *MockExecutorApi_LeaseJobRunsClient) RecvMsg(m any) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "RecvMsg", m) ret0, _ := ret[0].(error) return ret0 } // RecvMsg indicates an expected call of RecvMsg. -func (mr *MockExecutorApi_LeaseJobRunsClientMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call { +func (mr *MockExecutorApi_LeaseJobRunsClientMockRecorder) RecvMsg(m any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockExecutorApi_LeaseJobRunsClient)(nil).RecvMsg), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockExecutorApi_LeaseJobRunsClient)(nil).RecvMsg), m) } // Send mocks base method. @@ -182,23 +189,23 @@ func (m *MockExecutorApi_LeaseJobRunsClient) Send(arg0 *executorapi.LeaseRequest } // Send indicates an expected call of Send. -func (mr *MockExecutorApi_LeaseJobRunsClientMockRecorder) Send(arg0 interface{}) *gomock.Call { +func (mr *MockExecutorApi_LeaseJobRunsClientMockRecorder) Send(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockExecutorApi_LeaseJobRunsClient)(nil).Send), arg0) } // SendMsg mocks base method. -func (m *MockExecutorApi_LeaseJobRunsClient) SendMsg(arg0 interface{}) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SendMsg", arg0) +func (m_2 *MockExecutorApi_LeaseJobRunsClient) SendMsg(m any) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "SendMsg", m) ret0, _ := ret[0].(error) return ret0 } // SendMsg indicates an expected call of SendMsg. -func (mr *MockExecutorApi_LeaseJobRunsClientMockRecorder) SendMsg(arg0 interface{}) *gomock.Call { +func (mr *MockExecutorApi_LeaseJobRunsClientMockRecorder) SendMsg(m any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockExecutorApi_LeaseJobRunsClient)(nil).SendMsg), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockExecutorApi_LeaseJobRunsClient)(nil).SendMsg), m) } // Trailer mocks base method. diff --git a/internal/common/mocks/mock_publisher.go b/internal/common/mocks/mock_publisher.go new file mode 100644 index 00000000000..4d17f29b723 --- /dev/null +++ b/internal/common/mocks/mock_publisher.go @@ -0,0 +1,73 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: github.com/armadaproject/armada/internal/common/pulsarutils (interfaces: Publisher) +// +// Generated by this command: +// +// mockgen -destination=./mock_publisher.go -package=mocks github.com/armadaproject/armada/internal/common/pulsarutils Publisher +// + +// Package mocks is a generated GoMock package. +package mocks + +import ( + reflect "reflect" + + armadacontext "github.com/armadaproject/armada/internal/common/armadacontext" + utils "github.com/armadaproject/armada/internal/common/ingest/utils" + gomock "go.uber.org/mock/gomock" +) + +// MockPublisher is a mock of Publisher interface. +type MockPublisher[T utils.ArmadaEvent] struct { + ctrl *gomock.Controller + recorder *MockPublisherMockRecorder[T] + isgomock struct{} +} + +// MockPublisherMockRecorder is the mock recorder for MockPublisher. +type MockPublisherMockRecorder[T utils.ArmadaEvent] struct { + mock *MockPublisher[T] +} + +// NewMockPublisher creates a new mock instance. +func NewMockPublisher[T utils.ArmadaEvent](ctrl *gomock.Controller) *MockPublisher[T] { + mock := &MockPublisher[T]{ctrl: ctrl} + mock.recorder = &MockPublisherMockRecorder[T]{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockPublisher[T]) EXPECT() *MockPublisherMockRecorder[T] { + return m.recorder +} + +// Close mocks base method. +func (m *MockPublisher[T]) Close() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "Close") +} + +// Close indicates an expected call of Close. +func (mr *MockPublisherMockRecorder[T]) Close() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockPublisher[T])(nil).Close)) +} + +// PublishMessages mocks base method. +func (m *MockPublisher[T]) PublishMessages(ctx *armadacontext.Context, events ...T) error { + m.ctrl.T.Helper() + varargs := []any{ctx} + for _, a := range events { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "PublishMessages", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// PublishMessages indicates an expected call of PublishMessages. +func (mr *MockPublisherMockRecorder[T]) PublishMessages(ctx any, events ...any) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]any{ctx}, events...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PublishMessages", reflect.TypeOf((*MockPublisher[T])(nil).PublishMessages), varargs...) +} diff --git a/internal/common/mocks/mock_pulsar.go b/internal/common/mocks/mock_pulsar.go index 50de787b91a..910d9d315b1 100644 --- a/internal/common/mocks/mock_pulsar.go +++ b/internal/common/mocks/mock_pulsar.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/apache/pulsar-client-go/pulsar (interfaces: Client,Producer,Message) +// +// Generated by this command: +// +// mockgen -destination=./mock_pulsar.go -package=mocks github.com/apache/pulsar-client-go/pulsar Client,Producer,Message +// // Package mocks is a generated GoMock package. package mocks @@ -10,13 +15,14 @@ import ( time "time" pulsar "github.com/apache/pulsar-client-go/pulsar" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockClient is a mock of Client interface. type MockClient struct { ctrl *gomock.Controller recorder *MockClientMockRecorder + isgomock struct{} } // MockClientMockRecorder is the mock recorder for MockClient. @@ -58,7 +64,7 @@ func (m *MockClient) CreateProducer(arg0 pulsar.ProducerOptions) (pulsar.Produce } // CreateProducer indicates an expected call of CreateProducer. -func (mr *MockClientMockRecorder) CreateProducer(arg0 interface{}) *gomock.Call { +func (mr *MockClientMockRecorder) CreateProducer(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateProducer", reflect.TypeOf((*MockClient)(nil).CreateProducer), arg0) } @@ -73,7 +79,7 @@ func (m *MockClient) CreateReader(arg0 pulsar.ReaderOptions) (pulsar.Reader, err } // CreateReader indicates an expected call of CreateReader. -func (mr *MockClientMockRecorder) CreateReader(arg0 interface{}) *gomock.Call { +func (mr *MockClientMockRecorder) CreateReader(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateReader", reflect.TypeOf((*MockClient)(nil).CreateReader), arg0) } @@ -88,24 +94,24 @@ func (m *MockClient) CreateTableView(arg0 pulsar.TableViewOptions) (pulsar.Table } // CreateTableView indicates an expected call of CreateTableView. -func (mr *MockClientMockRecorder) CreateTableView(arg0 interface{}) *gomock.Call { +func (mr *MockClientMockRecorder) CreateTableView(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTableView", reflect.TypeOf((*MockClient)(nil).CreateTableView), arg0) } // NewTransaction mocks base method. -func (m *MockClient) NewTransaction(arg0 time.Duration) (pulsar.Transaction, error) { +func (m *MockClient) NewTransaction(duration time.Duration) (pulsar.Transaction, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewTransaction", arg0) + ret := m.ctrl.Call(m, "NewTransaction", duration) ret0, _ := ret[0].(pulsar.Transaction) ret1, _ := ret[1].(error) return ret0, ret1 } // NewTransaction indicates an expected call of NewTransaction. -func (mr *MockClientMockRecorder) NewTransaction(arg0 interface{}) *gomock.Call { +func (mr *MockClientMockRecorder) NewTransaction(duration any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewTransaction", reflect.TypeOf((*MockClient)(nil).NewTransaction), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewTransaction", reflect.TypeOf((*MockClient)(nil).NewTransaction), duration) } // Subscribe mocks base method. @@ -118,30 +124,31 @@ func (m *MockClient) Subscribe(arg0 pulsar.ConsumerOptions) (pulsar.Consumer, er } // Subscribe indicates an expected call of Subscribe. -func (mr *MockClientMockRecorder) Subscribe(arg0 interface{}) *gomock.Call { +func (mr *MockClientMockRecorder) Subscribe(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Subscribe", reflect.TypeOf((*MockClient)(nil).Subscribe), arg0) } // TopicPartitions mocks base method. -func (m *MockClient) TopicPartitions(arg0 string) ([]string, error) { +func (m *MockClient) TopicPartitions(topic string) ([]string, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TopicPartitions", arg0) + ret := m.ctrl.Call(m, "TopicPartitions", topic) ret0, _ := ret[0].([]string) ret1, _ := ret[1].(error) return ret0, ret1 } // TopicPartitions indicates an expected call of TopicPartitions. -func (mr *MockClientMockRecorder) TopicPartitions(arg0 interface{}) *gomock.Call { +func (mr *MockClientMockRecorder) TopicPartitions(topic any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TopicPartitions", reflect.TypeOf((*MockClient)(nil).TopicPartitions), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TopicPartitions", reflect.TypeOf((*MockClient)(nil).TopicPartitions), topic) } // MockProducer is a mock of Producer interface. type MockProducer struct { ctrl *gomock.Controller recorder *MockProducerMockRecorder + isgomock struct{} } // MockProducerMockRecorder is the mock recorder for MockProducer. @@ -225,7 +232,7 @@ func (m *MockProducer) Send(arg0 context.Context, arg1 *pulsar.ProducerMessage) } // Send indicates an expected call of Send. -func (mr *MockProducerMockRecorder) Send(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockProducerMockRecorder) Send(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockProducer)(nil).Send), arg0, arg1) } @@ -237,7 +244,7 @@ func (m *MockProducer) SendAsync(arg0 context.Context, arg1 *pulsar.ProducerMess } // SendAsync indicates an expected call of SendAsync. -func (mr *MockProducerMockRecorder) SendAsync(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockProducerMockRecorder) SendAsync(arg0, arg1, arg2 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendAsync", reflect.TypeOf((*MockProducer)(nil).SendAsync), arg0, arg1, arg2) } @@ -260,6 +267,7 @@ func (mr *MockProducerMockRecorder) Topic() *gomock.Call { type MockMessage struct { ctrl *gomock.Controller recorder *MockMessageMockRecorder + isgomock struct{} } // MockMessageMockRecorder is the mock recorder for MockMessage. @@ -336,17 +344,17 @@ func (mr *MockMessageMockRecorder) GetReplicatedFrom() *gomock.Call { } // GetSchemaValue mocks base method. -func (m *MockMessage) GetSchemaValue(arg0 interface{}) error { +func (m *MockMessage) GetSchemaValue(v any) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetSchemaValue", arg0) + ret := m.ctrl.Call(m, "GetSchemaValue", v) ret0, _ := ret[0].(error) return ret0 } // GetSchemaValue indicates an expected call of GetSchemaValue. -func (mr *MockMessageMockRecorder) GetSchemaValue(arg0 interface{}) *gomock.Call { +func (mr *MockMessageMockRecorder) GetSchemaValue(v any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSchemaValue", reflect.TypeOf((*MockMessage)(nil).GetSchemaValue), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSchemaValue", reflect.TypeOf((*MockMessage)(nil).GetSchemaValue), v) } // ID mocks base method. diff --git a/internal/common/pulsarutils/publisher_test.go b/internal/common/pulsarutils/publisher_test.go index be438930a4f..c5deae6cb5f 100644 --- a/internal/common/pulsarutils/publisher_test.go +++ b/internal/common/pulsarutils/publisher_test.go @@ -8,10 +8,10 @@ import ( "github.com/apache/pulsar-client-go/pulsar" "github.com/gogo/protobuf/proto" - "github.com/golang/mock/gomock" "github.com/pkg/errors" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "github.com/armadaproject/armada/internal/common/armadacontext" "github.com/armadaproject/armada/internal/common/armadaerrors" diff --git a/internal/executor/service/lease_requester_test.go b/internal/executor/service/lease_requester_test.go index 42be14db476..f0175b69821 100644 --- a/internal/executor/service/lease_requester_test.go +++ b/internal/executor/service/lease_requester_test.go @@ -6,9 +6,9 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" "github.com/google/uuid" "github.com/stretchr/testify/assert" + "go.uber.org/mock/gomock" "k8s.io/apimachinery/pkg/api/resource" "github.com/armadaproject/armada/internal/common/armadacontext" diff --git a/internal/scheduler/api_test.go b/internal/scheduler/api_test.go index 913a950e08c..9094a48f55c 100644 --- a/internal/scheduler/api_test.go +++ b/internal/scheduler/api_test.go @@ -5,10 +5,10 @@ import ( "time" "github.com/gogo/protobuf/proto" - "github.com/golang/mock/gomock" "github.com/google/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" v1 "k8s.io/api/core/v1" @@ -18,7 +18,7 @@ import ( "github.com/armadaproject/armada/internal/common/armadaerrors" "github.com/armadaproject/armada/internal/common/auth/permission" "github.com/armadaproject/armada/internal/common/compress" - mocks "github.com/armadaproject/armada/internal/common/mocks/jobsetevents" + mocks "github.com/armadaproject/armada/internal/common/mocks" protoutil "github.com/armadaproject/armada/internal/common/proto" "github.com/armadaproject/armada/internal/common/slices" "github.com/armadaproject/armada/internal/common/types" @@ -306,7 +306,7 @@ func TestExecutorApi_LeaseJobRuns(t *testing.T) { t.Run(name, func(t *testing.T) { ctx, cancel := armadacontext.WithTimeout(armadacontext.Background(), 5*time.Second) ctrl := gomock.NewController(t) - mockPulsarPublisher := mocks.NewMockPublisher(ctrl) + mockPulsarPublisher := mocks.NewMockPublisher[*armadaevents.EventSequence](ctrl) mockJobRepository := schedulermocks.NewMockJobRepository(ctrl) mockExecutorRepository := schedulermocks.NewMockExecutorRepository(ctrl) mockStream := schedulermocks.NewMockExecutorApi_LeaseJobRunsServer(ctrl) @@ -373,7 +373,7 @@ func TestExecutorApi_LeaseJobRuns_Unauthorised(t *testing.T) { ctx, cancel := armadacontext.WithTimeout(armadacontext.Background(), 5*time.Second) defer cancel() ctrl := gomock.NewController(t) - mockPulsarPublisher := mocks.NewMockPublisher(ctrl) + mockPulsarPublisher := mocks.NewMockPublisher[*armadaevents.EventSequence](ctrl) mockJobRepository := schedulermocks.NewMockJobRepository(ctrl) mockExecutorRepository := schedulermocks.NewMockExecutorRepository(ctrl) mockStream := schedulermocks.NewMockExecutorApi_LeaseJobRunsServer(ctrl) @@ -501,7 +501,7 @@ func TestExecutorApi_Publish(t *testing.T) { t.Run(name, func(t *testing.T) { ctx, cancel := armadacontext.WithTimeout(armadacontext.Background(), 5*time.Second) ctrl := gomock.NewController(t) - mockPulsarPublisher := mocks.NewMockPublisher(ctrl) + mockPulsarPublisher := mocks.NewMockPublisher[*armadaevents.EventSequence](ctrl) mockJobRepository := schedulermocks.NewMockJobRepository(ctrl) mockExecutorRepository := schedulermocks.NewMockExecutorRepository(ctrl) mockAuthorizer := mocks2.NewMockActionAuthorizer(ctrl) @@ -546,7 +546,7 @@ func TestExecutorApi_Publish_Unauthorised(t *testing.T) { ctx, cancel := armadacontext.WithTimeout(armadacontext.Background(), 5*time.Second) defer cancel() ctrl := gomock.NewController(t) - mockPulsarPublisher := mocks.NewMockPublisher(ctrl) + mockPulsarPublisher := mocks.NewMockPublisher[*armadaevents.EventSequence](ctrl) mockJobRepository := schedulermocks.NewMockJobRepository(ctrl) mockExecutorRepository := schedulermocks.NewMockExecutorRepository(ctrl) mockAuthorizer := mocks2.NewMockActionAuthorizer(ctrl) diff --git a/internal/scheduler/leader/leader_test.go b/internal/scheduler/leader/leader_test.go index f5f65d40c0a..ba02e9dcc67 100644 --- a/internal/scheduler/leader/leader_test.go +++ b/internal/scheduler/leader/leader_test.go @@ -6,9 +6,9 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" v1 "k8s.io/api/coordination/v1" "k8s.io/utils/pointer" diff --git a/internal/scheduler/metrics_test.go b/internal/scheduler/metrics_test.go index c2f7d77c117..b67c29598ab 100644 --- a/internal/scheduler/metrics_test.go +++ b/internal/scheduler/metrics_test.go @@ -4,11 +4,11 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" "github.com/google/uuid" "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "k8s.io/apimachinery/pkg/api/resource" clock "k8s.io/utils/clock/testing" diff --git a/internal/scheduler/mocks/api.go b/internal/scheduler/mocks/api.go index 7b846a53c83..1e1ec8d5192 100644 --- a/internal/scheduler/mocks/api.go +++ b/internal/scheduler/mocks/api.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/armadaproject/armada/pkg/api (interfaces: SubmitClient,Submit_GetQueuesClient) +// +// Generated by this command: +// +// mockgen -destination=./api.go -package=schedulermocks github.com/armadaproject/armada/pkg/api SubmitClient,Submit_GetQueuesClient +// // Package schedulermocks is a generated GoMock package. package schedulermocks @@ -10,7 +15,7 @@ import ( api "github.com/armadaproject/armada/pkg/api" types "github.com/gogo/protobuf/types" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" grpc "google.golang.org/grpc" metadata "google.golang.org/grpc/metadata" ) @@ -19,6 +24,7 @@ import ( type MockSubmitClient struct { ctrl *gomock.Controller recorder *MockSubmitClientMockRecorder + isgomock struct{} } // MockSubmitClientMockRecorder is the mock recorder for MockSubmitClient. @@ -39,10 +45,10 @@ func (m *MockSubmitClient) EXPECT() *MockSubmitClientMockRecorder { } // CancelJobSet mocks base method. -func (m *MockSubmitClient) CancelJobSet(arg0 context.Context, arg1 *api.JobSetCancelRequest, arg2 ...grpc.CallOption) (*types.Empty, error) { +func (m *MockSubmitClient) CancelJobSet(ctx context.Context, in *api.JobSetCancelRequest, opts ...grpc.CallOption) (*types.Empty, error) { m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { + varargs := []any{ctx, in} + for _, a := range opts { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "CancelJobSet", varargs...) @@ -52,17 +58,17 @@ func (m *MockSubmitClient) CancelJobSet(arg0 context.Context, arg1 *api.JobSetCa } // CancelJobSet indicates an expected call of CancelJobSet. -func (mr *MockSubmitClientMockRecorder) CancelJobSet(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { +func (mr *MockSubmitClientMockRecorder) CancelJobSet(ctx, in any, opts ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) + varargs := append([]any{ctx, in}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CancelJobSet", reflect.TypeOf((*MockSubmitClient)(nil).CancelJobSet), varargs...) } // CancelJobs mocks base method. -func (m *MockSubmitClient) CancelJobs(arg0 context.Context, arg1 *api.JobCancelRequest, arg2 ...grpc.CallOption) (*api.CancellationResult, error) { +func (m *MockSubmitClient) CancelJobs(ctx context.Context, in *api.JobCancelRequest, opts ...grpc.CallOption) (*api.CancellationResult, error) { m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { + varargs := []any{ctx, in} + for _, a := range opts { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "CancelJobs", varargs...) @@ -72,17 +78,17 @@ func (m *MockSubmitClient) CancelJobs(arg0 context.Context, arg1 *api.JobCancelR } // CancelJobs indicates an expected call of CancelJobs. -func (mr *MockSubmitClientMockRecorder) CancelJobs(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { +func (mr *MockSubmitClientMockRecorder) CancelJobs(ctx, in any, opts ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) + varargs := append([]any{ctx, in}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CancelJobs", reflect.TypeOf((*MockSubmitClient)(nil).CancelJobs), varargs...) } // CreateQueue mocks base method. -func (m *MockSubmitClient) CreateQueue(arg0 context.Context, arg1 *api.Queue, arg2 ...grpc.CallOption) (*types.Empty, error) { +func (m *MockSubmitClient) CreateQueue(ctx context.Context, in *api.Queue, opts ...grpc.CallOption) (*types.Empty, error) { m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { + varargs := []any{ctx, in} + for _, a := range opts { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "CreateQueue", varargs...) @@ -92,17 +98,17 @@ func (m *MockSubmitClient) CreateQueue(arg0 context.Context, arg1 *api.Queue, ar } // CreateQueue indicates an expected call of CreateQueue. -func (mr *MockSubmitClientMockRecorder) CreateQueue(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { +func (mr *MockSubmitClientMockRecorder) CreateQueue(ctx, in any, opts ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) + varargs := append([]any{ctx, in}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateQueue", reflect.TypeOf((*MockSubmitClient)(nil).CreateQueue), varargs...) } // CreateQueues mocks base method. -func (m *MockSubmitClient) CreateQueues(arg0 context.Context, arg1 *api.QueueList, arg2 ...grpc.CallOption) (*api.BatchQueueCreateResponse, error) { +func (m *MockSubmitClient) CreateQueues(ctx context.Context, in *api.QueueList, opts ...grpc.CallOption) (*api.BatchQueueCreateResponse, error) { m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { + varargs := []any{ctx, in} + for _, a := range opts { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "CreateQueues", varargs...) @@ -112,17 +118,17 @@ func (m *MockSubmitClient) CreateQueues(arg0 context.Context, arg1 *api.QueueLis } // CreateQueues indicates an expected call of CreateQueues. -func (mr *MockSubmitClientMockRecorder) CreateQueues(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { +func (mr *MockSubmitClientMockRecorder) CreateQueues(ctx, in any, opts ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) + varargs := append([]any{ctx, in}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateQueues", reflect.TypeOf((*MockSubmitClient)(nil).CreateQueues), varargs...) } // DeleteQueue mocks base method. -func (m *MockSubmitClient) DeleteQueue(arg0 context.Context, arg1 *api.QueueDeleteRequest, arg2 ...grpc.CallOption) (*types.Empty, error) { +func (m *MockSubmitClient) DeleteQueue(ctx context.Context, in *api.QueueDeleteRequest, opts ...grpc.CallOption) (*types.Empty, error) { m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { + varargs := []any{ctx, in} + for _, a := range opts { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "DeleteQueue", varargs...) @@ -132,17 +138,17 @@ func (m *MockSubmitClient) DeleteQueue(arg0 context.Context, arg1 *api.QueueDele } // DeleteQueue indicates an expected call of DeleteQueue. -func (mr *MockSubmitClientMockRecorder) DeleteQueue(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { +func (mr *MockSubmitClientMockRecorder) DeleteQueue(ctx, in any, opts ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) + varargs := append([]any{ctx, in}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteQueue", reflect.TypeOf((*MockSubmitClient)(nil).DeleteQueue), varargs...) } // GetQueue mocks base method. -func (m *MockSubmitClient) GetQueue(arg0 context.Context, arg1 *api.QueueGetRequest, arg2 ...grpc.CallOption) (*api.Queue, error) { +func (m *MockSubmitClient) GetQueue(ctx context.Context, in *api.QueueGetRequest, opts ...grpc.CallOption) (*api.Queue, error) { m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { + varargs := []any{ctx, in} + for _, a := range opts { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetQueue", varargs...) @@ -152,17 +158,17 @@ func (m *MockSubmitClient) GetQueue(arg0 context.Context, arg1 *api.QueueGetRequ } // GetQueue indicates an expected call of GetQueue. -func (mr *MockSubmitClientMockRecorder) GetQueue(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { +func (mr *MockSubmitClientMockRecorder) GetQueue(ctx, in any, opts ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) + varargs := append([]any{ctx, in}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetQueue", reflect.TypeOf((*MockSubmitClient)(nil).GetQueue), varargs...) } // GetQueues mocks base method. -func (m *MockSubmitClient) GetQueues(arg0 context.Context, arg1 *api.StreamingQueueGetRequest, arg2 ...grpc.CallOption) (api.Submit_GetQueuesClient, error) { +func (m *MockSubmitClient) GetQueues(ctx context.Context, in *api.StreamingQueueGetRequest, opts ...grpc.CallOption) (api.Submit_GetQueuesClient, error) { m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { + varargs := []any{ctx, in} + for _, a := range opts { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetQueues", varargs...) @@ -172,17 +178,17 @@ func (m *MockSubmitClient) GetQueues(arg0 context.Context, arg1 *api.StreamingQu } // GetQueues indicates an expected call of GetQueues. -func (mr *MockSubmitClientMockRecorder) GetQueues(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { +func (mr *MockSubmitClientMockRecorder) GetQueues(ctx, in any, opts ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) + varargs := append([]any{ctx, in}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetQueues", reflect.TypeOf((*MockSubmitClient)(nil).GetQueues), varargs...) } // Health mocks base method. -func (m *MockSubmitClient) Health(arg0 context.Context, arg1 *types.Empty, arg2 ...grpc.CallOption) (*api.HealthCheckResponse, error) { +func (m *MockSubmitClient) Health(ctx context.Context, in *types.Empty, opts ...grpc.CallOption) (*api.HealthCheckResponse, error) { m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { + varargs := []any{ctx, in} + for _, a := range opts { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "Health", varargs...) @@ -192,17 +198,17 @@ func (m *MockSubmitClient) Health(arg0 context.Context, arg1 *types.Empty, arg2 } // Health indicates an expected call of Health. -func (mr *MockSubmitClientMockRecorder) Health(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { +func (mr *MockSubmitClientMockRecorder) Health(ctx, in any, opts ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) + varargs := append([]any{ctx, in}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Health", reflect.TypeOf((*MockSubmitClient)(nil).Health), varargs...) } // PreemptJobs mocks base method. -func (m *MockSubmitClient) PreemptJobs(arg0 context.Context, arg1 *api.JobPreemptRequest, arg2 ...grpc.CallOption) (*types.Empty, error) { +func (m *MockSubmitClient) PreemptJobs(ctx context.Context, in *api.JobPreemptRequest, opts ...grpc.CallOption) (*types.Empty, error) { m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { + varargs := []any{ctx, in} + for _, a := range opts { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "PreemptJobs", varargs...) @@ -212,17 +218,17 @@ func (m *MockSubmitClient) PreemptJobs(arg0 context.Context, arg1 *api.JobPreemp } // PreemptJobs indicates an expected call of PreemptJobs. -func (mr *MockSubmitClientMockRecorder) PreemptJobs(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { +func (mr *MockSubmitClientMockRecorder) PreemptJobs(ctx, in any, opts ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) + varargs := append([]any{ctx, in}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PreemptJobs", reflect.TypeOf((*MockSubmitClient)(nil).PreemptJobs), varargs...) } // ReprioritizeJobs mocks base method. -func (m *MockSubmitClient) ReprioritizeJobs(arg0 context.Context, arg1 *api.JobReprioritizeRequest, arg2 ...grpc.CallOption) (*api.JobReprioritizeResponse, error) { +func (m *MockSubmitClient) ReprioritizeJobs(ctx context.Context, in *api.JobReprioritizeRequest, opts ...grpc.CallOption) (*api.JobReprioritizeResponse, error) { m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { + varargs := []any{ctx, in} + for _, a := range opts { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "ReprioritizeJobs", varargs...) @@ -232,17 +238,17 @@ func (m *MockSubmitClient) ReprioritizeJobs(arg0 context.Context, arg1 *api.JobR } // ReprioritizeJobs indicates an expected call of ReprioritizeJobs. -func (mr *MockSubmitClientMockRecorder) ReprioritizeJobs(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { +func (mr *MockSubmitClientMockRecorder) ReprioritizeJobs(ctx, in any, opts ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) + varargs := append([]any{ctx, in}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReprioritizeJobs", reflect.TypeOf((*MockSubmitClient)(nil).ReprioritizeJobs), varargs...) } // SubmitJobs mocks base method. -func (m *MockSubmitClient) SubmitJobs(arg0 context.Context, arg1 *api.JobSubmitRequest, arg2 ...grpc.CallOption) (*api.JobSubmitResponse, error) { +func (m *MockSubmitClient) SubmitJobs(ctx context.Context, in *api.JobSubmitRequest, opts ...grpc.CallOption) (*api.JobSubmitResponse, error) { m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { + varargs := []any{ctx, in} + for _, a := range opts { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "SubmitJobs", varargs...) @@ -252,17 +258,17 @@ func (m *MockSubmitClient) SubmitJobs(arg0 context.Context, arg1 *api.JobSubmitR } // SubmitJobs indicates an expected call of SubmitJobs. -func (mr *MockSubmitClientMockRecorder) SubmitJobs(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { +func (mr *MockSubmitClientMockRecorder) SubmitJobs(ctx, in any, opts ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) + varargs := append([]any{ctx, in}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubmitJobs", reflect.TypeOf((*MockSubmitClient)(nil).SubmitJobs), varargs...) } // UpdateQueue mocks base method. -func (m *MockSubmitClient) UpdateQueue(arg0 context.Context, arg1 *api.Queue, arg2 ...grpc.CallOption) (*types.Empty, error) { +func (m *MockSubmitClient) UpdateQueue(ctx context.Context, in *api.Queue, opts ...grpc.CallOption) (*types.Empty, error) { m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { + varargs := []any{ctx, in} + for _, a := range opts { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "UpdateQueue", varargs...) @@ -272,17 +278,17 @@ func (m *MockSubmitClient) UpdateQueue(arg0 context.Context, arg1 *api.Queue, ar } // UpdateQueue indicates an expected call of UpdateQueue. -func (mr *MockSubmitClientMockRecorder) UpdateQueue(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { +func (mr *MockSubmitClientMockRecorder) UpdateQueue(ctx, in any, opts ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) + varargs := append([]any{ctx, in}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateQueue", reflect.TypeOf((*MockSubmitClient)(nil).UpdateQueue), varargs...) } // UpdateQueues mocks base method. -func (m *MockSubmitClient) UpdateQueues(arg0 context.Context, arg1 *api.QueueList, arg2 ...grpc.CallOption) (*api.BatchQueueUpdateResponse, error) { +func (m *MockSubmitClient) UpdateQueues(ctx context.Context, in *api.QueueList, opts ...grpc.CallOption) (*api.BatchQueueUpdateResponse, error) { m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { + varargs := []any{ctx, in} + for _, a := range opts { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "UpdateQueues", varargs...) @@ -292,9 +298,9 @@ func (m *MockSubmitClient) UpdateQueues(arg0 context.Context, arg1 *api.QueueLis } // UpdateQueues indicates an expected call of UpdateQueues. -func (mr *MockSubmitClientMockRecorder) UpdateQueues(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { +func (mr *MockSubmitClientMockRecorder) UpdateQueues(ctx, in any, opts ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) + varargs := append([]any{ctx, in}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateQueues", reflect.TypeOf((*MockSubmitClient)(nil).UpdateQueues), varargs...) } @@ -302,6 +308,7 @@ func (mr *MockSubmitClientMockRecorder) UpdateQueues(arg0, arg1 interface{}, arg type MockSubmit_GetQueuesClient struct { ctrl *gomock.Controller recorder *MockSubmit_GetQueuesClientMockRecorder + isgomock struct{} } // MockSubmit_GetQueuesClientMockRecorder is the mock recorder for MockSubmit_GetQueuesClient. @@ -380,31 +387,31 @@ func (mr *MockSubmit_GetQueuesClientMockRecorder) Recv() *gomock.Call { } // RecvMsg mocks base method. -func (m *MockSubmit_GetQueuesClient) RecvMsg(arg0 interface{}) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RecvMsg", arg0) +func (m_2 *MockSubmit_GetQueuesClient) RecvMsg(m any) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "RecvMsg", m) ret0, _ := ret[0].(error) return ret0 } // RecvMsg indicates an expected call of RecvMsg. -func (mr *MockSubmit_GetQueuesClientMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call { +func (mr *MockSubmit_GetQueuesClientMockRecorder) RecvMsg(m any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockSubmit_GetQueuesClient)(nil).RecvMsg), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockSubmit_GetQueuesClient)(nil).RecvMsg), m) } // SendMsg mocks base method. -func (m *MockSubmit_GetQueuesClient) SendMsg(arg0 interface{}) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SendMsg", arg0) +func (m_2 *MockSubmit_GetQueuesClient) SendMsg(m any) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "SendMsg", m) ret0, _ := ret[0].(error) return ret0 } // SendMsg indicates an expected call of SendMsg. -func (mr *MockSubmit_GetQueuesClientMockRecorder) SendMsg(arg0 interface{}) *gomock.Call { +func (mr *MockSubmit_GetQueuesClientMockRecorder) SendMsg(m any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockSubmit_GetQueuesClient)(nil).SendMsg), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockSubmit_GetQueuesClient)(nil).SendMsg), m) } // Trailer mocks base method. diff --git a/internal/scheduler/mocks/executor_repository.go b/internal/scheduler/mocks/executor_repository.go index b780c1dbe0c..f7022a24c4f 100644 --- a/internal/scheduler/mocks/executor_repository.go +++ b/internal/scheduler/mocks/executor_repository.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/armadaproject/armada/internal/scheduler/database (interfaces: ExecutorRepository) +// +// Generated by this command: +// +// mockgen -destination=./executor_repository.go -package=schedulermocks github.com/armadaproject/armada/internal/scheduler/database ExecutorRepository +// // Package schedulermocks is a generated GoMock package. package schedulermocks @@ -10,13 +15,14 @@ import ( armadacontext "github.com/armadaproject/armada/internal/common/armadacontext" schedulerobjects "github.com/armadaproject/armada/internal/scheduler/schedulerobjects" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockExecutorRepository is a mock of ExecutorRepository interface. type MockExecutorRepository struct { ctrl *gomock.Controller recorder *MockExecutorRepositoryMockRecorder + isgomock struct{} } // MockExecutorRepositoryMockRecorder is the mock recorder for MockExecutorRepository. @@ -37,60 +43,60 @@ func (m *MockExecutorRepository) EXPECT() *MockExecutorRepositoryMockRecorder { } // GetExecutorSettings mocks base method. -func (m *MockExecutorRepository) GetExecutorSettings(arg0 *armadacontext.Context) ([]*schedulerobjects.ExecutorSettings, error) { +func (m *MockExecutorRepository) GetExecutorSettings(ctx *armadacontext.Context) ([]*schedulerobjects.ExecutorSettings, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetExecutorSettings", arg0) + ret := m.ctrl.Call(m, "GetExecutorSettings", ctx) ret0, _ := ret[0].([]*schedulerobjects.ExecutorSettings) ret1, _ := ret[1].(error) return ret0, ret1 } // GetExecutorSettings indicates an expected call of GetExecutorSettings. -func (mr *MockExecutorRepositoryMockRecorder) GetExecutorSettings(arg0 interface{}) *gomock.Call { +func (mr *MockExecutorRepositoryMockRecorder) GetExecutorSettings(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetExecutorSettings", reflect.TypeOf((*MockExecutorRepository)(nil).GetExecutorSettings), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetExecutorSettings", reflect.TypeOf((*MockExecutorRepository)(nil).GetExecutorSettings), ctx) } // GetExecutors mocks base method. -func (m *MockExecutorRepository) GetExecutors(arg0 *armadacontext.Context) ([]*schedulerobjects.Executor, error) { +func (m *MockExecutorRepository) GetExecutors(ctx *armadacontext.Context) ([]*schedulerobjects.Executor, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetExecutors", arg0) + ret := m.ctrl.Call(m, "GetExecutors", ctx) ret0, _ := ret[0].([]*schedulerobjects.Executor) ret1, _ := ret[1].(error) return ret0, ret1 } // GetExecutors indicates an expected call of GetExecutors. -func (mr *MockExecutorRepositoryMockRecorder) GetExecutors(arg0 interface{}) *gomock.Call { +func (mr *MockExecutorRepositoryMockRecorder) GetExecutors(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetExecutors", reflect.TypeOf((*MockExecutorRepository)(nil).GetExecutors), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetExecutors", reflect.TypeOf((*MockExecutorRepository)(nil).GetExecutors), ctx) } // GetLastUpdateTimes mocks base method. -func (m *MockExecutorRepository) GetLastUpdateTimes(arg0 *armadacontext.Context) (map[string]time.Time, error) { +func (m *MockExecutorRepository) GetLastUpdateTimes(ctx *armadacontext.Context) (map[string]time.Time, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetLastUpdateTimes", arg0) + ret := m.ctrl.Call(m, "GetLastUpdateTimes", ctx) ret0, _ := ret[0].(map[string]time.Time) ret1, _ := ret[1].(error) return ret0, ret1 } // GetLastUpdateTimes indicates an expected call of GetLastUpdateTimes. -func (mr *MockExecutorRepositoryMockRecorder) GetLastUpdateTimes(arg0 interface{}) *gomock.Call { +func (mr *MockExecutorRepositoryMockRecorder) GetLastUpdateTimes(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLastUpdateTimes", reflect.TypeOf((*MockExecutorRepository)(nil).GetLastUpdateTimes), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLastUpdateTimes", reflect.TypeOf((*MockExecutorRepository)(nil).GetLastUpdateTimes), ctx) } // StoreExecutor mocks base method. -func (m *MockExecutorRepository) StoreExecutor(arg0 *armadacontext.Context, arg1 *schedulerobjects.Executor) error { +func (m *MockExecutorRepository) StoreExecutor(ctx *armadacontext.Context, executor *schedulerobjects.Executor) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "StoreExecutor", arg0, arg1) + ret := m.ctrl.Call(m, "StoreExecutor", ctx, executor) ret0, _ := ret[0].(error) return ret0 } // StoreExecutor indicates an expected call of StoreExecutor. -func (mr *MockExecutorRepositoryMockRecorder) StoreExecutor(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockExecutorRepositoryMockRecorder) StoreExecutor(ctx, executor any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StoreExecutor", reflect.TypeOf((*MockExecutorRepository)(nil).StoreExecutor), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StoreExecutor", reflect.TypeOf((*MockExecutorRepository)(nil).StoreExecutor), ctx, executor) } diff --git a/internal/scheduler/mocks/grpc.go b/internal/scheduler/mocks/grpc.go index 618f4b7debe..0fd7e6881c2 100644 --- a/internal/scheduler/mocks/grpc.go +++ b/internal/scheduler/mocks/grpc.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/armadaproject/armada/pkg/executorapi (interfaces: ExecutorApi_LeaseJobRunsServer) +// +// Generated by this command: +// +// mockgen -destination=./grpc.go -package=schedulermocks github.com/armadaproject/armada/pkg/executorapi ExecutorApi_LeaseJobRunsServer +// // Package schedulermocks is a generated GoMock package. package schedulermocks @@ -9,7 +14,7 @@ import ( reflect "reflect" executorapi "github.com/armadaproject/armada/pkg/executorapi" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" metadata "google.golang.org/grpc/metadata" ) @@ -17,6 +22,7 @@ import ( type MockExecutorApi_LeaseJobRunsServer struct { ctrl *gomock.Controller recorder *MockExecutorApi_LeaseJobRunsServerMockRecorder + isgomock struct{} } // MockExecutorApi_LeaseJobRunsServerMockRecorder is the mock recorder for MockExecutorApi_LeaseJobRunsServer. @@ -66,17 +72,17 @@ func (mr *MockExecutorApi_LeaseJobRunsServerMockRecorder) Recv() *gomock.Call { } // RecvMsg mocks base method. -func (m *MockExecutorApi_LeaseJobRunsServer) RecvMsg(arg0 interface{}) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RecvMsg", arg0) +func (m_2 *MockExecutorApi_LeaseJobRunsServer) RecvMsg(m any) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "RecvMsg", m) ret0, _ := ret[0].(error) return ret0 } // RecvMsg indicates an expected call of RecvMsg. -func (mr *MockExecutorApi_LeaseJobRunsServerMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call { +func (mr *MockExecutorApi_LeaseJobRunsServerMockRecorder) RecvMsg(m any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockExecutorApi_LeaseJobRunsServer)(nil).RecvMsg), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockExecutorApi_LeaseJobRunsServer)(nil).RecvMsg), m) } // Send mocks base method. @@ -88,7 +94,7 @@ func (m *MockExecutorApi_LeaseJobRunsServer) Send(arg0 *executorapi.LeaseStreamM } // Send indicates an expected call of Send. -func (mr *MockExecutorApi_LeaseJobRunsServerMockRecorder) Send(arg0 interface{}) *gomock.Call { +func (mr *MockExecutorApi_LeaseJobRunsServerMockRecorder) Send(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockExecutorApi_LeaseJobRunsServer)(nil).Send), arg0) } @@ -102,23 +108,23 @@ func (m *MockExecutorApi_LeaseJobRunsServer) SendHeader(arg0 metadata.MD) error } // SendHeader indicates an expected call of SendHeader. -func (mr *MockExecutorApi_LeaseJobRunsServerMockRecorder) SendHeader(arg0 interface{}) *gomock.Call { +func (mr *MockExecutorApi_LeaseJobRunsServerMockRecorder) SendHeader(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendHeader", reflect.TypeOf((*MockExecutorApi_LeaseJobRunsServer)(nil).SendHeader), arg0) } // SendMsg mocks base method. -func (m *MockExecutorApi_LeaseJobRunsServer) SendMsg(arg0 interface{}) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SendMsg", arg0) +func (m_2 *MockExecutorApi_LeaseJobRunsServer) SendMsg(m any) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "SendMsg", m) ret0, _ := ret[0].(error) return ret0 } // SendMsg indicates an expected call of SendMsg. -func (mr *MockExecutorApi_LeaseJobRunsServerMockRecorder) SendMsg(arg0 interface{}) *gomock.Call { +func (mr *MockExecutorApi_LeaseJobRunsServerMockRecorder) SendMsg(m any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockExecutorApi_LeaseJobRunsServer)(nil).SendMsg), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockExecutorApi_LeaseJobRunsServer)(nil).SendMsg), m) } // SetHeader mocks base method. @@ -130,7 +136,7 @@ func (m *MockExecutorApi_LeaseJobRunsServer) SetHeader(arg0 metadata.MD) error { } // SetHeader indicates an expected call of SetHeader. -func (mr *MockExecutorApi_LeaseJobRunsServerMockRecorder) SetHeader(arg0 interface{}) *gomock.Call { +func (mr *MockExecutorApi_LeaseJobRunsServerMockRecorder) SetHeader(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetHeader", reflect.TypeOf((*MockExecutorApi_LeaseJobRunsServer)(nil).SetHeader), arg0) } @@ -142,7 +148,7 @@ func (m *MockExecutorApi_LeaseJobRunsServer) SetTrailer(arg0 metadata.MD) { } // SetTrailer indicates an expected call of SetTrailer. -func (mr *MockExecutorApi_LeaseJobRunsServerMockRecorder) SetTrailer(arg0 interface{}) *gomock.Call { +func (mr *MockExecutorApi_LeaseJobRunsServerMockRecorder) SetTrailer(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTrailer", reflect.TypeOf((*MockExecutorApi_LeaseJobRunsServer)(nil).SetTrailer), arg0) } diff --git a/internal/scheduler/mocks/job_repository.go b/internal/scheduler/mocks/job_repository.go index 21dba092880..0b5a18d2489 100644 --- a/internal/scheduler/mocks/job_repository.go +++ b/internal/scheduler/mocks/job_repository.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/armadaproject/armada/internal/scheduler/database (interfaces: JobRepository) +// +// Generated by this command: +// +// mockgen -destination=./job_repository.go -package=schedulermocks github.com/armadaproject/armada/internal/scheduler/database JobRepository +// // Package schedulermocks is a generated GoMock package. package schedulermocks @@ -10,14 +15,15 @@ import ( armadacontext "github.com/armadaproject/armada/internal/common/armadacontext" database "github.com/armadaproject/armada/internal/scheduler/database" armadaevents "github.com/armadaproject/armada/pkg/armadaevents" - gomock "github.com/golang/mock/gomock" uuid "github.com/google/uuid" + gomock "go.uber.org/mock/gomock" ) // MockJobRepository is a mock of JobRepository interface. type MockJobRepository struct { ctrl *gomock.Controller recorder *MockJobRepositoryMockRecorder + isgomock struct{} } // MockJobRepositoryMockRecorder is the mock recorder for MockJobRepository. @@ -38,24 +44,24 @@ func (m *MockJobRepository) EXPECT() *MockJobRepositoryMockRecorder { } // CountReceivedPartitions mocks base method. -func (m *MockJobRepository) CountReceivedPartitions(arg0 *armadacontext.Context, arg1 uuid.UUID) (uint32, error) { +func (m *MockJobRepository) CountReceivedPartitions(ctx *armadacontext.Context, groupId uuid.UUID) (uint32, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CountReceivedPartitions", arg0, arg1) + ret := m.ctrl.Call(m, "CountReceivedPartitions", ctx, groupId) ret0, _ := ret[0].(uint32) ret1, _ := ret[1].(error) return ret0, ret1 } // CountReceivedPartitions indicates an expected call of CountReceivedPartitions. -func (mr *MockJobRepositoryMockRecorder) CountReceivedPartitions(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockJobRepositoryMockRecorder) CountReceivedPartitions(ctx, groupId any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CountReceivedPartitions", reflect.TypeOf((*MockJobRepository)(nil).CountReceivedPartitions), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CountReceivedPartitions", reflect.TypeOf((*MockJobRepository)(nil).CountReceivedPartitions), ctx, groupId) } // FetchInitialJobs mocks base method. -func (m *MockJobRepository) FetchInitialJobs(arg0 *armadacontext.Context) ([]database.Job, []database.Run, error) { +func (m *MockJobRepository) FetchInitialJobs(ctx *armadacontext.Context) ([]database.Job, []database.Run, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "FetchInitialJobs", arg0) + ret := m.ctrl.Call(m, "FetchInitialJobs", ctx) ret0, _ := ret[0].([]database.Job) ret1, _ := ret[1].([]database.Run) ret2, _ := ret[2].(error) @@ -63,45 +69,45 @@ func (m *MockJobRepository) FetchInitialJobs(arg0 *armadacontext.Context) ([]dat } // FetchInitialJobs indicates an expected call of FetchInitialJobs. -func (mr *MockJobRepositoryMockRecorder) FetchInitialJobs(arg0 interface{}) *gomock.Call { +func (mr *MockJobRepositoryMockRecorder) FetchInitialJobs(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FetchInitialJobs", reflect.TypeOf((*MockJobRepository)(nil).FetchInitialJobs), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FetchInitialJobs", reflect.TypeOf((*MockJobRepository)(nil).FetchInitialJobs), ctx) } // FetchJobRunErrors mocks base method. -func (m *MockJobRepository) FetchJobRunErrors(arg0 *armadacontext.Context, arg1 []string) (map[string]*armadaevents.Error, error) { +func (m *MockJobRepository) FetchJobRunErrors(ctx *armadacontext.Context, runIds []string) (map[string]*armadaevents.Error, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "FetchJobRunErrors", arg0, arg1) + ret := m.ctrl.Call(m, "FetchJobRunErrors", ctx, runIds) ret0, _ := ret[0].(map[string]*armadaevents.Error) ret1, _ := ret[1].(error) return ret0, ret1 } // FetchJobRunErrors indicates an expected call of FetchJobRunErrors. -func (mr *MockJobRepositoryMockRecorder) FetchJobRunErrors(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockJobRepositoryMockRecorder) FetchJobRunErrors(ctx, runIds any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FetchJobRunErrors", reflect.TypeOf((*MockJobRepository)(nil).FetchJobRunErrors), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FetchJobRunErrors", reflect.TypeOf((*MockJobRepository)(nil).FetchJobRunErrors), ctx, runIds) } // FetchJobRunLeases mocks base method. -func (m *MockJobRepository) FetchJobRunLeases(arg0 *armadacontext.Context, arg1 string, arg2 uint, arg3 []string) ([]*database.JobRunLease, error) { +func (m *MockJobRepository) FetchJobRunLeases(ctx *armadacontext.Context, executor string, maxResults uint, excludedRunIds []string) ([]*database.JobRunLease, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "FetchJobRunLeases", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "FetchJobRunLeases", ctx, executor, maxResults, excludedRunIds) ret0, _ := ret[0].([]*database.JobRunLease) ret1, _ := ret[1].(error) return ret0, ret1 } // FetchJobRunLeases indicates an expected call of FetchJobRunLeases. -func (mr *MockJobRepositoryMockRecorder) FetchJobRunLeases(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { +func (mr *MockJobRepositoryMockRecorder) FetchJobRunLeases(ctx, executor, maxResults, excludedRunIds any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FetchJobRunLeases", reflect.TypeOf((*MockJobRepository)(nil).FetchJobRunLeases), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FetchJobRunLeases", reflect.TypeOf((*MockJobRepository)(nil).FetchJobRunLeases), ctx, executor, maxResults, excludedRunIds) } // FetchJobUpdates mocks base method. -func (m *MockJobRepository) FetchJobUpdates(arg0 *armadacontext.Context, arg1, arg2 int64) ([]database.Job, []database.Run, error) { +func (m *MockJobRepository) FetchJobUpdates(ctx *armadacontext.Context, jobSerial, jobRunSerial int64) ([]database.Job, []database.Run, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "FetchJobUpdates", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "FetchJobUpdates", ctx, jobSerial, jobRunSerial) ret0, _ := ret[0].([]database.Job) ret1, _ := ret[1].([]database.Run) ret2, _ := ret[2].(error) @@ -109,22 +115,22 @@ func (m *MockJobRepository) FetchJobUpdates(arg0 *armadacontext.Context, arg1, a } // FetchJobUpdates indicates an expected call of FetchJobUpdates. -func (mr *MockJobRepositoryMockRecorder) FetchJobUpdates(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockJobRepositoryMockRecorder) FetchJobUpdates(ctx, jobSerial, jobRunSerial any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FetchJobUpdates", reflect.TypeOf((*MockJobRepository)(nil).FetchJobUpdates), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FetchJobUpdates", reflect.TypeOf((*MockJobRepository)(nil).FetchJobUpdates), ctx, jobSerial, jobRunSerial) } // FindInactiveRuns mocks base method. -func (m *MockJobRepository) FindInactiveRuns(arg0 *armadacontext.Context, arg1 []string) ([]string, error) { +func (m *MockJobRepository) FindInactiveRuns(ctx *armadacontext.Context, runIds []string) ([]string, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "FindInactiveRuns", arg0, arg1) + ret := m.ctrl.Call(m, "FindInactiveRuns", ctx, runIds) ret0, _ := ret[0].([]string) ret1, _ := ret[1].(error) return ret0, ret1 } // FindInactiveRuns indicates an expected call of FindInactiveRuns. -func (mr *MockJobRepositoryMockRecorder) FindInactiveRuns(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockJobRepositoryMockRecorder) FindInactiveRuns(ctx, runIds any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindInactiveRuns", reflect.TypeOf((*MockJobRepository)(nil).FindInactiveRuns), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindInactiveRuns", reflect.TypeOf((*MockJobRepository)(nil).FindInactiveRuns), ctx, runIds) } diff --git a/internal/scheduler/mocks/leases_getter.go b/internal/scheduler/mocks/leases_getter.go index 012c2bfffd5..364ea7b792e 100644 --- a/internal/scheduler/mocks/leases_getter.go +++ b/internal/scheduler/mocks/leases_getter.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: k8s.io/client-go/kubernetes/typed/coordination/v1 (interfaces: LeasesGetter,LeaseInterface) +// +// Generated by this command: +// +// mockgen -destination=./leases_getter.go -package=schedulermocks k8s.io/client-go/kubernetes/typed/coordination/v1 LeasesGetter,LeaseInterface +// // Package schedulermocks is a generated GoMock package. package schedulermocks @@ -8,7 +13,7 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" v1 "k8s.io/api/coordination/v1" v10 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -21,6 +26,7 @@ import ( type MockLeasesGetter struct { ctrl *gomock.Controller recorder *MockLeasesGetterMockRecorder + isgomock struct{} } // MockLeasesGetterMockRecorder is the mock recorder for MockLeasesGetter. @@ -41,23 +47,24 @@ func (m *MockLeasesGetter) EXPECT() *MockLeasesGetterMockRecorder { } // Leases mocks base method. -func (m *MockLeasesGetter) Leases(arg0 string) v12.LeaseInterface { +func (m *MockLeasesGetter) Leases(namespace string) v12.LeaseInterface { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Leases", arg0) + ret := m.ctrl.Call(m, "Leases", namespace) ret0, _ := ret[0].(v12.LeaseInterface) return ret0 } // Leases indicates an expected call of Leases. -func (mr *MockLeasesGetterMockRecorder) Leases(arg0 interface{}) *gomock.Call { +func (mr *MockLeasesGetterMockRecorder) Leases(namespace any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Leases", reflect.TypeOf((*MockLeasesGetter)(nil).Leases), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Leases", reflect.TypeOf((*MockLeasesGetter)(nil).Leases), namespace) } // MockLeaseInterface is a mock of LeaseInterface interface. type MockLeaseInterface struct { ctrl *gomock.Controller recorder *MockLeaseInterfaceMockRecorder + isgomock struct{} } // MockLeaseInterfaceMockRecorder is the mock recorder for MockLeaseInterface. @@ -78,98 +85,98 @@ func (m *MockLeaseInterface) EXPECT() *MockLeaseInterfaceMockRecorder { } // Apply mocks base method. -func (m *MockLeaseInterface) Apply(arg0 context.Context, arg1 *v11.LeaseApplyConfiguration, arg2 v10.ApplyOptions) (*v1.Lease, error) { +func (m *MockLeaseInterface) Apply(ctx context.Context, lease *v11.LeaseApplyConfiguration, opts v10.ApplyOptions) (*v1.Lease, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Apply", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "Apply", ctx, lease, opts) ret0, _ := ret[0].(*v1.Lease) ret1, _ := ret[1].(error) return ret0, ret1 } // Apply indicates an expected call of Apply. -func (mr *MockLeaseInterfaceMockRecorder) Apply(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockLeaseInterfaceMockRecorder) Apply(ctx, lease, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Apply", reflect.TypeOf((*MockLeaseInterface)(nil).Apply), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Apply", reflect.TypeOf((*MockLeaseInterface)(nil).Apply), ctx, lease, opts) } // Create mocks base method. -func (m *MockLeaseInterface) Create(arg0 context.Context, arg1 *v1.Lease, arg2 v10.CreateOptions) (*v1.Lease, error) { +func (m *MockLeaseInterface) Create(ctx context.Context, lease *v1.Lease, opts v10.CreateOptions) (*v1.Lease, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Create", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "Create", ctx, lease, opts) ret0, _ := ret[0].(*v1.Lease) ret1, _ := ret[1].(error) return ret0, ret1 } // Create indicates an expected call of Create. -func (mr *MockLeaseInterfaceMockRecorder) Create(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockLeaseInterfaceMockRecorder) Create(ctx, lease, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockLeaseInterface)(nil).Create), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockLeaseInterface)(nil).Create), ctx, lease, opts) } // Delete mocks base method. -func (m *MockLeaseInterface) Delete(arg0 context.Context, arg1 string, arg2 v10.DeleteOptions) error { +func (m *MockLeaseInterface) Delete(ctx context.Context, name string, opts v10.DeleteOptions) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Delete", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "Delete", ctx, name, opts) ret0, _ := ret[0].(error) return ret0 } // Delete indicates an expected call of Delete. -func (mr *MockLeaseInterfaceMockRecorder) Delete(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockLeaseInterfaceMockRecorder) Delete(ctx, name, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockLeaseInterface)(nil).Delete), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockLeaseInterface)(nil).Delete), ctx, name, opts) } // DeleteCollection mocks base method. -func (m *MockLeaseInterface) DeleteCollection(arg0 context.Context, arg1 v10.DeleteOptions, arg2 v10.ListOptions) error { +func (m *MockLeaseInterface) DeleteCollection(ctx context.Context, opts v10.DeleteOptions, listOpts v10.ListOptions) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteCollection", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "DeleteCollection", ctx, opts, listOpts) ret0, _ := ret[0].(error) return ret0 } // DeleteCollection indicates an expected call of DeleteCollection. -func (mr *MockLeaseInterfaceMockRecorder) DeleteCollection(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockLeaseInterfaceMockRecorder) DeleteCollection(ctx, opts, listOpts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteCollection", reflect.TypeOf((*MockLeaseInterface)(nil).DeleteCollection), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteCollection", reflect.TypeOf((*MockLeaseInterface)(nil).DeleteCollection), ctx, opts, listOpts) } // Get mocks base method. -func (m *MockLeaseInterface) Get(arg0 context.Context, arg1 string, arg2 v10.GetOptions) (*v1.Lease, error) { +func (m *MockLeaseInterface) Get(ctx context.Context, name string, opts v10.GetOptions) (*v1.Lease, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Get", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "Get", ctx, name, opts) ret0, _ := ret[0].(*v1.Lease) ret1, _ := ret[1].(error) return ret0, ret1 } // Get indicates an expected call of Get. -func (mr *MockLeaseInterfaceMockRecorder) Get(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockLeaseInterfaceMockRecorder) Get(ctx, name, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockLeaseInterface)(nil).Get), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockLeaseInterface)(nil).Get), ctx, name, opts) } // List mocks base method. -func (m *MockLeaseInterface) List(arg0 context.Context, arg1 v10.ListOptions) (*v1.LeaseList, error) { +func (m *MockLeaseInterface) List(ctx context.Context, opts v10.ListOptions) (*v1.LeaseList, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "List", arg0, arg1) + ret := m.ctrl.Call(m, "List", ctx, opts) ret0, _ := ret[0].(*v1.LeaseList) ret1, _ := ret[1].(error) return ret0, ret1 } // List indicates an expected call of List. -func (mr *MockLeaseInterfaceMockRecorder) List(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockLeaseInterfaceMockRecorder) List(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockLeaseInterface)(nil).List), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockLeaseInterface)(nil).List), ctx, opts) } // Patch mocks base method. -func (m *MockLeaseInterface) Patch(arg0 context.Context, arg1 string, arg2 types.PatchType, arg3 []byte, arg4 v10.PatchOptions, arg5 ...string) (*v1.Lease, error) { +func (m *MockLeaseInterface) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v10.PatchOptions, subresources ...string) (*v1.Lease, error) { m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1, arg2, arg3, arg4} - for _, a := range arg5 { + varargs := []any{ctx, name, pt, data, opts} + for _, a := range subresources { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "Patch", varargs...) @@ -179,38 +186,38 @@ func (m *MockLeaseInterface) Patch(arg0 context.Context, arg1 string, arg2 types } // Patch indicates an expected call of Patch. -func (mr *MockLeaseInterfaceMockRecorder) Patch(arg0, arg1, arg2, arg3, arg4 interface{}, arg5 ...interface{}) *gomock.Call { +func (mr *MockLeaseInterfaceMockRecorder) Patch(ctx, name, pt, data, opts any, subresources ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1, arg2, arg3, arg4}, arg5...) + varargs := append([]any{ctx, name, pt, data, opts}, subresources...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Patch", reflect.TypeOf((*MockLeaseInterface)(nil).Patch), varargs...) } // Update mocks base method. -func (m *MockLeaseInterface) Update(arg0 context.Context, arg1 *v1.Lease, arg2 v10.UpdateOptions) (*v1.Lease, error) { +func (m *MockLeaseInterface) Update(ctx context.Context, lease *v1.Lease, opts v10.UpdateOptions) (*v1.Lease, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Update", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "Update", ctx, lease, opts) ret0, _ := ret[0].(*v1.Lease) ret1, _ := ret[1].(error) return ret0, ret1 } // Update indicates an expected call of Update. -func (mr *MockLeaseInterfaceMockRecorder) Update(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockLeaseInterfaceMockRecorder) Update(ctx, lease, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockLeaseInterface)(nil).Update), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockLeaseInterface)(nil).Update), ctx, lease, opts) } // Watch mocks base method. -func (m *MockLeaseInterface) Watch(arg0 context.Context, arg1 v10.ListOptions) (watch.Interface, error) { +func (m *MockLeaseInterface) Watch(ctx context.Context, opts v10.ListOptions) (watch.Interface, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Watch", arg0, arg1) + ret := m.ctrl.Call(m, "Watch", ctx, opts) ret0, _ := ret[0].(watch.Interface) ret1, _ := ret[1].(error) return ret0, ret1 } // Watch indicates an expected call of Watch. -func (mr *MockLeaseInterfaceMockRecorder) Watch(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockLeaseInterfaceMockRecorder) Watch(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Watch", reflect.TypeOf((*MockLeaseInterface)(nil).Watch), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Watch", reflect.TypeOf((*MockLeaseInterface)(nil).Watch), ctx, opts) } diff --git a/internal/scheduler/mocks/queue_cache.go b/internal/scheduler/mocks/queue_cache.go index 1970a5fa010..1a24387c10f 100644 --- a/internal/scheduler/mocks/queue_cache.go +++ b/internal/scheduler/mocks/queue_cache.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/armadaproject/armada/internal/scheduler/queue (interfaces: QueueCache) +// +// Generated by this command: +// +// mockgen -destination=./queue_cache.go -package=schedulermocks github.com/armadaproject/armada/internal/scheduler/queue QueueCache +// // Package schedulermocks is a generated GoMock package. package schedulermocks @@ -9,13 +14,14 @@ import ( armadacontext "github.com/armadaproject/armada/internal/common/armadacontext" api "github.com/armadaproject/armada/pkg/api" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockQueueCache is a mock of QueueCache interface. type MockQueueCache struct { ctrl *gomock.Controller recorder *MockQueueCacheMockRecorder + isgomock struct{} } // MockQueueCacheMockRecorder is the mock recorder for MockQueueCache. @@ -36,16 +42,16 @@ func (m *MockQueueCache) EXPECT() *MockQueueCacheMockRecorder { } // GetAll mocks base method. -func (m *MockQueueCache) GetAll(arg0 *armadacontext.Context) ([]*api.Queue, error) { +func (m *MockQueueCache) GetAll(ctx *armadacontext.Context) ([]*api.Queue, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetAll", arg0) + ret := m.ctrl.Call(m, "GetAll", ctx) ret0, _ := ret[0].([]*api.Queue) ret1, _ := ret[1].(error) return ret0, ret1 } // GetAll indicates an expected call of GetAll. -func (mr *MockQueueCacheMockRecorder) GetAll(arg0 interface{}) *gomock.Call { +func (mr *MockQueueCacheMockRecorder) GetAll(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAll", reflect.TypeOf((*MockQueueCache)(nil).GetAll), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAll", reflect.TypeOf((*MockQueueCache)(nil).GetAll), ctx) } diff --git a/internal/scheduler/publisher_test.go b/internal/scheduler/publisher_test.go index 66a42a20453..8ccd2d3f68d 100644 --- a/internal/scheduler/publisher_test.go +++ b/internal/scheduler/publisher_test.go @@ -8,11 +8,11 @@ import ( "github.com/apache/pulsar-client-go/pulsar" "github.com/gogo/protobuf/proto" - "github.com/golang/mock/gomock" "github.com/google/uuid" "github.com/pkg/errors" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "github.com/armadaproject/armada/internal/common/armadacontext" "github.com/armadaproject/armada/internal/common/mocks" diff --git a/internal/scheduler/queue/queue_cache_test.go b/internal/scheduler/queue/queue_cache_test.go index 7687d5772ea..d57c65afef1 100644 --- a/internal/scheduler/queue/queue_cache_test.go +++ b/internal/scheduler/queue/queue_cache_test.go @@ -5,8 +5,8 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" + "go.uber.org/mock/gomock" "github.com/armadaproject/armada/internal/common/armadacontext" schedulermocks "github.com/armadaproject/armada/internal/scheduler/mocks" diff --git a/internal/scheduler/scheduling/scheduling_algo_test.go b/internal/scheduler/scheduling/scheduling_algo_test.go index 18e69ffd7f2..b69ab010244 100644 --- a/internal/scheduler/scheduling/scheduling_algo_test.go +++ b/internal/scheduler/scheduling/scheduling_algo_test.go @@ -6,9 +6,9 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "golang.org/x/exp/slices" k8sResource "k8s.io/apimachinery/pkg/api/resource" clock "k8s.io/utils/clock/testing" diff --git a/internal/scheduler/submitcheck_test.go b/internal/scheduler/submitcheck_test.go index f87dac1cdc8..d5d355a9e5d 100644 --- a/internal/scheduler/submitcheck_test.go +++ b/internal/scheduler/submitcheck_test.go @@ -4,10 +4,10 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" "github.com/google/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "golang.org/x/exp/slices" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" diff --git a/internal/server/mocks/generate.go b/internal/server/mocks/generate.go index 0fc5f59e161..2efeadc2e72 100644 --- a/internal/server/mocks/generate.go +++ b/internal/server/mocks/generate.go @@ -1,5 +1,6 @@ package mocks // Mock implementations used by tests -//go:generate mockgen -destination=./mock_deduplicator.go -package=mocks "github.com/armadaproject/armada/internal/armada/submit" Deduplicator -//go:generate mockgen -destination=./mock_authorizer.go -package=mocks "github.com/armadaproject/armada/internal/armada/server" ActionAuthorizer +//go:generate mockgen -destination=./mock_deduplicator.go -package=mocks "github.com/armadaproject/armada/internal/server/submit" Deduplicator +//go:generate mockgen -destination=./mock_authorizer.go -package=mocks "github.com/armadaproject/armada/internal/common/auth" ActionAuthorizer +//go:generate mockgen -destination=./mock_repository.go -package=mocks "github.com/armadaproject/armada/internal/server/queue" QueueRepository diff --git a/internal/server/mocks/mock_authorizer.go b/internal/server/mocks/mock_authorizer.go index c4bab20654e..57b7f85584a 100644 --- a/internal/server/mocks/mock_authorizer.go +++ b/internal/server/mocks/mock_authorizer.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/armadaproject/armada/internal/armada/server (interfaces: ActionAuthorizer) +// Source: github.com/armadaproject/armada/internal/common/auth (interfaces: ActionAuthorizer) +// +// Generated by this command: +// +// mockgen -destination=./mock_authorizer.go -package=mocks github.com/armadaproject/armada/internal/common/auth ActionAuthorizer +// // Package mocks is a generated GoMock package. package mocks @@ -10,13 +15,14 @@ import ( armadacontext "github.com/armadaproject/armada/internal/common/armadacontext" permission "github.com/armadaproject/armada/internal/common/auth/permission" queue "github.com/armadaproject/armada/pkg/client/queue" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockActionAuthorizer is a mock of ActionAuthorizer interface. type MockActionAuthorizer struct { ctrl *gomock.Controller recorder *MockActionAuthorizerMockRecorder + isgomock struct{} } // MockActionAuthorizerMockRecorder is the mock recorder for MockActionAuthorizer. @@ -37,29 +43,29 @@ func (m *MockActionAuthorizer) EXPECT() *MockActionAuthorizerMockRecorder { } // AuthorizeAction mocks base method. -func (m *MockActionAuthorizer) AuthorizeAction(arg0 *armadacontext.Context, arg1 permission.Permission) error { +func (m *MockActionAuthorizer) AuthorizeAction(ctx *armadacontext.Context, perm permission.Permission) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AuthorizeAction", arg0, arg1) + ret := m.ctrl.Call(m, "AuthorizeAction", ctx, perm) ret0, _ := ret[0].(error) return ret0 } // AuthorizeAction indicates an expected call of AuthorizeAction. -func (mr *MockActionAuthorizerMockRecorder) AuthorizeAction(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockActionAuthorizerMockRecorder) AuthorizeAction(ctx, perm any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AuthorizeAction", reflect.TypeOf((*MockActionAuthorizer)(nil).AuthorizeAction), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AuthorizeAction", reflect.TypeOf((*MockActionAuthorizer)(nil).AuthorizeAction), ctx, perm) } // AuthorizeQueueAction mocks base method. -func (m *MockActionAuthorizer) AuthorizeQueueAction(arg0 *armadacontext.Context, arg1 queue.Queue, arg2 permission.Permission, arg3 queue.PermissionVerb) error { +func (m *MockActionAuthorizer) AuthorizeQueueAction(ctx *armadacontext.Context, queue queue.Queue, anyPerm permission.Permission, perm queue.PermissionVerb) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AuthorizeQueueAction", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "AuthorizeQueueAction", ctx, queue, anyPerm, perm) ret0, _ := ret[0].(error) return ret0 } // AuthorizeQueueAction indicates an expected call of AuthorizeQueueAction. -func (mr *MockActionAuthorizerMockRecorder) AuthorizeQueueAction(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { +func (mr *MockActionAuthorizerMockRecorder) AuthorizeQueueAction(ctx, queue, anyPerm, perm any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AuthorizeQueueAction", reflect.TypeOf((*MockActionAuthorizer)(nil).AuthorizeQueueAction), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AuthorizeQueueAction", reflect.TypeOf((*MockActionAuthorizer)(nil).AuthorizeQueueAction), ctx, queue, anyPerm, perm) } diff --git a/internal/server/mocks/mock_deduplicator.go b/internal/server/mocks/mock_deduplicator.go index edb4ef413c2..a5dc0d1db3d 100644 --- a/internal/server/mocks/mock_deduplicator.go +++ b/internal/server/mocks/mock_deduplicator.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/armadaproject/armada/internal/armada/submit (interfaces: Deduplicator) +// Source: github.com/armadaproject/armada/internal/server/submit (interfaces: Deduplicator) +// +// Generated by this command: +// +// mockgen -destination=./mock_deduplicator.go -package=mocks github.com/armadaproject/armada/internal/server/submit Deduplicator +// // Package mocks is a generated GoMock package. package mocks @@ -9,13 +14,14 @@ import ( armadacontext "github.com/armadaproject/armada/internal/common/armadacontext" api "github.com/armadaproject/armada/pkg/api" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockDeduplicator is a mock of Deduplicator interface. type MockDeduplicator struct { ctrl *gomock.Controller recorder *MockDeduplicatorMockRecorder + isgomock struct{} } // MockDeduplicatorMockRecorder is the mock recorder for MockDeduplicator. @@ -36,30 +42,30 @@ func (m *MockDeduplicator) EXPECT() *MockDeduplicatorMockRecorder { } // GetOriginalJobIds mocks base method. -func (m *MockDeduplicator) GetOriginalJobIds(arg0 *armadacontext.Context, arg1 string, arg2 []*api.JobSubmitRequestItem) (map[string]string, error) { +func (m *MockDeduplicator) GetOriginalJobIds(ctx *armadacontext.Context, queue string, jobRequests []*api.JobSubmitRequestItem) (map[string]string, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetOriginalJobIds", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "GetOriginalJobIds", ctx, queue, jobRequests) ret0, _ := ret[0].(map[string]string) ret1, _ := ret[1].(error) return ret0, ret1 } // GetOriginalJobIds indicates an expected call of GetOriginalJobIds. -func (mr *MockDeduplicatorMockRecorder) GetOriginalJobIds(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockDeduplicatorMockRecorder) GetOriginalJobIds(ctx, queue, jobRequests any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOriginalJobIds", reflect.TypeOf((*MockDeduplicator)(nil).GetOriginalJobIds), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOriginalJobIds", reflect.TypeOf((*MockDeduplicator)(nil).GetOriginalJobIds), ctx, queue, jobRequests) } // StoreOriginalJobIds mocks base method. -func (m *MockDeduplicator) StoreOriginalJobIds(arg0 *armadacontext.Context, arg1 string, arg2 map[string]string) error { +func (m *MockDeduplicator) StoreOriginalJobIds(ctx *armadacontext.Context, queue string, mappings map[string]string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "StoreOriginalJobIds", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "StoreOriginalJobIds", ctx, queue, mappings) ret0, _ := ret[0].(error) return ret0 } // StoreOriginalJobIds indicates an expected call of StoreOriginalJobIds. -func (mr *MockDeduplicatorMockRecorder) StoreOriginalJobIds(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockDeduplicatorMockRecorder) StoreOriginalJobIds(ctx, queue, mappings any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StoreOriginalJobIds", reflect.TypeOf((*MockDeduplicator)(nil).StoreOriginalJobIds), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StoreOriginalJobIds", reflect.TypeOf((*MockDeduplicator)(nil).StoreOriginalJobIds), ctx, queue, mappings) } diff --git a/internal/server/mocks/mock_repository.go b/internal/server/mocks/mock_repository.go index a9f79e2702b..c5b6ebc8560 100644 --- a/internal/server/mocks/mock_repository.go +++ b/internal/server/mocks/mock_repository.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/armadaproject/armada/internal/armada/queue (interfaces: QueueRepository) +// Source: github.com/armadaproject/armada/internal/server/queue (interfaces: QueueRepository) +// +// Generated by this command: +// +// mockgen -destination=./mock_repository.go -package=mocks github.com/armadaproject/armada/internal/server/queue QueueRepository +// // Package mocks is a generated GoMock package. package mocks @@ -9,13 +14,14 @@ import ( armadacontext "github.com/armadaproject/armada/internal/common/armadacontext" queue "github.com/armadaproject/armada/pkg/client/queue" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockQueueRepository is a mock of QueueRepository interface. type MockQueueRepository struct { ctrl *gomock.Controller recorder *MockQueueRepositoryMockRecorder + isgomock struct{} } // MockQueueRepositoryMockRecorder is the mock recorder for MockQueueRepository. @@ -35,6 +41,20 @@ func (m *MockQueueRepository) EXPECT() *MockQueueRepositoryMockRecorder { return m.recorder } +// CordonQueue mocks base method. +func (m *MockQueueRepository) CordonQueue(ctx *armadacontext.Context, name string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CordonQueue", ctx, name) + ret0, _ := ret[0].(error) + return ret0 +} + +// CordonQueue indicates an expected call of CordonQueue. +func (mr *MockQueueRepositoryMockRecorder) CordonQueue(ctx, name any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CordonQueue", reflect.TypeOf((*MockQueueRepository)(nil).CordonQueue), ctx, name) +} + // CreateQueue mocks base method. func (m *MockQueueRepository) CreateQueue(arg0 *armadacontext.Context, arg1 queue.Queue) error { m.ctrl.T.Helper() @@ -44,69 +64,67 @@ func (m *MockQueueRepository) CreateQueue(arg0 *armadacontext.Context, arg1 queu } // CreateQueue indicates an expected call of CreateQueue. -func (mr *MockQueueRepositoryMockRecorder) CreateQueue(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockQueueRepositoryMockRecorder) CreateQueue(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateQueue", reflect.TypeOf((*MockQueueRepository)(nil).CreateQueue), arg0, arg1) } // DeleteQueue mocks base method. -func (m *MockQueueRepository) DeleteQueue(arg0 *armadacontext.Context, arg1 string) error { +func (m *MockQueueRepository) DeleteQueue(ctx *armadacontext.Context, name string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteQueue", arg0, arg1) + ret := m.ctrl.Call(m, "DeleteQueue", ctx, name) ret0, _ := ret[0].(error) return ret0 } // DeleteQueue indicates an expected call of DeleteQueue. -func (mr *MockQueueRepositoryMockRecorder) DeleteQueue(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockQueueRepositoryMockRecorder) DeleteQueue(ctx, name any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteQueue", reflect.TypeOf((*MockQueueRepository)(nil).DeleteQueue), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteQueue", reflect.TypeOf((*MockQueueRepository)(nil).DeleteQueue), ctx, name) } // GetAllQueues mocks base method. -func (m *MockQueueRepository) GetAllQueues(arg0 *armadacontext.Context) ([]queue.Queue, error) { +func (m *MockQueueRepository) GetAllQueues(ctx *armadacontext.Context) ([]queue.Queue, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetAllQueues", arg0) + ret := m.ctrl.Call(m, "GetAllQueues", ctx) ret0, _ := ret[0].([]queue.Queue) ret1, _ := ret[1].(error) return ret0, ret1 } // GetAllQueues indicates an expected call of GetAllQueues. -func (mr *MockQueueRepositoryMockRecorder) GetAllQueues(arg0 interface{}) *gomock.Call { +func (mr *MockQueueRepositoryMockRecorder) GetAllQueues(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllQueues", reflect.TypeOf((*MockQueueRepository)(nil).GetAllQueues), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllQueues", reflect.TypeOf((*MockQueueRepository)(nil).GetAllQueues), ctx) } // GetQueue mocks base method. -func (m *MockQueueRepository) GetQueue(arg0 *armadacontext.Context, arg1 string) (queue.Queue, error) { +func (m *MockQueueRepository) GetQueue(ctx *armadacontext.Context, name string) (queue.Queue, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetQueue", arg0, arg1) + ret := m.ctrl.Call(m, "GetQueue", ctx, name) ret0, _ := ret[0].(queue.Queue) ret1, _ := ret[1].(error) return ret0, ret1 } -// CordonQueue mocks base method. -func (m *MockQueueRepository) CordonQueue(arg0 *armadacontext.Context, arg1 string) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CordonQueue", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 +// GetQueue indicates an expected call of GetQueue. +func (mr *MockQueueRepositoryMockRecorder) GetQueue(ctx, name any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetQueue", reflect.TypeOf((*MockQueueRepository)(nil).GetQueue), ctx, name) } // UncordonQueue mocks base method. -func (m *MockQueueRepository) UncordonQueue(arg0 *armadacontext.Context, arg1 string) error { +func (m *MockQueueRepository) UncordonQueue(ctx *armadacontext.Context, name string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UncordonQueue", arg0, arg1) + ret := m.ctrl.Call(m, "UncordonQueue", ctx, name) ret0, _ := ret[0].(error) return ret0 } -// GetQueue indicates an expected call of GetQueue. -func (mr *MockQueueRepositoryMockRecorder) GetQueue(arg0, arg1 interface{}) *gomock.Call { +// UncordonQueue indicates an expected call of UncordonQueue. +func (mr *MockQueueRepositoryMockRecorder) UncordonQueue(ctx, name any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetQueue", reflect.TypeOf((*MockQueueRepository)(nil).GetQueue), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UncordonQueue", reflect.TypeOf((*MockQueueRepository)(nil).UncordonQueue), ctx, name) } // UpdateQueue mocks base method. @@ -118,19 +136,7 @@ func (m *MockQueueRepository) UpdateQueue(arg0 *armadacontext.Context, arg1 queu } // UpdateQueue indicates an expected call of UpdateQueue. -func (mr *MockQueueRepositoryMockRecorder) UpdateQueue(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockQueueRepositoryMockRecorder) UpdateQueue(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateQueue", reflect.TypeOf((*MockQueueRepository)(nil).UpdateQueue), arg0, arg1) } - -// CordonQueue indicates an expected call of CordonQueue. -func (mr *MockQueueRepositoryMockRecorder) CordonQueue(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CordonQueue", reflect.TypeOf((*MockQueueRepository)(nil).CordonQueue), arg0, arg1) -} - -// UncordonQueue indicates an expected call of UncordonQueue. -func (mr *MockQueueRepositoryMockRecorder) UncordonQueue(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UncordonQueue", reflect.TypeOf((*MockQueueRepository)(nil).UncordonQueue), arg0, arg1) -} diff --git a/internal/server/queue/queue_cache_test.go b/internal/server/queue/queue_cache_test.go index f6443466fa7..ecdbe03e950 100644 --- a/internal/server/queue/queue_cache_test.go +++ b/internal/server/queue/queue_cache_test.go @@ -5,9 +5,9 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "github.com/armadaproject/armada/internal/common/armadacontext" "github.com/armadaproject/armada/internal/server/mocks" diff --git a/internal/server/submit/submit_test.go b/internal/server/submit/submit_test.go index 3a67b2e7209..68bc3736694 100644 --- a/internal/server/submit/submit_test.go +++ b/internal/server/submit/submit_test.go @@ -4,8 +4,8 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" + "go.uber.org/mock/gomock" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" clock "k8s.io/utils/clock/testing" @@ -13,7 +13,7 @@ import ( "github.com/armadaproject/armada/internal/common/armadacontext" "github.com/armadaproject/armada/internal/common/auth/permission" - commonMocks "github.com/armadaproject/armada/internal/common/mocks/jobsetevents" + commonMocks "github.com/armadaproject/armada/internal/common/mocks" "github.com/armadaproject/armada/internal/common/util" "github.com/armadaproject/armada/internal/server/mocks" "github.com/armadaproject/armada/internal/server/permissions" @@ -24,7 +24,7 @@ import ( ) type mockObjects struct { - publisher *commonMocks.MockPublisher + publisher *commonMocks.MockPublisher[*armadaevents.EventSequence] queueRepo *mocks.MockQueueRepository deduplicator *mocks.MockDeduplicator authorizer *mocks.MockActionAuthorizer @@ -33,7 +33,7 @@ type mockObjects struct { func createMocks(t *testing.T) *mockObjects { ctrl := gomock.NewController(t) return &mockObjects{ - publisher: commonMocks.NewMockPublisher(ctrl), + publisher: commonMocks.NewMockPublisher[*armadaevents.EventSequence](ctrl), queueRepo: mocks.NewMockQueueRepository(ctrl), deduplicator: mocks.NewMockDeduplicator(ctrl), authorizer: mocks.NewMockActionAuthorizer(ctrl), diff --git a/tools.yaml b/tools.yaml index 35bc73c2f02..3483cb3e2c7 100644 --- a/tools.yaml +++ b/tools.yaml @@ -2,7 +2,7 @@ # TODO: Use latest goreleaser. After upgrading k8s.io packages. tools: - github.com/go-swagger/go-swagger/cmd/swagger@v0.31.0 -- github.com/golang/mock/mockgen@v1.6.0 +- go.uber.org/mock/mockgen@v0.5.0 - github.com/gordonklaus/ineffassign@v0.0.0-20210914165742-4cc7213b9bc8 - github.com/goreleaser/goreleaser@v1.20.0 - github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v1.16.0