From 7a84332e26a6bd26ace3634bda40fb8f9c439cd0 Mon Sep 17 00:00:00 2001 From: Carina Kothe <69976260+grischperl@users.noreply.github.com> Date: Fri, 20 Sep 2024 08:21:16 +0200 Subject: [PATCH] chore: bump nats to 1.37.0 (#646) * execute `make generate` * bump nats to 1.37.0 * fix linting problem * add `nolint` comment * add nolint comment --- .../v1alpha1/zz_generated.deepcopy.go | 2 +- go.mod | 2 +- go.sum | 2 ++ .../eventing/mocks/typed_controller.go | 28 ++++++++-------- .../jetstream/mocks/JetStreamContext.go | 32 +++++++++++++++++++ pkg/backend/jetstream/stubs_test.go | 5 +++ testing/test_helpers.go | 8 ++--- 7 files changed, 59 insertions(+), 20 deletions(-) diff --git a/api/operator/v1alpha1/zz_generated.deepcopy.go b/api/operator/v1alpha1/zz_generated.deepcopy.go index c227b3446..25bcddd82 100644 --- a/api/operator/v1alpha1/zz_generated.deepcopy.go +++ b/api/operator/v1alpha1/zz_generated.deepcopy.go @@ -21,7 +21,7 @@ limitations under the License. package v1alpha1 import ( - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) diff --git a/go.mod b/go.mod index 866562d62..9aa5dbb6a 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/kyma-project/nats-manager v1.0.3-0.20231219150808-13159cfea47c github.com/mitchellh/hashstructure/v2 v2.0.2 github.com/nats-io/nats-server/v2 v2.10.20 - github.com/nats-io/nats.go v1.36.0 + github.com/nats-io/nats.go v1.37.0 github.com/onsi/ginkgo v1.16.5 github.com/onsi/gomega v1.34.2 github.com/pkg/errors v0.9.1 diff --git a/go.sum b/go.sum index 8b9fbe585..6bf1be2f2 100644 --- a/go.sum +++ b/go.sum @@ -257,6 +257,8 @@ github.com/nats-io/nats-server/v2 v2.10.20 h1:CXDTYNHeBiAKBTAIP2gjpgbWap2GhATnTL github.com/nats-io/nats-server/v2 v2.10.20/go.mod h1:hgcPnoUtMfxz1qVOvLZGurVypQ+Cg6GXVXjG53iHk+M= github.com/nats-io/nats.go v1.36.0 h1:suEUPuWzTSse/XhESwqLxXGuj8vGRuPRoG7MoRN/qyU= github.com/nats-io/nats.go v1.36.0/go.mod h1:Ubdu4Nh9exXdSz0RVWRFBbRfrbSxOYd26oF0wkWclB8= +github.com/nats-io/nats.go v1.37.0 h1:07rauXbVnnJvv1gfIyghFEo6lUcYRY0WXc3x7x0vUxE= +github.com/nats-io/nats.go v1.37.0/go.mod h1:Ubdu4Nh9exXdSz0RVWRFBbRfrbSxOYd26oF0wkWclB8= github.com/nats-io/nkeys v0.4.7 h1:RwNJbbIdYCoClSDNY7QVKZlyb/wfT6ugvFCiKy6vDvI= github.com/nats-io/nkeys v0.4.7/go.mod h1:kqXRgRDPlGy7nGaEDMuYzmiJCIAAWDK0IMBtDmGD0nc= github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= diff --git a/internal/controller/operator/eventing/mocks/typed_controller.go b/internal/controller/operator/eventing/mocks/typed_controller.go index 811b48f1d..8edc03eea 100644 --- a/internal/controller/operator/eventing/mocks/typed_controller.go +++ b/internal/controller/operator/eventing/mocks/typed_controller.go @@ -73,7 +73,7 @@ func (_c *TypedController_GetLogger_Call[request]) RunAndReturn(run func() logr. } // Reconcile provides a mock function with given fields: _a0, _a1 -func (_m *TypedController[request]) Reconcile(_a0 context.Context, _a1 reconcile.Request) (reconcile.Result, error) { +func (_m *TypedController[request]) Reconcile(_a0 context.Context, _a1 request) (reconcile.Result, error) { ret := _m.Called(_a0, _a1) if len(ret) == 0 { @@ -82,16 +82,16 @@ func (_m *TypedController[request]) Reconcile(_a0 context.Context, _a1 reconcile var r0 reconcile.Result var r1 error - if rf, ok := ret.Get(0).(func(context.Context, reconcile.Request) (reconcile.Result, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, request) (reconcile.Result, error)); ok { return rf(_a0, _a1) } - if rf, ok := ret.Get(0).(func(context.Context, reconcile.Request) reconcile.Result); ok { + if rf, ok := ret.Get(0).(func(context.Context, request) reconcile.Result); ok { r0 = rf(_a0, _a1) } else { r0 = ret.Get(0).(reconcile.Result) } - if rf, ok := ret.Get(1).(func(context.Context, reconcile.Request) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, request) error); ok { r1 = rf(_a0, _a1) } else { r1 = ret.Error(1) @@ -107,14 +107,14 @@ type TypedController_Reconcile_Call[request comparable] struct { // Reconcile is a helper method to define mock.On call // - _a0 context.Context -// - _a1 reconcile.Request +// - _a1 request func (_e *TypedController_Expecter[request]) Reconcile(_a0 interface{}, _a1 interface{}) *TypedController_Reconcile_Call[request] { return &TypedController_Reconcile_Call[request]{Call: _e.mock.On("Reconcile", _a0, _a1)} } -func (_c *TypedController_Reconcile_Call[request]) Run(run func(_a0 context.Context, _a1 reconcile.Request)) *TypedController_Reconcile_Call[request] { +func (_c *TypedController_Reconcile_Call[request]) Run(run func(_a0 context.Context, _a1 request)) *TypedController_Reconcile_Call[request] { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(reconcile.Request)) + run(args[0].(context.Context), args[1].(request)) }) return _c } @@ -124,7 +124,7 @@ func (_c *TypedController_Reconcile_Call[request]) Return(_a0 reconcile.Result, return _c } -func (_c *TypedController_Reconcile_Call[request]) RunAndReturn(run func(context.Context, reconcile.Request) (reconcile.Result, error)) *TypedController_Reconcile_Call[request] { +func (_c *TypedController_Reconcile_Call[request]) RunAndReturn(run func(context.Context, request) (reconcile.Result, error)) *TypedController_Reconcile_Call[request] { _c.Call.Return(run) return _c } @@ -176,7 +176,7 @@ func (_c *TypedController_Start_Call[request]) RunAndReturn(run func(context.Con } // Watch provides a mock function with given fields: src -func (_m *TypedController[request]) Watch(src source.TypedSource[reconcile.Request]) error { +func (_m *TypedController[request]) Watch(src source.TypedSource[request]) error { ret := _m.Called(src) if len(ret) == 0 { @@ -184,7 +184,7 @@ func (_m *TypedController[request]) Watch(src source.TypedSource[reconcile.Reque } var r0 error - if rf, ok := ret.Get(0).(func(source.TypedSource[reconcile.Request]) error); ok { + if rf, ok := ret.Get(0).(func(source.TypedSource[request]) error); ok { r0 = rf(src) } else { r0 = ret.Error(0) @@ -199,14 +199,14 @@ type TypedController_Watch_Call[request comparable] struct { } // Watch is a helper method to define mock.On call -// - src source.TypedSource[reconcile.Request] +// - src source.TypedSource[request] func (_e *TypedController_Expecter[request]) Watch(src interface{}) *TypedController_Watch_Call[request] { return &TypedController_Watch_Call[request]{Call: _e.mock.On("Watch", src)} } -func (_c *TypedController_Watch_Call[request]) Run(run func(src source.TypedSource[reconcile.Request])) *TypedController_Watch_Call[request] { +func (_c *TypedController_Watch_Call[request]) Run(run func(src source.TypedSource[request])) *TypedController_Watch_Call[request] { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(source.TypedSource[reconcile.Request])) + run(args[0].(source.TypedSource[request])) }) return _c } @@ -216,7 +216,7 @@ func (_c *TypedController_Watch_Call[request]) Return(_a0 error) *TypedControlle return _c } -func (_c *TypedController_Watch_Call[request]) RunAndReturn(run func(source.TypedSource[reconcile.Request]) error) *TypedController_Watch_Call[request] { +func (_c *TypedController_Watch_Call[request]) RunAndReturn(run func(source.TypedSource[request]) error) *TypedController_Watch_Call[request] { _c.Call.Return(run) return _c } diff --git a/pkg/backend/jetstream/mocks/JetStreamContext.go b/pkg/backend/jetstream/mocks/JetStreamContext.go index 3f833ba16..c830b57a8 100644 --- a/pkg/backend/jetstream/mocks/JetStreamContext.go +++ b/pkg/backend/jetstream/mocks/JetStreamContext.go @@ -387,6 +387,38 @@ func (_c *JetStreamContext_ChanSubscribe_Call) RunAndReturn(run func(string, cha return _c } +// CleanupPublisher provides a mock function with given fields: +func (_m *JetStreamContext) CleanupPublisher() { + _m.Called() +} + +// JetStreamContext_CleanupPublisher_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CleanupPublisher' +type JetStreamContext_CleanupPublisher_Call struct { + *mock.Call +} + +// CleanupPublisher is a helper method to define mock.On call +func (_e *JetStreamContext_Expecter) CleanupPublisher() *JetStreamContext_CleanupPublisher_Call { + return &JetStreamContext_CleanupPublisher_Call{Call: _e.mock.On("CleanupPublisher")} +} + +func (_c *JetStreamContext_CleanupPublisher_Call) Run(run func()) *JetStreamContext_CleanupPublisher_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *JetStreamContext_CleanupPublisher_Call) Return() *JetStreamContext_CleanupPublisher_Call { + _c.Call.Return() + return _c +} + +func (_c *JetStreamContext_CleanupPublisher_Call) RunAndReturn(run func()) *JetStreamContext_CleanupPublisher_Call { + _c.Call.Return(run) + return _c +} + // ConsumerInfo provides a mock function with given fields: stream, name, opts func (_m *JetStreamContext) ConsumerInfo(stream string, name string, opts ...nats.JSOpt) (*nats.ConsumerInfo, error) { _va := make([]interface{}, len(opts)) diff --git a/pkg/backend/jetstream/stubs_test.go b/pkg/backend/jetstream/stubs_test.go index 55409a70b..1acd473c6 100644 --- a/pkg/backend/jetstream/stubs_test.go +++ b/pkg/backend/jetstream/stubs_test.go @@ -22,6 +22,11 @@ type jetStreamContextStub struct { deleteConsumerErr error } +func (j jetStreamContextStub) CleanupPublisher() { + // TODO implement me + panic("implement me") +} + func (j jetStreamContextStub) StreamNameBySubject(s string, opt ...nats.JSOpt) (string, error) { // TODO implement me panic("implement me") diff --git a/testing/test_helpers.go b/testing/test_helpers.go index a8ea74ef6..65695fb04 100644 --- a/testing/test_helpers.go +++ b/testing/test_helpers.go @@ -155,10 +155,10 @@ func GetStructuredMessageHeaders() http.Header { func GetBinaryMessageHeaders() http.Header { headers := make(http.Header) - headers.Add(CeIDHeader, EventID) //nolint:canonicalheader // used in testing. - headers.Add(CeTypeHeader, CloudEventType) //nolint:canonicalheader // used in testing. - headers.Add(CeSourceHeader, CloudEventSource) //nolint:canonicalheader // used in testing. - headers.Add(CeSpecVersionHeader, CloudEventSpecVersion) //nolint:canonicalheader // used in testing. + headers.Add(CeIDHeader, EventID) //nolint:canonicalheader,nolintlint // used in testing. + headers.Add(CeTypeHeader, CloudEventType) //nolint:canonicalheader,nolintlint // used in testing. + headers.Add(CeSourceHeader, CloudEventSource) //nolint:canonicalheader,nolintlint // used in testing. + headers.Add(CeSpecVersionHeader, CloudEventSpecVersion) //nolint:canonicalheader,nolintlint // used in testing. return headers }