From a572fc17766947f0121a837df488b9fc48d50048 Mon Sep 17 00:00:00 2001 From: Kaung Zin Hein <83657429+Zen-cronic@users.noreply.github.com> Date: Sun, 11 Aug 2024 18:00:30 -0400 Subject: [PATCH] Regenerate mocks (#5821) ## Which problem is this PR solving? - Resolves #5818 ## Description of the changes - Generate mocked interfaces in `plugin/storage/grpc/shared/mocks` instead of `plugin/storage/grpc/mocks` ## How was this change tested? - `make test` ## Checklist - [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md - [x] I have signed all commits - [ ] I have added unit tests for the new functionality - [x] I have run lint and test steps successfully - for `jaeger`: `make lint test` - for `jaeger-ui`: `yarn lint` and `yarn test` --------- Signed-off-by: Kaung Zin Hein Co-authored-by: Yuri Shkuro Signed-off-by: Jared Tan --- .mockery.yaml | 2 +- plugin/storage/grpc/factory_test.go | 2 +- .../storage/grpc/mocks/PluginCapabilities.go | 51 --------------- .../grpc/shared/mocks/PluginCapabilities.go | 62 +++++++++++++++++++ 4 files changed, 64 insertions(+), 53 deletions(-) delete mode 100644 plugin/storage/grpc/mocks/PluginCapabilities.go create mode 100644 plugin/storage/grpc/shared/mocks/PluginCapabilities.go diff --git a/.mockery.yaml b/.mockery.yaml index 9f46e45ae229..48f9c27d4b98 100644 --- a/.mockery.yaml +++ b/.mockery.yaml @@ -42,7 +42,7 @@ packages: github.com/jaegertracing/jaeger/plugin/sampling/leaderelection: config: all: true - github.com/jaegertracing/jaeger/plugin/storage/grpc: + github.com/jaegertracing/jaeger/plugin/storage/grpc/shared: interfaces: PluginCapabilities: github.com/jaegertracing/jaeger/plugin/storage/kafka: diff --git a/plugin/storage/grpc/factory_test.go b/plugin/storage/grpc/factory_test.go index 94e1b0c4ddc0..36dcf885dd73 100644 --- a/plugin/storage/grpc/factory_test.go +++ b/plugin/storage/grpc/factory_test.go @@ -34,8 +34,8 @@ import ( "github.com/jaegertracing/jaeger/pkg/config" "github.com/jaegertracing/jaeger/pkg/metrics" - "github.com/jaegertracing/jaeger/plugin/storage/grpc/mocks" "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" + "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared/mocks" "github.com/jaegertracing/jaeger/storage" "github.com/jaegertracing/jaeger/storage/dependencystore" dependencyStoreMocks "github.com/jaegertracing/jaeger/storage/dependencystore/mocks" diff --git a/plugin/storage/grpc/mocks/PluginCapabilities.go b/plugin/storage/grpc/mocks/PluginCapabilities.go deleted file mode 100644 index 7d72d6235948..000000000000 --- a/plugin/storage/grpc/mocks/PluginCapabilities.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. - -// Copyright (c) 2020 The Jaeger Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package mocks - -import ( - mock "github.com/stretchr/testify/mock" - - "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" -) - -// PluginCapabilities is an autogenerated mock type for the PluginCapabilities type -type PluginCapabilities struct { - mock.Mock -} - -// Capabilities provides a mock function with given fields: -func (_m *PluginCapabilities) Capabilities() (*shared.Capabilities, error) { - ret := _m.Called() - - var r0 *shared.Capabilities - if rf, ok := ret.Get(0).(func() *shared.Capabilities); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*shared.Capabilities) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} diff --git a/plugin/storage/grpc/shared/mocks/PluginCapabilities.go b/plugin/storage/grpc/shared/mocks/PluginCapabilities.go new file mode 100644 index 000000000000..abe2c24a9820 --- /dev/null +++ b/plugin/storage/grpc/shared/mocks/PluginCapabilities.go @@ -0,0 +1,62 @@ +// Copyright (c) The Jaeger Authors. +// SPDX-License-Identifier: Apache-2.0 +// +// Run 'make generate-mocks' to regenerate. + +// Code generated by mockery. DO NOT EDIT. + +package mocks + +import ( + shared "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" + mock "github.com/stretchr/testify/mock" +) + +// PluginCapabilities is an autogenerated mock type for the PluginCapabilities type +type PluginCapabilities struct { + mock.Mock +} + +// Capabilities provides a mock function with given fields: +func (_m *PluginCapabilities) Capabilities() (*shared.Capabilities, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Capabilities") + } + + var r0 *shared.Capabilities + var r1 error + if rf, ok := ret.Get(0).(func() (*shared.Capabilities, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() *shared.Capabilities); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*shared.Capabilities) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// NewPluginCapabilities creates a new instance of PluginCapabilities. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewPluginCapabilities(t interface { + mock.TestingT + Cleanup(func()) +}) *PluginCapabilities { + mock := &PluginCapabilities{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +}