Skip to content

Commit bb8c5da

Browse files
committed
Reduce tests log verbosity
1 parent c100e50 commit bb8c5da

File tree

7 files changed

+0
-58
lines changed

7 files changed

+0
-58
lines changed

common/deliverclient/blocksprovider/bft_censorship_monitor_test.go

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"testing"
1515
"time"
1616

17-
"github.com/hyperledger/fabric-lib-go/common/flogging"
1817
"github.com/hyperledger/fabric-protos-go-apiv2/common"
1918
"github.com/hyperledger/fabric-protos-go-apiv2/orderer"
2019
"github.com/pkg/errors"
@@ -26,8 +25,6 @@ import (
2625
)
2726

2827
func TestNewBFTCensorshipMonitor_New(t *testing.T) {
29-
flogging.ActivateSpec("debug")
30-
3128
s := newMonitorTestSetup(t, 5)
3229
mon := blocksprovider.NewBFTCensorshipMonitor(s.channelID, s.fakeUpdatableBlockVerifier, s.fakeRequester, s.fakeProgressReporter, s.sources, 0, blocksprovider.TimeoutConfig{})
3330
require.NotNil(t, mon)
@@ -37,8 +34,6 @@ func TestNewBFTCensorshipMonitor_New(t *testing.T) {
3734
// - start the monitor, with a single source
3835
// - stop the monitor without reading from error channel
3936
func TestBFTCensorshipMonitor_Stop(t *testing.T) {
40-
flogging.ActivateSpec("debug")
41-
4237
s := newMonitorTestSetup(t, 1)
4338
mon := blocksprovider.NewBFTCensorshipMonitor(s.channelID, s.fakeUpdatableBlockVerifier, s.fakeRequester, s.fakeProgressReporter, s.sources, 0, blocksprovider.TimeoutConfig{})
4439
require.NotNil(t, mon)
@@ -59,8 +54,6 @@ func TestBFTCensorshipMonitor_Stop(t *testing.T) {
5954
// - start the monitor, with a single source
6055
// - stop the monitor, ensure error channel contains an error
6156
func TestBFTCensorshipMonitor_StopWithErrors(t *testing.T) {
62-
flogging.ActivateSpec("debug")
63-
6457
s := newMonitorTestSetup(t, 1)
6558
mon := blocksprovider.NewBFTCensorshipMonitor(s.channelID, s.fakeUpdatableBlockVerifier, s.fakeRequester, s.fakeProgressReporter, s.sources, 0, blocksprovider.TimeoutConfig{})
6659
require.NotNil(t, mon)
@@ -88,8 +81,6 @@ func TestBFTCensorshipMonitor_StopWithErrors(t *testing.T) {
8881
// - start the monitor, with no sources
8982
// - monitor exits, ensure error channel contains an error
9083
func TestBFTCensorshipMonitor_NoSources(t *testing.T) {
91-
flogging.ActivateSpec("debug")
92-
9384
s := newMonitorTestSetup(t, 0)
9485
mon := blocksprovider.NewBFTCensorshipMonitor(s.channelID, s.fakeUpdatableBlockVerifier, s.fakeRequester, s.fakeProgressReporter, s.sources, 0, blocksprovider.TimeoutConfig{})
9586
require.NotNil(t, mon)
@@ -119,8 +110,6 @@ func TestBFTCensorshipMonitor_NoSources(t *testing.T) {
119110
// - no blocks, no headers, block progress is called repeatedly, returns zero value
120111
// - headers are seeked from 0
121112
func TestBFTCensorshipMonitor_NoHeadersNoBlocks(t *testing.T) {
122-
flogging.ActivateSpec("debug")
123-
124113
numOrderers := 4
125114
blockSource := 1
126115
tConfig := blocksprovider.TimeoutConfig{
@@ -193,8 +182,6 @@ func TestBFTCensorshipMonitor_NoHeadersNoBlocks(t *testing.T) {
193182
// - one header returns {8}
194183
// - suspicion raised, after timeout, censorship detected
195184
func TestBFTCensorshipMonitor_CensorshipDetected(t *testing.T) {
196-
flogging.ActivateSpec("debug")
197-
198185
numOrderers := 4
199186
blockSource := 0
200187
tConfig := blocksprovider.TimeoutConfig{
@@ -279,8 +266,6 @@ func TestBFTCensorshipMonitor_CensorshipDetected(t *testing.T) {
279266
// - suspicion raised, block advances to 8, then 9,
280267
// - after timeout, censorship detected on 10
281268
func TestBFTCensorshipMonitor_SuspicionsRemovedCensorshipDetected(t *testing.T) {
282-
flogging.ActivateSpec("debug")
283-
284269
numOrderers := 4
285270
blockSource := 0
286271
tConfig := blocksprovider.TimeoutConfig{
@@ -389,8 +374,6 @@ func TestBFTCensorshipMonitor_SuspicionsRemovedCensorshipDetected(t *testing.T)
389374
// - before timeout, new block (n+1) arrives, suspicion removed
390375
// - repeat the above x7, each time the header is coming from a different source
391376
func TestBFTCensorshipMonitor_SuspicionRemoved(t *testing.T) {
392-
flogging.ActivateSpec("debug")
393-
394377
numOrderers := 4
395378
blockSource := 0
396379
tConfig := blocksprovider.TimeoutConfig{
@@ -492,8 +475,6 @@ func TestBFTCensorshipMonitor_SuspicionRemoved(t *testing.T) {
492475
// - before timeout, new block (n+1) arrives, suspicion removed
493476
// - repeat the above x7, each time the header is coming from a different source
494477
func TestBFTCensorshipMonitor_FaultySourceIgnored(t *testing.T) {
495-
flogging.ActivateSpec("debug")
496-
497478
numOrderers := 7
498479
blockSource := 0
499480
tConfig := blocksprovider.TimeoutConfig{
@@ -608,8 +589,6 @@ func TestBFTCensorshipMonitor_FaultySourceIgnored(t *testing.T) {
608589
// - before timeout, new block (n+1) arrives, suspicion removed
609590
// - repeat the above x7, each time the header is coming from a different recovered source
610591
func TestBFTCensorshipMonitor_FaultySourceRecovery(t *testing.T) {
611-
flogging.ActivateSpec("debug")
612-
613592
numOrderers := 4
614593
blockSource := 0
615594
tConfig := blocksprovider.TimeoutConfig{

common/deliverclient/blocksprovider/bft_deliverer_test.go

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"time"
1616

1717
"github.com/hyperledger/fabric-lib-go/bccsp"
18-
"github.com/hyperledger/fabric-lib-go/common/flogging"
1918
"github.com/hyperledger/fabric-protos-go-apiv2/common"
2019
"github.com/hyperledger/fabric-protos-go-apiv2/orderer"
2120
. "github.com/onsi/gomega"
@@ -386,7 +385,6 @@ func TestBFTDeliverer_FatalErrors(t *testing.T) {
386385

387386
func TestBFTDeliverer_DialRetries(t *testing.T) {
388387
t.Run("Dial returns error, then succeeds", func(t *testing.T) {
389-
flogging.ActivateSpec("debug")
390388
setup := newBFTDelivererTestSetup(t)
391389
setup.initialize(t)
392390

@@ -417,7 +415,6 @@ func TestBFTDeliverer_DialRetries(t *testing.T) {
417415
})
418416

419417
t.Run("Dial returns several consecutive errors, exponential backoff, then succeeds", func(t *testing.T) {
420-
flogging.ActivateSpec("debug")
421418
setup := newBFTDelivererTestSetup(t)
422419
setup.initialize(t)
423420

@@ -469,7 +466,6 @@ func TestBFTDeliverer_DialRetries(t *testing.T) {
469466
})
470467

471468
t.Run("Dial returns repeated consecutive errors, exponential backoff saturates", func(t *testing.T) {
472-
flogging.ActivateSpec("debug")
473469
setup := newBFTDelivererTestSetup(t)
474470
setup.initialize(t)
475471

@@ -506,7 +502,6 @@ func TestBFTDeliverer_DialRetries(t *testing.T) {
506502
})
507503

508504
t.Run("Dial returns repeated consecutive errors, total sleep larger than MaxRetryDuration", func(t *testing.T) {
509-
flogging.ActivateSpec("debug")
510505
setup := newBFTDelivererTestSetup(t)
511506
setup.initialize(t)
512507

@@ -554,7 +549,6 @@ func TestBFTDeliverer_DialRetries(t *testing.T) {
554549

555550
func TestBFTDeliverer_DeliverRetries(t *testing.T) {
556551
t.Run("Deliver returns error, then succeeds", func(t *testing.T) {
557-
flogging.ActivateSpec("debug")
558552
setup := newBFTDelivererTestSetup(t)
559553
setup.initialize(t)
560554

@@ -582,7 +576,6 @@ func TestBFTDeliverer_DeliverRetries(t *testing.T) {
582576
})
583577

584578
t.Run("Deliver returns several consecutive errors, exponential backoff, then succeeds", func(t *testing.T) {
585-
flogging.ActivateSpec("debug")
586579
setup := newBFTDelivererTestSetup(t)
587580
setup.initialize(t)
588581

@@ -631,7 +624,6 @@ func TestBFTDeliverer_DeliverRetries(t *testing.T) {
631624
})
632625

633626
t.Run("Deliver returns repeated consecutive errors, exponential backoff saturates", func(t *testing.T) {
634-
flogging.ActivateSpec("debug")
635627
setup := newBFTDelivererTestSetup(t)
636628
setup.initialize(t)
637629

@@ -667,7 +659,6 @@ func TestBFTDeliverer_DeliverRetries(t *testing.T) {
667659

668660
func TestBFTDeliverer_BlockReception(t *testing.T) {
669661
t.Run("Block is valid", func(t *testing.T) {
670-
flogging.ActivateSpec("debug")
671662
setup := newBFTDelivererTestSetup(t)
672663
setup.initialize(t)
673664
startTime := time.Now()
@@ -720,7 +711,6 @@ func TestBFTDeliverer_BlockReception(t *testing.T) {
720711
})
721712

722713
t.Run("Block is invalid", func(t *testing.T) {
723-
flogging.ActivateSpec("debug")
724714
setup := newBFTDelivererTestSetup(t)
725715
setup.initialize(t)
726716

@@ -766,7 +756,6 @@ func TestBFTDeliverer_BlockReception(t *testing.T) {
766756
})
767757

768758
t.Run("Block handling fails", func(t *testing.T) {
769-
flogging.ActivateSpec("debug")
770759
setup := newBFTDelivererTestSetup(t)
771760
setup.initialize(t)
772761

@@ -813,7 +802,6 @@ func TestBFTDeliverer_BlockReception(t *testing.T) {
813802
})
814803

815804
t.Run("Block reception resets failure counter", func(t *testing.T) {
816-
flogging.ActivateSpec("debug")
817805
setup := newBFTDelivererTestSetup(t)
818806
setup.initialize(t)
819807

@@ -880,7 +868,6 @@ func TestBFTDeliverer_BlockReception(t *testing.T) {
880868
})
881869

882870
t.Run("Block reception resets total sleep time", func(t *testing.T) { // TODO
883-
flogging.ActivateSpec("debug")
884871
setup := newBFTDelivererTestSetup(t)
885872
setup.initialize(t)
886873
setup.fakeDurationExceededHandler.DurationExceededHandlerReturns(true)
@@ -953,7 +940,6 @@ func TestBFTDeliverer_BlockReception(t *testing.T) {
953940
})
954941

955942
t.Run("Config block is valid, updates verifier, updates connection-source", func(t *testing.T) {
956-
flogging.ActivateSpec("debug")
957943
setup := newBFTDelivererTestSetup(t)
958944
setup.initialize(t)
959945
setup.gWithT.Eventually(setup.fakeOrdererConnectionSource.UpdateCallCount, eventuallyTO).Should(Equal(1))
@@ -1045,8 +1031,6 @@ func TestBFTDeliverer_BlockReception(t *testing.T) {
10451031
func TestBFTDeliverer_CensorshipMonitorEvents(t *testing.T) {
10461032
for _, errVal := range []error{nil, errors.New("some error"), &blocksprovider.ErrFatal{Message: "some fatal error"}, &blocksprovider.ErrStopping{Message: "stopping"}} {
10471033
t.Run("unexpected error or value: "+fmt.Sprintf("%v", errVal), func(t *testing.T) {
1048-
flogging.ActivateSpec("debug")
1049-
10501034
setup := newBFTDelivererTestSetup(t)
10511035
setup.initialize(t)
10521036
setup.start()
@@ -1072,8 +1056,6 @@ func TestBFTDeliverer_CensorshipMonitorEvents(t *testing.T) {
10721056
}
10731057

10741058
t.Run("censorship", func(t *testing.T) {
1075-
flogging.ActivateSpec("debug")
1076-
10771059
setup := newBFTDelivererTestSetup(t)
10781060
setup.initialize(t)
10791061
setup.start()
@@ -1099,8 +1081,6 @@ func TestBFTDeliverer_CensorshipMonitorEvents(t *testing.T) {
10991081
})
11001082

11011083
t.Run("repeated censorship events, with exponential backoff", func(t *testing.T) {
1102-
flogging.ActivateSpec("debug")
1103-
11041084
setup := newBFTDelivererTestSetup(t)
11051085
setup.initialize(t)
11061086
setup.start()
@@ -1166,7 +1146,6 @@ func TestBFTDeliverer_CensorshipMonitorEvents(t *testing.T) {
11661146
}
11671147

11681148
func TestBFTDeliverer_RefreshEndpoints(t *testing.T) {
1169-
flogging.ActivateSpec("debug")
11701149
setup := newBFTDelivererTestSetup(t)
11711150
setup.initialize(t)
11721151

common/deliverclient/blocksprovider/bft_header_receiver_test.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"testing"
1313
"time"
1414

15-
"github.com/hyperledger/fabric-lib-go/common/flogging"
1615
"github.com/hyperledger/fabric-protos-go-apiv2/common"
1716
"github.com/hyperledger/fabric-protos-go-apiv2/orderer"
1817
"github.com/pkg/errors"
@@ -96,7 +95,6 @@ func TestBftHeaderReceiver_NilResponse(t *testing.T) {
9695
}
9796

9897
func TestBftHeaderReceiver_WithBlocks_Renew(t *testing.T) {
99-
flogging.ActivateSpec("debug")
10098
fakeBlockVerifier := &fake.UpdatableBlockVerifier{}
10199
fakeBlockVerifier.VerifyBlockAttestationCalls(naiveBlockVerifier)
102100
fakeBlockVerifier.CloneReturns(fakeBlockVerifier)
@@ -164,7 +162,6 @@ func TestBftHeaderReceiver_WithBlocks_Renew(t *testing.T) {
164162
}
165163

166164
func TestBftHeaderReceiver_WithBlocks_StopOnVerificationFailure(t *testing.T) {
167-
flogging.ActivateSpec("debug")
168165
fakeBlockVerifier := &fake.UpdatableBlockVerifier{}
169166
fakeBlockVerifier.VerifyBlockAttestationCalls(naiveBlockVerifier)
170167
fakeBlockVerifier.CloneReturns(fakeBlockVerifier)
@@ -224,7 +221,6 @@ func TestBftHeaderReceiver_WithBlocks_StopOnVerificationFailure(t *testing.T) {
224221
}
225222

226223
func TestBftHeaderReceiver_WithBlocks_ConfigVerification(t *testing.T) {
227-
flogging.ActivateSpec("debug")
228224
fakeBlockVerifier := &fake.UpdatableBlockVerifier{}
229225
fakeBlockVerifier.VerifyBlockAttestationCalls(naiveBlockVerifier)
230226
fakeBlockVerifier.CloneReturns(fakeBlockVerifier)
@@ -289,7 +285,6 @@ func TestBftHeaderReceiver_WithBlocks_ConfigVerification(t *testing.T) {
289285
}
290286

291287
func TestBftHeaderReceiver_VerifyOnce(t *testing.T) {
292-
flogging.ActivateSpec("debug")
293288
fakeBlockVerifier := &fake.UpdatableBlockVerifier{}
294289
fakeBlockVerifier.VerifyBlockAttestationCalls(naiveBlockVerifier)
295290
fakeBlockVerifier.CloneReturns(fakeBlockVerifier)

common/deliverclient/orderers/connection_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"sort"
1313
"strings"
1414

15-
"github.com/hyperledger/fabric-lib-go/common/flogging"
1615
. "github.com/onsi/ginkgo/v2"
1716
. "github.com/onsi/gomega"
1817

@@ -1078,7 +1077,6 @@ var _ = Describe("Connection", func() {
10781077
})
10791078

10801079
When("the global set of addresses shrinks, removing self endpoint", func() {
1081-
flogging.ActivateSpec("debug")
10821080
BeforeEach(func() {
10831081
cs.Update([]string{"global-addr2"}, map[string]orderers.OrdererOrg{
10841082
"org1": org1,

common/ledger/blkstorage/pkg_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"os"
1313
"testing"
1414

15-
"github.com/hyperledger/fabric-lib-go/common/flogging"
1615
"github.com/hyperledger/fabric-lib-go/common/metrics"
1716
"github.com/hyperledger/fabric-lib-go/common/metrics/disabled"
1817
"github.com/hyperledger/fabric-protos-go-apiv2/common"
@@ -24,7 +23,6 @@ import (
2423
)
2524

2625
func TestMain(m *testing.M) {
27-
flogging.ActivateSpec("blkstorage=debug")
2826
os.Exit(m.Run())
2927
}
3028

common/ledger/blockledger/fileledger/impl_test.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"fmt"
1212
"testing"
1313

14-
"github.com/hyperledger/fabric-lib-go/common/flogging"
1514
"github.com/hyperledger/fabric-lib-go/common/metrics/disabled"
1615
cb "github.com/hyperledger/fabric-protos-go-apiv2/common"
1716
ab "github.com/hyperledger/fabric-protos-go-apiv2/orderer"
@@ -28,10 +27,6 @@ import (
2827

2928
var genesisBlock = protoutil.NewBlock(0, nil)
3029

31-
func init() {
32-
flogging.ActivateSpec("common.ledger.blockledger.file=DEBUG")
33-
}
34-
3530
type testEnv struct {
3631
t *testing.T
3732
location string

common/ledger/util/leveldbhelper/leveldb_provider_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@ import (
1515

1616
"github.com/hyperledger/fabric-x-common/common/ledger/dataformat"
1717

18-
"github.com/hyperledger/fabric-lib-go/common/flogging"
1918
"github.com/stretchr/testify/require"
2019
)
2120

2221
func TestMain(m *testing.M) {
23-
flogging.ActivateSpec("leveldbhelper=debug")
2422
os.Exit(m.Run())
2523
}
2624

0 commit comments

Comments
 (0)