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/16 16:46:19 UTC
[plc4x] 02/07: test(plc4go/spi): ensure no global logger is set
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 ade41801b72fc437fe3925f39102b30ae4162748
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Fri Jun 16 16:08:40 2023 +0200
test(plc4go/spi): ensure no global logger is set
---
plc4go/spi/pool/executor_test.go | 6 ++----
plc4go/spi/transactions/RequestTransactionManager_test.go | 5 +----
plc4go/spi/transports/utils/TransportLogger_test.go | 3 +--
3 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/plc4go/spi/pool/executor_test.go b/plc4go/spi/pool/executor_test.go
index 81dd7485f1..ee126bb989 100644
--- a/plc4go/spi/pool/executor_test.go
+++ b/plc4go/spi/pool/executor_test.go
@@ -74,7 +74,6 @@ func Test_executor_IsRunning(t *testing.T) {
queueDepth int
workItems chan workItem
traceWorkers bool
- log zerolog.Logger
}
tests := []struct {
name string
@@ -94,7 +93,7 @@ func Test_executor_IsRunning(t *testing.T) {
queueDepth: tt.fields.queueDepth,
workItems: tt.fields.workItems,
traceWorkers: tt.fields.traceWorkers,
- log: tt.fields.log,
+ log: produceTestingLogger(t),
}
assert.Equalf(t, tt.want, e.IsRunning(), "IsRunning()")
})
@@ -419,7 +418,6 @@ func Test_executor_String(t *testing.T) {
queueDepth int
workItems chan workItem
traceWorkers bool
- log zerolog.Logger
}
tests := []struct {
name string
@@ -472,7 +470,7 @@ func Test_executor_String(t *testing.T) {
queueDepth: tt.fields.queueDepth,
workItems: tt.fields.workItems,
traceWorkers: tt.fields.traceWorkers,
- log: tt.fields.log,
+ log: produceTestingLogger(t),
}
assert.Equalf(t, tt.want, e.String(), "String()")
})
diff --git a/plc4go/spi/transactions/RequestTransactionManager_test.go b/plc4go/spi/transactions/RequestTransactionManager_test.go
index 3ebe3d2367..4113411419 100644
--- a/plc4go/spi/transactions/RequestTransactionManager_test.go
+++ b/plc4go/spi/transactions/RequestTransactionManager_test.go
@@ -260,7 +260,6 @@ func Test_requestTransactionManager_failRequest(t *testing.T) {
currentTransactionId int32
workLog list.List
executor pool.Executor
- log zerolog.Logger
}
type args struct {
transaction *requestTransaction
@@ -279,8 +278,6 @@ func Test_requestTransactionManager_failRequest(t *testing.T) {
transaction: &requestTransaction{},
},
mockSetup: func(t *testing.T, fields *fields, args *args) {
- fields.log = testutils.ProduceTestingLogger(t)
-
completionFuture := NewMockCompletionFuture(t)
expect := completionFuture.EXPECT()
expect.Cancel(true, nil).Return()
@@ -300,7 +297,7 @@ func Test_requestTransactionManager_failRequest(t *testing.T) {
currentTransactionId: tt.fields.currentTransactionId,
workLog: tt.fields.workLog,
executor: tt.fields.executor,
- log: tt.fields.log,
+ log: testutils.ProduceTestingLogger(t),
}
if err := r.failRequest(tt.args.transaction, tt.args.err); (err != nil) != tt.wantErr {
t.Errorf("failRequest() error = %v, wantErr %v", err, tt.wantErr)
diff --git a/plc4go/spi/transports/utils/TransportLogger_test.go b/plc4go/spi/transports/utils/TransportLogger_test.go
index a88f1aa988..fd341dd1ab 100644
--- a/plc4go/spi/transports/utils/TransportLogger_test.go
+++ b/plc4go/spi/transports/utils/TransportLogger_test.go
@@ -80,7 +80,6 @@ func TestTransportLogger_Close(t1 *testing.T) {
func TestTransportLogger_Read(t1 *testing.T) {
type fields struct {
source io.ReadWriteCloser
- log zerolog.Logger
}
type args struct {
p []byte
@@ -98,7 +97,7 @@ func TestTransportLogger_Read(t1 *testing.T) {
t1.Run(tt.name, func(t1 *testing.T) {
t := &TransportLogger{
source: tt.fields.source,
- log: tt.fields.log,
+ log: testutils.ProduceTestingLogger(t1),
}
got, err := t.Read(tt.args.p)
if (err != nil) != tt.wantErr {