diff --git a/.github/workflows/codequality.yml b/.github/workflows/codequality.yml index 15edf73a..0af0d28b 100644 --- a/.github/workflows/codequality.yml +++ b/.github/workflows/codequality.yml @@ -4,16 +4,16 @@ on: branches: - main paths-ignore: - - 'docs/**' - - '**.md' - - 'sec-scanners-config.yaml' + - "docs/**" + - "**.md" + - "sec-scanners-config.yaml" push: branches: - main paths-ignore: - - 'docs/**' - - '**.md' - - 'sec-scanners-config.yaml' + - "docs/**" + - "**.md" + - "sec-scanners-config.yaml" permissions: contents: read @@ -27,12 +27,12 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version: "1.21" cache: false - uses: actions/checkout@v4 - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version - version: v1.52 + version: v1.55 args: --timeout=5m diff --git a/.golangci.yaml b/.golangci.yaml index b7fc7fdc..98406f50 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -11,10 +11,26 @@ run: # Default: 1m timeout: 3m - # This file contains only configs which differ from defaults. # All possible options can be found here https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml linters-settings: + stylecheck: + dot-import-whitelist: + - github.com/onsi/ginkgo/v2 + - github.com/onsi/gomega + revive: + enable-all-rules: false + severity: error + rules: + - name: comment-spacings + disabled: true + - name: dot-imports + severity: warning + disabled: true + - name: line-length-limit + severity: warning + disabled: true + arguments: [120] cyclop: # The maximal code complexity to report. # Default: 10 @@ -121,7 +137,7 @@ linters-settings: nolintlint: # Exclude following linters from requiring an explanation. # Default: [] - allow-no-explanation: [ funlen, gocognit, lll ] + allow-no-explanation: [funlen, gocognit, lll] # Enable to require an explanation of nonzero length after each nolint directive. # Default: false require-explanation: true @@ -141,7 +157,6 @@ linters-settings: # Default: false all: true - linters: disable-all: true enable: @@ -252,7 +267,6 @@ linters: #- structcheck # [deprecated, replaced by unused] finds unused struct fields #- varcheck # [deprecated, replaced by unused] finds unused global variables and constants - issues: # Maximum count of issues with the same text. # Set to 0 to disable. @@ -261,13 +275,13 @@ issues: exclude-rules: - source: "^//\\s*go:generate\\s" - linters: [ lll ] + linters: [lll] - source: "(noinspection|TODO)" - linters: [ godot ] + linters: [godot] - source: "//noinspection" - linters: [ gocritic ] + linters: [gocritic] - source: "^\\s+if _, ok := err\\.\\([^.]+\\.InternalError\\); ok {" - linters: [ errorlint ] + linters: [errorlint] - path: "_test\\.go" linters: - bodyclose diff --git a/internal/controller/nats/controller.go b/internal/controller/nats/controller.go index 769ecc01..5d8a3913 100644 --- a/internal/controller/nats/controller.go +++ b/internal/controller/nats/controller.go @@ -42,13 +42,15 @@ import ( ) const ( - NATSFinalizerName = "nats.operator.kyma-project.io/finalizer" - ControllerName = "nats-manager" - ManagedByLabelKey = "app.kubernetes.io/managed-by" - ManagedByLabelValue = ControllerName + NATSFinalizerName = "nats.operator.kyma-project.io/finalizer" + ControllerName = "nats-manager" + ManagedByLabelKey = "app.kubernetes.io/managed-by" + ManagedByLabelValue = ControllerName + CreationNotAllowedMsg = "Only a single NATS CR with name: %s and namespace: " + + "%s is allowed to be created in a Kyma cluster." ) -// Reconciler reconciles a Nats object. +// Reconciler reconciles a NATS object. // //go:generate go run github.com/vektra/mockery/v2 --name=Controller --dir=../../../vendor/sigs.k8s.io/controller-runtime/pkg/controller --outpkg=mocks --case=underscore //go:generate go run github.com/vektra/mockery/v2 --name=Manager --dir=../../../vendor/sigs.k8s.io/controller-runtime/pkg/manager --outpkg=mocks --case=underscore @@ -125,44 +127,44 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu return ctrl.Result{}, client.IgnoreNotFound(err) } - // copy the object, so we don't modify the source object + // Copy the object, so we don't modify the source object. nats := currentNats.DeepCopy() - // logger with nats details + // Create a logger with NATS details. log := r.loggerWithNATS(nats) - // check if nats is in deletion state + // Check if nats is in deletion state. if nats.IsInDeletion() { return r.handleNATSDeletion(ctx, nats, log) } - // check if the NATS CR is allowed to be created. + // Check if the NATS CR is allowed to be created. if r.allowedNATSCR != nil { if result, err := r.handleNATSCRAllowedCheck(ctx, nats, log); !result || err != nil { return ctrl.Result{}, err } } - // handle reconciliation + // Handle reconciliation. return r.handleNATSReconcile(ctx, nats, log) } // handleNATSCRAllowedCheck checks if NATS CR is allowed to be created or not. // returns true if the NATS CR is allowed. func (r *Reconciler) handleNATSCRAllowedCheck(ctx context.Context, nats *natsv1alpha1.NATS, - log *zap.SugaredLogger) (bool, error) { - // if the name and namespace matches with allowed NATS CR then allow the CR to be reconciled. + log *zap.SugaredLogger, +) (bool, error) { + // If the name and namespace matches with allowed NATS CR then allow the CR to be reconciled. if nats.Name == r.allowedNATSCR.Name && nats.Namespace == r.allowedNATSCR.Namespace { return true, nil } - // set error state in status. + // Set error state in status. nats.Status.SetStateError() - // update conditions in status. + // Update conditions in status. nats.Status.UpdateConditionStatefulSet(metav1.ConditionFalse, natsv1alpha1.ConditionReasonForbidden, "") - errorMessage := fmt.Sprintf("Only a single NATS CR with name: %s and namespace: %s "+ - "is allowed to be created in a Kyma cluster.", r.allowedNATSCR.Name, r.allowedNATSCR.Namespace) + errorMessage := fmt.Sprintf(CreationNotAllowedMsg, r.allowedNATSCR.Name, r.allowedNATSCR.Namespace) nats.Status.UpdateConditionAvailable(metav1.ConditionFalse, natsv1alpha1.ConditionReasonForbidden, errorMessage) events.Warn(r.recorder, nats, natsv1alpha1.ConditionReasonForbidden, errorMessage) @@ -173,7 +175,7 @@ func (r *Reconciler) handleNATSCRAllowedCheck(ctx context.Context, nats *natsv1a // generateNatsResources renders the NATS chart with provided overrides. // It puts results into ReleaseInstance. func (r *Reconciler) generateNatsResources(nats *natsv1alpha1.NATS, instance *chart.ReleaseInstance) error { - // generate Nats resources from chart + // Generate Nats resources from chart. natsResources, err := r.natsManager.GenerateNATSResources( instance, manager.WithOwnerReference(*nats), // add owner references to all resources @@ -183,15 +185,16 @@ func (r *Reconciler) generateNatsResources(nats *natsv1alpha1.NATS, instance *ch return err } - // update manifests in instance + // Update manifests in instance. instance.SetRenderedManifests(*natsResources) return nil } // initNATSInstance initializes a new NATS release instance based on NATS CR. func (r *Reconciler) initNATSInstance(ctx context.Context, nats *natsv1alpha1.NATS, - log *zap.SugaredLogger) (*chart.ReleaseInstance, error) { - // Check if istio is enabled in cluster + log *zap.SugaredLogger, +) (*chart.ReleaseInstance, error) { + // Check if istio is enabled in cluster. istioExists, err := r.kubeClient.DestinationRuleCRDExists(ctx) if err != nil { return nil, err @@ -208,11 +211,11 @@ func (r *Reconciler) initNATSInstance(ctx context.Context, nats *natsv1alpha1.NA } log.Infof("NATS account secret (name: %s) exists: %t", accountSecretName, accountSecret != nil) - // generate overrides for helm chart + // Generate overrides for helm chart. overrides := r.natsManager.GenerateOverrides(&nats.Spec, istioExists, accountSecret == nil) log.Debugw("using overrides", "overrides", overrides) - // Init a release instance + // Init a release instance. instance := chart.NewReleaseInstance(nats.Name, nats.Namespace, istioExists, overrides) if err = r.generateNatsResources(nats, instance); err != nil { diff --git a/internal/controller/nats/controller_test.go b/internal/controller/nats/controller_test.go index 047ca5ec..9f604f0b 100644 --- a/internal/controller/nats/controller_test.go +++ b/internal/controller/nats/controller_test.go @@ -211,17 +211,14 @@ func Test_handleNATSCRAllowedCheck(t *testing.T) { Status: metav1.ConditionFalse, LastTransitionTime: metav1.Now(), Reason: string(natsv1alpha1.ConditionReasonForbidden), - Message: fmt.Sprintf("Only a single NATS CR with name: %s and namespace: %s "+ - "is allowed to be created in a Kyma cluster.", givenAllowedNATS.Name, - givenAllowedNATS.Namespace), + Message: fmt.Sprintf(CreationNotAllowedMsg, givenAllowedNATS.Name, givenAllowedNATS.Namespace), }, } require.True(t, natsv1alpha1.ConditionsEquals(wantConditions, gotNATS.Status.Conditions)) + wantK8sEventMsg := fmt.Sprintf("Warning Forbidden %s", CreationNotAllowedMsg) wantK8sEvent := []string{ - fmt.Sprintf("Warning Forbidden Only a single NATS CR with name: %s and namespace: %s "+ - "is allowed to be created in a Kyma cluster.", givenAllowedNATS.Name, - givenAllowedNATS.Namespace), + fmt.Sprintf(wantK8sEventMsg, givenAllowedNATS.Name, givenAllowedNATS.Namespace), } // check k8s events diff --git a/internal/controller/nats/mocks/controller.go b/internal/controller/nats/mocks/controller.go index 7cc68336..ecb91c2e 100644 --- a/internal/controller/nats/mocks/controller.go +++ b/internal/controller/nats/mocks/controller.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.37.1. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks @@ -35,6 +35,10 @@ func (_m *Controller) EXPECT() *Controller_Expecter { func (_m *Controller) GetLogger() logr.Logger { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetLogger") + } + var r0 logr.Logger if rf, ok := ret.Get(0).(func() logr.Logger); ok { r0 = rf() @@ -76,6 +80,10 @@ func (_c *Controller_GetLogger_Call) RunAndReturn(run func() logr.Logger) *Contr func (_m *Controller) Reconcile(_a0 context.Context, _a1 reconcile.Request) (reconcile.Result, error) { ret := _m.Called(_a0, _a1) + if len(ret) == 0 { + panic("no return value specified for Reconcile") + } + var r0 reconcile.Result var r1 error if rf, ok := ret.Get(0).(func(context.Context, reconcile.Request) (reconcile.Result, error)); ok { @@ -129,6 +137,10 @@ func (_c *Controller_Reconcile_Call) RunAndReturn(run func(context.Context, reco func (_m *Controller) Start(ctx context.Context) error { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for Start") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context) error); ok { r0 = rf(ctx) @@ -178,6 +190,10 @@ func (_m *Controller) Watch(src source.Source, eventhandler handler.EventHandler _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for Watch") + } + var r0 error if rf, ok := ret.Get(0).(func(source.Source, handler.EventHandler, ...predicate.Predicate) error); ok { r0 = rf(src, eventhandler, predicates...) diff --git a/internal/controller/nats/mocks/manager.go b/internal/controller/nats/mocks/manager.go index 5f61310d..12739e00 100644 --- a/internal/controller/nats/mocks/manager.go +++ b/internal/controller/nats/mocks/manager.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.37.1. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks @@ -48,6 +48,10 @@ func (_m *Manager) EXPECT() *Manager_Expecter { func (_m *Manager) Add(_a0 manager.Runnable) error { ret := _m.Called(_a0) + if len(ret) == 0 { + panic("no return value specified for Add") + } + var r0 error if rf, ok := ret.Get(0).(func(manager.Runnable) error); ok { r0 = rf(_a0) @@ -90,6 +94,10 @@ func (_c *Manager_Add_Call) RunAndReturn(run func(manager.Runnable) error) *Mana func (_m *Manager) AddHealthzCheck(name string, check healthz.Checker) error { ret := _m.Called(name, check) + if len(ret) == 0 { + panic("no return value specified for AddHealthzCheck") + } + var r0 error if rf, ok := ret.Get(0).(func(string, healthz.Checker) error); ok { r0 = rf(name, check) @@ -133,6 +141,10 @@ func (_c *Manager_AddHealthzCheck_Call) RunAndReturn(run func(string, healthz.Ch func (_m *Manager) AddReadyzCheck(name string, check healthz.Checker) error { ret := _m.Called(name, check) + if len(ret) == 0 { + panic("no return value specified for AddReadyzCheck") + } + var r0 error if rf, ok := ret.Get(0).(func(string, healthz.Checker) error); ok { r0 = rf(name, check) @@ -176,6 +188,10 @@ func (_c *Manager_AddReadyzCheck_Call) RunAndReturn(run func(string, healthz.Che func (_m *Manager) Elected() <-chan struct{} { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Elected") + } + var r0 <-chan struct{} if rf, ok := ret.Get(0).(func() <-chan struct{}); ok { r0 = rf() @@ -219,6 +235,10 @@ func (_c *Manager_Elected_Call) RunAndReturn(run func() <-chan struct{}) *Manage func (_m *Manager) GetAPIReader() client.Reader { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetAPIReader") + } + var r0 client.Reader if rf, ok := ret.Get(0).(func() client.Reader); ok { r0 = rf() @@ -262,6 +282,10 @@ func (_c *Manager_GetAPIReader_Call) RunAndReturn(run func() client.Reader) *Man func (_m *Manager) GetCache() cache.Cache { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetCache") + } + var r0 cache.Cache if rf, ok := ret.Get(0).(func() cache.Cache); ok { r0 = rf() @@ -305,6 +329,10 @@ func (_c *Manager_GetCache_Call) RunAndReturn(run func() cache.Cache) *Manager_G func (_m *Manager) GetClient() client.Client { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetClient") + } + var r0 client.Client if rf, ok := ret.Get(0).(func() client.Client); ok { r0 = rf() @@ -348,6 +376,10 @@ func (_c *Manager_GetClient_Call) RunAndReturn(run func() client.Client) *Manage func (_m *Manager) GetConfig() *rest.Config { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetConfig") + } + var r0 *rest.Config if rf, ok := ret.Get(0).(func() *rest.Config); ok { r0 = rf() @@ -391,6 +423,10 @@ func (_c *Manager_GetConfig_Call) RunAndReturn(run func() *rest.Config) *Manager func (_m *Manager) GetControllerOptions() config.Controller { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetControllerOptions") + } + var r0 config.Controller if rf, ok := ret.Get(0).(func() config.Controller); ok { r0 = rf() @@ -432,6 +468,10 @@ func (_c *Manager_GetControllerOptions_Call) RunAndReturn(run func() config.Cont func (_m *Manager) GetEventRecorderFor(name string) record.EventRecorder { ret := _m.Called(name) + if len(ret) == 0 { + panic("no return value specified for GetEventRecorderFor") + } + var r0 record.EventRecorder if rf, ok := ret.Get(0).(func(string) record.EventRecorder); ok { r0 = rf(name) @@ -476,6 +516,10 @@ func (_c *Manager_GetEventRecorderFor_Call) RunAndReturn(run func(string) record func (_m *Manager) GetFieldIndexer() client.FieldIndexer { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetFieldIndexer") + } + var r0 client.FieldIndexer if rf, ok := ret.Get(0).(func() client.FieldIndexer); ok { r0 = rf() @@ -519,6 +563,10 @@ func (_c *Manager_GetFieldIndexer_Call) RunAndReturn(run func() client.FieldInde func (_m *Manager) GetHTTPClient() *http.Client { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetHTTPClient") + } + var r0 *http.Client if rf, ok := ret.Get(0).(func() *http.Client); ok { r0 = rf() @@ -562,6 +610,10 @@ func (_c *Manager_GetHTTPClient_Call) RunAndReturn(run func() *http.Client) *Man func (_m *Manager) GetLogger() logr.Logger { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetLogger") + } + var r0 logr.Logger if rf, ok := ret.Get(0).(func() logr.Logger); ok { r0 = rf() @@ -603,6 +655,10 @@ func (_c *Manager_GetLogger_Call) RunAndReturn(run func() logr.Logger) *Manager_ func (_m *Manager) GetRESTMapper() meta.RESTMapper { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetRESTMapper") + } + var r0 meta.RESTMapper if rf, ok := ret.Get(0).(func() meta.RESTMapper); ok { r0 = rf() @@ -646,6 +702,10 @@ func (_c *Manager_GetRESTMapper_Call) RunAndReturn(run func() meta.RESTMapper) * func (_m *Manager) GetScheme() *runtime.Scheme { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetScheme") + } + var r0 *runtime.Scheme if rf, ok := ret.Get(0).(func() *runtime.Scheme); ok { r0 = rf() @@ -689,6 +749,10 @@ func (_c *Manager_GetScheme_Call) RunAndReturn(run func() *runtime.Scheme) *Mana func (_m *Manager) GetWebhookServer() webhook.Server { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetWebhookServer") + } + var r0 webhook.Server if rf, ok := ret.Get(0).(func() webhook.Server); ok { r0 = rf() @@ -732,6 +796,10 @@ func (_c *Manager_GetWebhookServer_Call) RunAndReturn(run func() webhook.Server) func (_m *Manager) Start(ctx context.Context) error { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for Start") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context) error); ok { r0 = rf(ctx) diff --git a/pkg/k8s/chart/mocks/renderer.go b/pkg/k8s/chart/mocks/renderer.go index 09317e12..4f73adc8 100644 --- a/pkg/k8s/chart/mocks/renderer.go +++ b/pkg/k8s/chart/mocks/renderer.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.37.1. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks @@ -24,6 +24,10 @@ func (_m *Renderer) EXPECT() *Renderer_Expecter { func (_m *Renderer) RenderManifest(_a0 *chart.ReleaseInstance) (string, error) { ret := _m.Called(_a0) + if len(ret) == 0 { + panic("no return value specified for RenderManifest") + } + var r0 string var r1 error if rf, ok := ret.Get(0).(func(*chart.ReleaseInstance) (string, error)); ok { @@ -76,6 +80,10 @@ func (_c *Renderer_RenderManifest_Call) RunAndReturn(run func(*chart.ReleaseInst func (_m *Renderer) RenderManifestAsUnstructured(_a0 *chart.ReleaseInstance) (*chart.ManifestResources, error) { ret := _m.Called(_a0) + if len(ret) == 0 { + panic("no return value specified for RenderManifestAsUnstructured") + } + var r0 *chart.ManifestResources var r1 error if rf, ok := ret.Get(0).(func(*chart.ReleaseInstance) (*chart.ManifestResources, error)); ok { diff --git a/pkg/k8s/mocks/client.go b/pkg/k8s/mocks/client.go index 53d61583..001ccb31 100644 --- a/pkg/k8s/mocks/client.go +++ b/pkg/k8s/mocks/client.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.37.1. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks @@ -33,6 +33,10 @@ func (_m *Client) EXPECT() *Client_Expecter { func (_m *Client) Delete(_a0 context.Context, _a1 *unstructured.Unstructured) error { ret := _m.Called(_a0, _a1) + if len(ret) == 0 { + panic("no return value specified for Delete") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, *unstructured.Unstructured) error); ok { r0 = rf(_a0, _a1) @@ -76,6 +80,10 @@ func (_c *Client_Delete_Call) RunAndReturn(run func(context.Context, *unstructur func (_m *Client) DeletePVCsWithLabel(_a0 context.Context, _a1 string, _a2 string, _a3 string) error { ret := _m.Called(_a0, _a1, _a2, _a3) + if len(ret) == 0 { + panic("no return value specified for DeletePVCsWithLabel") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string, string, string) error); ok { r0 = rf(_a0, _a1, _a2, _a3) @@ -121,6 +129,10 @@ func (_c *Client_DeletePVCsWithLabel_Call) RunAndReturn(run func(context.Context func (_m *Client) DestinationRuleCRDExists(_a0 context.Context) (bool, error) { ret := _m.Called(_a0) + if len(ret) == 0 { + panic("no return value specified for DestinationRuleCRDExists") + } + var r0 bool var r1 error if rf, ok := ret.Get(0).(func(context.Context) (bool, error)); ok { @@ -173,6 +185,10 @@ func (_c *Client_DestinationRuleCRDExists_Call) RunAndReturn(run func(context.Co func (_m *Client) GetCRD(_a0 context.Context, _a1 string) (*v1.CustomResourceDefinition, error) { ret := _m.Called(_a0, _a1) + if len(ret) == 0 { + panic("no return value specified for GetCRD") + } + var r0 *v1.CustomResourceDefinition var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) (*v1.CustomResourceDefinition, error)); ok { @@ -228,6 +244,10 @@ func (_c *Client_GetCRD_Call) RunAndReturn(run func(context.Context, string) (*v func (_m *Client) GetSecret(_a0 context.Context, _a1 string, _a2 string) (*corev1.Secret, error) { ret := _m.Called(_a0, _a1, _a2) + if len(ret) == 0 { + panic("no return value specified for GetSecret") + } + var r0 *corev1.Secret var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, string) (*corev1.Secret, error)); ok { @@ -284,6 +304,10 @@ func (_c *Client_GetSecret_Call) RunAndReturn(run func(context.Context, string, func (_m *Client) GetStatefulSet(_a0 context.Context, _a1 string, _a2 string) (*appsv1.StatefulSet, error) { ret := _m.Called(_a0, _a1, _a2) + if len(ret) == 0 { + panic("no return value specified for GetStatefulSet") + } + var r0 *appsv1.StatefulSet var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, string) (*appsv1.StatefulSet, error)); ok { @@ -340,6 +364,10 @@ func (_c *Client_GetStatefulSet_Call) RunAndReturn(run func(context.Context, str func (_m *Client) PatchApply(_a0 context.Context, _a1 *unstructured.Unstructured) error { ret := _m.Called(_a0, _a1) + if len(ret) == 0 { + panic("no return value specified for PatchApply") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, *unstructured.Unstructured) error); ok { r0 = rf(_a0, _a1) diff --git a/pkg/manager/mocks/manager.go b/pkg/manager/mocks/manager.go index 9b6af3f5..7e193ef7 100644 --- a/pkg/manager/mocks/manager.go +++ b/pkg/manager/mocks/manager.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.37.1. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks @@ -31,6 +31,10 @@ func (_m *Manager) EXPECT() *Manager_Expecter { func (_m *Manager) DeleteInstance(_a0 context.Context, _a1 *chart.ReleaseInstance) error { ret := _m.Called(_a0, _a1) + if len(ret) == 0 { + panic("no return value specified for DeleteInstance") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, *chart.ReleaseInstance) error); ok { r0 = rf(_a0, _a1) @@ -74,6 +78,10 @@ func (_c *Manager_DeleteInstance_Call) RunAndReturn(run func(context.Context, *c func (_m *Manager) DeployInstance(_a0 context.Context, _a1 *chart.ReleaseInstance) error { ret := _m.Called(_a0, _a1) + if len(ret) == 0 { + panic("no return value specified for DeployInstance") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, *chart.ReleaseInstance) error); ok { r0 = rf(_a0, _a1) @@ -124,6 +132,10 @@ func (_m *Manager) GenerateNATSResources(_a0 *chart.ReleaseInstance, _a1 ...mana _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GenerateNATSResources") + } + var r0 *chart.ManifestResources var r1 error if rf, ok := ret.Get(0).(func(*chart.ReleaseInstance, ...manager.Option) (*chart.ManifestResources, error)); ok { @@ -186,6 +198,10 @@ func (_c *Manager_GenerateNATSResources_Call) RunAndReturn(run func(*chart.Relea func (_m *Manager) GenerateOverrides(_a0 *v1alpha1.NATSSpec, _a1 bool, _a2 bool) map[string]interface{} { ret := _m.Called(_a0, _a1, _a2) + if len(ret) == 0 { + panic("no return value specified for GenerateOverrides") + } + var r0 map[string]interface{} if rf, ok := ret.Get(0).(func(*v1alpha1.NATSSpec, bool, bool) map[string]interface{}); ok { r0 = rf(_a0, _a1, _a2) @@ -232,6 +248,10 @@ func (_c *Manager_GenerateOverrides_Call) RunAndReturn(run func(*v1alpha1.NATSSp func (_m *Manager) IsNATSStatefulSetReady(_a0 context.Context, _a1 *chart.ReleaseInstance) (bool, error) { ret := _m.Called(_a0, _a1) + if len(ret) == 0 { + panic("no return value specified for IsNATSStatefulSetReady") + } + var r0 bool var r1 error if rf, ok := ret.Get(0).(func(context.Context, *chart.ReleaseInstance) (bool, error)); ok { diff --git a/pkg/nats/mocks/client.go b/pkg/nats/mocks/client.go index 9dedba9e..cfc51e26 100644 --- a/pkg/nats/mocks/client.go +++ b/pkg/nats/mocks/client.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.37.1. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks @@ -57,6 +57,10 @@ func (_c *Client_Close_Call) RunAndReturn(run func()) *Client_Close_Call { func (_m *Client) ConsumersExist(streamName string) (bool, error) { ret := _m.Called(streamName) + if len(ret) == 0 { + panic("no return value specified for ConsumersExist") + } + var r0 bool var r1 error if rf, ok := ret.Get(0).(func(string) (bool, error)); ok { @@ -109,6 +113,10 @@ func (_c *Client_ConsumersExist_Call) RunAndReturn(run func(string) (bool, error func (_m *Client) GetStreams() ([]*nats_go.StreamInfo, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetStreams") + } + var r0 []*nats_go.StreamInfo var r1 error if rf, ok := ret.Get(0).(func() ([]*nats_go.StreamInfo, error)); ok { @@ -162,6 +170,10 @@ func (_c *Client_GetStreams_Call) RunAndReturn(run func() ([]*nats_go.StreamInfo func (_m *Client) Init() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Init") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -203,6 +215,10 @@ func (_c *Client_Init_Call) RunAndReturn(run func() error) *Client_Init_Call { func (_m *Client) StreamExists() (bool, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for StreamExists") + } + var r0 bool var r1 error if rf, ok := ret.Get(0).(func() (bool, error)); ok {