You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2023/06/01 19:50:55 UTC
[plc4x] 01/02: refactor(plc4go): switch from global loggers to local loggers
This is an automated email from the ASF dual-hosted git repository.
sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git
commit 04d235d1a8e9472e00763eb9766b0ff0a39291ef
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Thu Jun 1 21:50:33 2023 +0200
refactor(plc4go): switch from global loggers to local loggers
---
plc4go/internal/cbus/Reader_test.go | 6 ++
.../pkg/api/cache/mock_tracedPlcConnection_test.go | 15 ++--
plc4go/pkg/api/config/mock_WithOption_test.go | 93 ++++++++++++++++++++
.../knxnetip/readwrite/model/KnxManufacturer.go | 58 +++++++++++--
.../spi/default/mock_CustomMessageHandler_test.go | 98 ++++++++++++++++++++++
.../mock_DefaultPlcConnectionCloseResult_test.go | 15 ++--
plc4go/spi/pool/WorkerPool.go | 7 +-
plc4go/spi/pool/WorkerPool_test.go | 11 +++
plc4go/spi/tracer/mock_TracerProvider_test.go | 4 +-
9 files changed, 281 insertions(+), 26 deletions(-)
diff --git a/plc4go/internal/cbus/Reader_test.go b/plc4go/internal/cbus/Reader_test.go
index 646e5e04a2..bb93973550 100644
--- a/plc4go/internal/cbus/Reader_test.go
+++ b/plc4go/internal/cbus/Reader_test.go
@@ -445,6 +445,8 @@ func TestReader_sendMessageOverTheWire(t *testing.T) {
},
},
setup: func(t *testing.T, fields *fields, args *args) {
+ testutils.SetToTestingLogger(t, readWriteModel.Plc4xModelLog)
+
loggerOption := options.WithCustomLogger(testutils.ProduceTestingLogger(t))
transport := test.NewTransport(loggerOption)
@@ -558,6 +560,8 @@ func TestReader_sendMessageOverTheWire(t *testing.T) {
},
},
setup: func(t *testing.T, fields *fields, args *args) {
+ testutils.SetToTestingLogger(t, readWriteModel.Plc4xModelLog)
+
transaction := NewMockRequestTransaction(t)
expect := transaction.EXPECT()
expect.FailRequest(mock.Anything).Return(errors.New("Nope"))
@@ -649,6 +653,8 @@ func TestReader_sendMessageOverTheWire(t *testing.T) {
},
},
setup: func(t *testing.T, fields *fields, args *args) {
+ testutils.SetToTestingLogger(t, readWriteModel.Plc4xModelLog)
+
transaction := NewMockRequestTransaction(t)
expect := transaction.EXPECT()
expect.EndRequest().Return(nil)
diff --git a/plc4go/pkg/api/cache/mock_tracedPlcConnection_test.go b/plc4go/pkg/api/cache/mock_tracedPlcConnection_test.go
index 39011fc323..60270c886c 100644
--- a/plc4go/pkg/api/cache/mock_tracedPlcConnection_test.go
+++ b/plc4go/pkg/api/cache/mock_tracedPlcConnection_test.go
@@ -23,12 +23,13 @@ package cache
import (
context "context"
- spi "github.com/apache/plc4x/plc4go/spi/tracer"
model "github.com/apache/plc4x/plc4go/pkg/api/model"
mock "github.com/stretchr/testify/mock"
plc4go "github.com/apache/plc4x/plc4go/pkg/api"
+
+ tracer "github.com/apache/plc4x/plc4go/spi/tracer"
)
// mockTracedPlcConnection is an autogenerated mock type for the tracedPlcConnection type
@@ -334,15 +335,15 @@ func (_c *mockTracedPlcConnection_GetMetadata_Call) RunAndReturn(run func() mode
}
// GetTracer provides a mock function with given fields:
-func (_m *mockTracedPlcConnection) GetTracer() *spi.Tracer {
+func (_m *mockTracedPlcConnection) GetTracer() *tracer.Tracer {
ret := _m.Called()
- var r0 *spi.Tracer
- if rf, ok := ret.Get(0).(func() *spi.Tracer); ok {
+ var r0 *tracer.Tracer
+ if rf, ok := ret.Get(0).(func() *tracer.Tracer); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
- r0 = ret.Get(0).(*spi.Tracer)
+ r0 = ret.Get(0).(*tracer.Tracer)
}
}
@@ -366,12 +367,12 @@ func (_c *mockTracedPlcConnection_GetTracer_Call) Run(run func()) *mockTracedPlc
return _c
}
-func (_c *mockTracedPlcConnection_GetTracer_Call) Return(_a0 *spi.Tracer) *mockTracedPlcConnection_GetTracer_Call {
+func (_c *mockTracedPlcConnection_GetTracer_Call) Return(_a0 *tracer.Tracer) *mockTracedPlcConnection_GetTracer_Call {
_c.Call.Return(_a0)
return _c
}
-func (_c *mockTracedPlcConnection_GetTracer_Call) RunAndReturn(run func() *spi.Tracer) *mockTracedPlcConnection_GetTracer_Call {
+func (_c *mockTracedPlcConnection_GetTracer_Call) RunAndReturn(run func() *tracer.Tracer) *mockTracedPlcConnection_GetTracer_Call {
_c.Call.Return(run)
return _c
}
diff --git a/plc4go/pkg/api/config/mock_WithOption_test.go b/plc4go/pkg/api/config/mock_WithOption_test.go
new file mode 100644
index 0000000000..d82723c2e9
--- /dev/null
+++ b/plc4go/pkg/api/config/mock_WithOption_test.go
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ *
+ * https://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.
+ */
+
+// Code generated by mockery v2.28.1. DO NOT EDIT.
+
+package config
+
+import mock "github.com/stretchr/testify/mock"
+
+// MockWithOption is an autogenerated mock type for the WithOption type
+type MockWithOption struct {
+ mock.Mock
+}
+
+type MockWithOption_Expecter struct {
+ mock *mock.Mock
+}
+
+func (_m *MockWithOption) EXPECT() *MockWithOption_Expecter {
+ return &MockWithOption_Expecter{mock: &_m.Mock}
+}
+
+// isOption provides a mock function with given fields:
+func (_m *MockWithOption) isOption() bool {
+ ret := _m.Called()
+
+ var r0 bool
+ if rf, ok := ret.Get(0).(func() bool); ok {
+ r0 = rf()
+ } else {
+ r0 = ret.Get(0).(bool)
+ }
+
+ return r0
+}
+
+// MockWithOption_isOption_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'isOption'
+type MockWithOption_isOption_Call struct {
+ *mock.Call
+}
+
+// isOption is a helper method to define mock.On call
+func (_e *MockWithOption_Expecter) isOption() *MockWithOption_isOption_Call {
+ return &MockWithOption_isOption_Call{Call: _e.mock.On("isOption")}
+}
+
+func (_c *MockWithOption_isOption_Call) Run(run func()) *MockWithOption_isOption_Call {
+ _c.Call.Run(func(args mock.Arguments) {
+ run()
+ })
+ return _c
+}
+
+func (_c *MockWithOption_isOption_Call) Return(_a0 bool) *MockWithOption_isOption_Call {
+ _c.Call.Return(_a0)
+ return _c
+}
+
+func (_c *MockWithOption_isOption_Call) RunAndReturn(run func() bool) *MockWithOption_isOption_Call {
+ _c.Call.Return(run)
+ return _c
+}
+
+type mockConstructorTestingTNewMockWithOption interface {
+ mock.TestingT
+ Cleanup(func())
+}
+
+// NewMockWithOption creates a new instance of MockWithOption. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
+func NewMockWithOption(t mockConstructorTestingTNewMockWithOption) *MockWithOption {
+ mock := &MockWithOption{}
+ mock.Mock.Test(t)
+
+ t.Cleanup(func() { mock.AssertExpectations(t) })
+
+ return mock
+}
diff --git a/plc4go/protocols/knxnetip/readwrite/model/KnxManufacturer.go b/plc4go/protocols/knxnetip/readwrite/model/KnxManufacturer.go
index bb3544cf7a..3e3e380a49 100644
--- a/plc4go/protocols/knxnetip/readwrite/model/KnxManufacturer.go
+++ b/plc4go/protocols/knxnetip/readwrite/model/KnxManufacturer.go
@@ -670,8 +670,11 @@ const (
KnxManufacturer_M_LENGEN KnxManufacturer = 627
KnxManufacturer_M_SHENZHEN_EXC_LED_TECHNOLOGY_CO__LTD KnxManufacturer = 628
KnxManufacturer_M_VIBROXX_FZCO KnxManufacturer = 629
- KnxManufacturer_M_ABB___RESERVED KnxManufacturer = 630
- KnxManufacturer_M_BUSCH_JAEGER_ELEKTRO___RESERVED KnxManufacturer = 631
+ KnxManufacturer_M_SUZHOU_HONGYUN_INTELLIGENT_TECHNOLOGYCO___LTD KnxManufacturer = 630
+ KnxManufacturer_M_PASSIV_ENERGIE_GMBH KnxManufacturer = 631
+ KnxManufacturer_M_PAYNE_TECHNOLOGIES_LTD KnxManufacturer = 632
+ KnxManufacturer_M_ABB___RESERVED KnxManufacturer = 633
+ KnxManufacturer_M_BUSCH_JAEGER_ELEKTRO___RESERVED KnxManufacturer = 634
)
var KnxManufacturerValues []KnxManufacturer
@@ -1309,6 +1312,9 @@ func init() {
KnxManufacturer_M_LENGEN,
KnxManufacturer_M_SHENZHEN_EXC_LED_TECHNOLOGY_CO__LTD,
KnxManufacturer_M_VIBROXX_FZCO,
+ KnxManufacturer_M_SUZHOU_HONGYUN_INTELLIGENT_TECHNOLOGYCO___LTD,
+ KnxManufacturer_M_PASSIV_ENERGIE_GMBH,
+ KnxManufacturer_M_PAYNE_TECHNOLOGIES_LTD,
KnxManufacturer_M_ABB___RESERVED,
KnxManufacturer_M_BUSCH_JAEGER_ELEKTRO___RESERVED,
}
@@ -3682,10 +3688,22 @@ func (e KnxManufacturer) Number() uint16 {
}
case 630:
{ /* '630' */
- return 43954
+ return 687
}
case 631:
{ /* '631' */
+ return 688
+ }
+ case 632:
+ { /* '632' */
+ return 689
+ }
+ case 633:
+ { /* '633' */
+ return 43954
+ }
+ case 634:
+ { /* '634' */
return 43959
}
case 64:
@@ -6228,10 +6246,22 @@ func (e KnxManufacturer) Name() string {
}
case 630:
{ /* '630' */
- return "ABB - reserved"
+ return "Suzhou Hongyun Intelligent TechnologyCo., Ltd"
}
case 631:
{ /* '631' */
+ return "Passiv Energie GmbH"
+ }
+ case 632:
+ { /* '632' */
+ return "Payne Technologies Ltd"
+ }
+ case 633:
+ { /* '633' */
+ return "ABB - reserved"
+ }
+ case 634:
+ { /* '634' */
return "Busch-Jaeger Elektro - reserved"
}
case 64:
@@ -7590,8 +7620,14 @@ func KnxManufacturerByValue(value uint16) (enum KnxManufacturer, ok bool) {
case 63:
return KnxManufacturer_M_WHD_WILHELM_HUBER_Plus_SOEHNE, true
case 630:
- return KnxManufacturer_M_ABB___RESERVED, true
+ return KnxManufacturer_M_SUZHOU_HONGYUN_INTELLIGENT_TECHNOLOGYCO___LTD, true
case 631:
+ return KnxManufacturer_M_PASSIV_ENERGIE_GMBH, true
+ case 632:
+ return KnxManufacturer_M_PAYNE_TECHNOLOGIES_LTD, true
+ case 633:
+ return KnxManufacturer_M_ABB___RESERVED, true
+ case 634:
return KnxManufacturer_M_BUSCH_JAEGER_ELEKTRO___RESERVED, true
case 64:
return KnxManufacturer_M_BISCHOFF_ELEKTRONIK, true
@@ -8859,6 +8895,12 @@ func KnxManufacturerByName(value string) (enum KnxManufacturer, ok bool) {
return KnxManufacturer_M_VIBROXX_FZCO, true
case "M_WHD_WILHELM_HUBER_Plus_SOEHNE":
return KnxManufacturer_M_WHD_WILHELM_HUBER_Plus_SOEHNE, true
+ case "M_SUZHOU_HONGYUN_INTELLIGENT_TECHNOLOGYCO___LTD":
+ return KnxManufacturer_M_SUZHOU_HONGYUN_INTELLIGENT_TECHNOLOGYCO___LTD, true
+ case "M_PASSIV_ENERGIE_GMBH":
+ return KnxManufacturer_M_PASSIV_ENERGIE_GMBH, true
+ case "M_PAYNE_TECHNOLOGIES_LTD":
+ return KnxManufacturer_M_PAYNE_TECHNOLOGIES_LTD, true
case "M_ABB___RESERVED":
return KnxManufacturer_M_ABB___RESERVED, true
case "M_BUSCH_JAEGER_ELEKTRO___RESERVED":
@@ -10186,6 +10228,12 @@ func (e KnxManufacturer) PLC4XEnumName() string {
return "M_VIBROXX_FZCO"
case KnxManufacturer_M_WHD_WILHELM_HUBER_Plus_SOEHNE:
return "M_WHD_WILHELM_HUBER_Plus_SOEHNE"
+ case KnxManufacturer_M_SUZHOU_HONGYUN_INTELLIGENT_TECHNOLOGYCO___LTD:
+ return "M_SUZHOU_HONGYUN_INTELLIGENT_TECHNOLOGYCO___LTD"
+ case KnxManufacturer_M_PASSIV_ENERGIE_GMBH:
+ return "M_PASSIV_ENERGIE_GMBH"
+ case KnxManufacturer_M_PAYNE_TECHNOLOGIES_LTD:
+ return "M_PAYNE_TECHNOLOGIES_LTD"
case KnxManufacturer_M_ABB___RESERVED:
return "M_ABB___RESERVED"
case KnxManufacturer_M_BUSCH_JAEGER_ELEKTRO___RESERVED:
diff --git a/plc4go/spi/default/mock_CustomMessageHandler_test.go b/plc4go/spi/default/mock_CustomMessageHandler_test.go
new file mode 100644
index 0000000000..3752266d09
--- /dev/null
+++ b/plc4go/spi/default/mock_CustomMessageHandler_test.go
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ *
+ * https://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.
+ */
+
+// Code generated by mockery v2.28.1. DO NOT EDIT.
+
+package _default
+
+import (
+ spi "github.com/apache/plc4x/plc4go/spi"
+ mock "github.com/stretchr/testify/mock"
+)
+
+// MockCustomMessageHandler is an autogenerated mock type for the CustomMessageHandler type
+type MockCustomMessageHandler struct {
+ mock.Mock
+}
+
+type MockCustomMessageHandler_Expecter struct {
+ mock *mock.Mock
+}
+
+func (_m *MockCustomMessageHandler) EXPECT() *MockCustomMessageHandler_Expecter {
+ return &MockCustomMessageHandler_Expecter{mock: &_m.Mock}
+}
+
+// Execute provides a mock function with given fields: codec, message
+func (_m *MockCustomMessageHandler) Execute(codec DefaultCodecRequirements, message spi.Message) bool {
+ ret := _m.Called(codec, message)
+
+ var r0 bool
+ if rf, ok := ret.Get(0).(func(DefaultCodecRequirements, spi.Message) bool); ok {
+ r0 = rf(codec, message)
+ } else {
+ r0 = ret.Get(0).(bool)
+ }
+
+ return r0
+}
+
+// MockCustomMessageHandler_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute'
+type MockCustomMessageHandler_Execute_Call struct {
+ *mock.Call
+}
+
+// Execute is a helper method to define mock.On call
+// - codec DefaultCodecRequirements
+// - message spi.Message
+func (_e *MockCustomMessageHandler_Expecter) Execute(codec interface{}, message interface{}) *MockCustomMessageHandler_Execute_Call {
+ return &MockCustomMessageHandler_Execute_Call{Call: _e.mock.On("Execute", codec, message)}
+}
+
+func (_c *MockCustomMessageHandler_Execute_Call) Run(run func(codec DefaultCodecRequirements, message spi.Message)) *MockCustomMessageHandler_Execute_Call {
+ _c.Call.Run(func(args mock.Arguments) {
+ run(args[0].(DefaultCodecRequirements), args[1].(spi.Message))
+ })
+ return _c
+}
+
+func (_c *MockCustomMessageHandler_Execute_Call) Return(_a0 bool) *MockCustomMessageHandler_Execute_Call {
+ _c.Call.Return(_a0)
+ return _c
+}
+
+func (_c *MockCustomMessageHandler_Execute_Call) RunAndReturn(run func(DefaultCodecRequirements, spi.Message) bool) *MockCustomMessageHandler_Execute_Call {
+ _c.Call.Return(run)
+ return _c
+}
+
+type mockConstructorTestingTNewMockCustomMessageHandler interface {
+ mock.TestingT
+ Cleanup(func())
+}
+
+// NewMockCustomMessageHandler creates a new instance of MockCustomMessageHandler. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
+func NewMockCustomMessageHandler(t mockConstructorTestingTNewMockCustomMessageHandler) *MockCustomMessageHandler {
+ mock := &MockCustomMessageHandler{}
+ mock.Mock.Test(t)
+
+ t.Cleanup(func() { mock.AssertExpectations(t) })
+
+ return mock
+}
diff --git a/plc4go/spi/default/mock_DefaultPlcConnectionCloseResult_test.go b/plc4go/spi/default/mock_DefaultPlcConnectionCloseResult_test.go
index 5ae4cd4380..73c5ce55dd 100644
--- a/plc4go/spi/default/mock_DefaultPlcConnectionCloseResult_test.go
+++ b/plc4go/spi/default/mock_DefaultPlcConnectionCloseResult_test.go
@@ -23,8 +23,9 @@ package _default
import (
plc4go "github.com/apache/plc4x/plc4go/pkg/api"
- spi "github.com/apache/plc4x/plc4go/spi/tracer"
mock "github.com/stretchr/testify/mock"
+
+ tracer "github.com/apache/plc4x/plc4go/spi/tracer"
)
// MockDefaultPlcConnectionCloseResult is an autogenerated mock type for the DefaultPlcConnectionCloseResult type
@@ -125,15 +126,15 @@ func (_c *MockDefaultPlcConnectionCloseResult_GetErr_Call) RunAndReturn(run func
}
// GetTraces provides a mock function with given fields:
-func (_m *MockDefaultPlcConnectionCloseResult) GetTraces() []spi.TraceEntry {
+func (_m *MockDefaultPlcConnectionCloseResult) GetTraces() []tracer.TraceEntry {
ret := _m.Called()
- var r0 []spi.TraceEntry
- if rf, ok := ret.Get(0).(func() []spi.TraceEntry); ok {
+ var r0 []tracer.TraceEntry
+ if rf, ok := ret.Get(0).(func() []tracer.TraceEntry); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
- r0 = ret.Get(0).([]spi.TraceEntry)
+ r0 = ret.Get(0).([]tracer.TraceEntry)
}
}
@@ -157,12 +158,12 @@ func (_c *MockDefaultPlcConnectionCloseResult_GetTraces_Call) Run(run func()) *M
return _c
}
-func (_c *MockDefaultPlcConnectionCloseResult_GetTraces_Call) Return(_a0 []spi.TraceEntry) *MockDefaultPlcConnectionCloseResult_GetTraces_Call {
+func (_c *MockDefaultPlcConnectionCloseResult_GetTraces_Call) Return(_a0 []tracer.TraceEntry) *MockDefaultPlcConnectionCloseResult_GetTraces_Call {
_c.Call.Return(_a0)
return _c
}
-func (_c *MockDefaultPlcConnectionCloseResult_GetTraces_Call) RunAndReturn(run func() []spi.TraceEntry) *MockDefaultPlcConnectionCloseResult_GetTraces_Call {
+func (_c *MockDefaultPlcConnectionCloseResult_GetTraces_Call) RunAndReturn(run func() []tracer.TraceEntry) *MockDefaultPlcConnectionCloseResult_GetTraces_Call {
_c.Call.Return(run)
return _c
}
diff --git a/plc4go/spi/pool/WorkerPool.go b/plc4go/spi/pool/WorkerPool.go
index ae1f59849f..c1881f1297 100644
--- a/plc4go/spi/pool/WorkerPool.go
+++ b/plc4go/spi/pool/WorkerPool.go
@@ -25,7 +25,6 @@ import (
"github.com/apache/plc4x/plc4go/spi/options"
"github.com/pkg/errors"
"github.com/rs/zerolog"
- "github.com/rs/zerolog/log"
"io"
"runtime/debug"
"sync"
@@ -65,7 +64,7 @@ func (w *worker) work() {
w.work()
}
}()
- workerLog := log.With().Int("Worker id", w.id).Logger()
+ workerLog := w.log.With().Int("Worker id", w.id).Logger()
if !w.executor.traceWorkers {
workerLog = zerolog.Nop()
}
@@ -187,7 +186,7 @@ func NewDynamicExecutor(maxNumberOfWorkers, queueDepth int, _options ...options.
customLogger.Error().Msgf("panic-ed %v", err)
}
}()
- workerLog := log.With().Str("Worker type", "spawner").Logger()
+ workerLog := customLogger.With().Str("Worker type", "spawner").Logger()
if !_executor.traceWorkers {
workerLog = zerolog.Nop()
}
@@ -223,7 +222,7 @@ func NewDynamicExecutor(maxNumberOfWorkers, queueDepth int, _options ...options.
_executor.log.Error().Msgf("panic-ed %v", err)
}
}()
- workerLog := log.With().Str("Worker type", "killer").Logger()
+ workerLog := customLogger.With().Str("Worker type", "killer").Logger()
if !_executor.traceWorkers {
workerLog = zerolog.Nop()
}
diff --git a/plc4go/spi/pool/WorkerPool_test.go b/plc4go/spi/pool/WorkerPool_test.go
index d940b1c545..d19448ec6e 100644
--- a/plc4go/spi/pool/WorkerPool_test.go
+++ b/plc4go/spi/pool/WorkerPool_test.go
@@ -24,6 +24,7 @@ import (
"fmt"
"github.com/apache/plc4x/plc4go/spi/options"
"github.com/pkg/errors"
+ "github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
"math/rand"
"testing"
@@ -277,6 +278,7 @@ func TestNewDynamicExecutor(t *testing.T) {
tests := []struct {
name string
args args
+ setup func(*testing.T, *args)
manipulator func(*testing.T, *executor)
executorValidator func(*testing.T, *executor) bool
}{
@@ -287,6 +289,9 @@ func TestNewDynamicExecutor(t *testing.T) {
queueDepth: 14,
options: []options.WithOption{WithExecutorOptionTracerWorkers(true)},
},
+ setup: func(t *testing.T, args *args) {
+ args.options = append(args.options, options.WithCustomLogger(zerolog.New(zerolog.NewConsoleWriter(zerolog.ConsoleTestWriter(t)))))
+ },
executorValidator: func(t *testing.T, e *executor) bool {
assert.False(t, e.running)
assert.False(t, e.shutdown)
@@ -302,6 +307,9 @@ func TestNewDynamicExecutor(t *testing.T) {
queueDepth: 2,
options: []options.WithOption{WithExecutorOptionTracerWorkers(true)},
},
+ setup: func(t *testing.T, args *args) {
+ args.options = append(args.options, options.WithCustomLogger(zerolog.New(zerolog.NewConsoleWriter(zerolog.ConsoleTestWriter(t)))))
+ },
manipulator: func(t *testing.T, e *executor) {
{
oldUpScaleInterval := upScaleInterval
@@ -356,6 +364,9 @@ func TestNewDynamicExecutor(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
+ if tt.setup != nil {
+ tt.setup(t, &tt.args)
+ }
fixedSizeExecutor := NewDynamicExecutor(tt.args.numberOfWorkers, tt.args.queueDepth, tt.args.options...)
defer fixedSizeExecutor.Stop()
if tt.manipulator != nil {
diff --git a/plc4go/spi/tracer/mock_TracerProvider_test.go b/plc4go/spi/tracer/mock_TracerProvider_test.go
index 1c5b011293..cd6132586b 100644
--- a/plc4go/spi/tracer/mock_TracerProvider_test.go
+++ b/plc4go/spi/tracer/mock_TracerProvider_test.go
@@ -21,9 +21,7 @@
package tracer
-import (
- mock "github.com/stretchr/testify/mock"
-)
+import mock "github.com/stretchr/testify/mock"
// MockTracerProvider is an autogenerated mock type for the TracerProvider type
type MockTracerProvider struct {