diff --git a/common/deliverclient/blocksprovider/bft_censorship_monitor_test.go b/common/deliverclient/blocksprovider/bft_censorship_monitor_test.go index ae67971f0..12ec3d7a9 100644 --- a/common/deliverclient/blocksprovider/bft_censorship_monitor_test.go +++ b/common/deliverclient/blocksprovider/bft_censorship_monitor_test.go @@ -14,7 +14,6 @@ import ( "testing" "time" - "github.com/hyperledger/fabric-lib-go/common/flogging" "github.com/hyperledger/fabric-protos-go-apiv2/common" "github.com/hyperledger/fabric-protos-go-apiv2/orderer" "github.com/pkg/errors" @@ -26,8 +25,6 @@ import ( ) func TestNewBFTCensorshipMonitor_New(t *testing.T) { - flogging.ActivateSpec("debug") - s := newMonitorTestSetup(t, 5) mon := blocksprovider.NewBFTCensorshipMonitor(s.channelID, s.fakeUpdatableBlockVerifier, s.fakeRequester, s.fakeProgressReporter, s.sources, 0, blocksprovider.TimeoutConfig{}) require.NotNil(t, mon) @@ -37,8 +34,6 @@ func TestNewBFTCensorshipMonitor_New(t *testing.T) { // - start the monitor, with a single source // - stop the monitor without reading from error channel func TestBFTCensorshipMonitor_Stop(t *testing.T) { - flogging.ActivateSpec("debug") - s := newMonitorTestSetup(t, 1) mon := blocksprovider.NewBFTCensorshipMonitor(s.channelID, s.fakeUpdatableBlockVerifier, s.fakeRequester, s.fakeProgressReporter, s.sources, 0, blocksprovider.TimeoutConfig{}) require.NotNil(t, mon) @@ -59,8 +54,6 @@ func TestBFTCensorshipMonitor_Stop(t *testing.T) { // - start the monitor, with a single source // - stop the monitor, ensure error channel contains an error func TestBFTCensorshipMonitor_StopWithErrors(t *testing.T) { - flogging.ActivateSpec("debug") - s := newMonitorTestSetup(t, 1) mon := blocksprovider.NewBFTCensorshipMonitor(s.channelID, s.fakeUpdatableBlockVerifier, s.fakeRequester, s.fakeProgressReporter, s.sources, 0, blocksprovider.TimeoutConfig{}) require.NotNil(t, mon) @@ -88,8 +81,6 @@ func TestBFTCensorshipMonitor_StopWithErrors(t *testing.T) { // - start the monitor, with no sources // - monitor exits, ensure error channel contains an error func TestBFTCensorshipMonitor_NoSources(t *testing.T) { - flogging.ActivateSpec("debug") - s := newMonitorTestSetup(t, 0) mon := blocksprovider.NewBFTCensorshipMonitor(s.channelID, s.fakeUpdatableBlockVerifier, s.fakeRequester, s.fakeProgressReporter, s.sources, 0, blocksprovider.TimeoutConfig{}) require.NotNil(t, mon) @@ -119,8 +110,6 @@ func TestBFTCensorshipMonitor_NoSources(t *testing.T) { // - no blocks, no headers, block progress is called repeatedly, returns zero value // - headers are seeked from 0 func TestBFTCensorshipMonitor_NoHeadersNoBlocks(t *testing.T) { - flogging.ActivateSpec("debug") - numOrderers := 4 blockSource := 1 tConfig := blocksprovider.TimeoutConfig{ @@ -193,8 +182,6 @@ func TestBFTCensorshipMonitor_NoHeadersNoBlocks(t *testing.T) { // - one header returns {8} // - suspicion raised, after timeout, censorship detected func TestBFTCensorshipMonitor_CensorshipDetected(t *testing.T) { - flogging.ActivateSpec("debug") - numOrderers := 4 blockSource := 0 tConfig := blocksprovider.TimeoutConfig{ @@ -279,8 +266,6 @@ func TestBFTCensorshipMonitor_CensorshipDetected(t *testing.T) { // - suspicion raised, block advances to 8, then 9, // - after timeout, censorship detected on 10 func TestBFTCensorshipMonitor_SuspicionsRemovedCensorshipDetected(t *testing.T) { - flogging.ActivateSpec("debug") - numOrderers := 4 blockSource := 0 tConfig := blocksprovider.TimeoutConfig{ @@ -389,8 +374,6 @@ func TestBFTCensorshipMonitor_SuspicionsRemovedCensorshipDetected(t *testing.T) // - before timeout, new block (n+1) arrives, suspicion removed // - repeat the above x7, each time the header is coming from a different source func TestBFTCensorshipMonitor_SuspicionRemoved(t *testing.T) { - flogging.ActivateSpec("debug") - numOrderers := 4 blockSource := 0 tConfig := blocksprovider.TimeoutConfig{ @@ -492,8 +475,6 @@ func TestBFTCensorshipMonitor_SuspicionRemoved(t *testing.T) { // - before timeout, new block (n+1) arrives, suspicion removed // - repeat the above x7, each time the header is coming from a different source func TestBFTCensorshipMonitor_FaultySourceIgnored(t *testing.T) { - flogging.ActivateSpec("debug") - numOrderers := 7 blockSource := 0 tConfig := blocksprovider.TimeoutConfig{ @@ -608,8 +589,6 @@ func TestBFTCensorshipMonitor_FaultySourceIgnored(t *testing.T) { // - before timeout, new block (n+1) arrives, suspicion removed // - repeat the above x7, each time the header is coming from a different recovered source func TestBFTCensorshipMonitor_FaultySourceRecovery(t *testing.T) { - flogging.ActivateSpec("debug") - numOrderers := 4 blockSource := 0 tConfig := blocksprovider.TimeoutConfig{ diff --git a/common/deliverclient/blocksprovider/bft_deliverer_test.go b/common/deliverclient/blocksprovider/bft_deliverer_test.go index a577ef5d0..1b837c392 100644 --- a/common/deliverclient/blocksprovider/bft_deliverer_test.go +++ b/common/deliverclient/blocksprovider/bft_deliverer_test.go @@ -15,7 +15,6 @@ import ( "time" "github.com/hyperledger/fabric-lib-go/bccsp" - "github.com/hyperledger/fabric-lib-go/common/flogging" "github.com/hyperledger/fabric-protos-go-apiv2/common" "github.com/hyperledger/fabric-protos-go-apiv2/orderer" . "github.com/onsi/gomega" @@ -386,7 +385,6 @@ func TestBFTDeliverer_FatalErrors(t *testing.T) { func TestBFTDeliverer_DialRetries(t *testing.T) { t.Run("Dial returns error, then succeeds", func(t *testing.T) { - flogging.ActivateSpec("debug") setup := newBFTDelivererTestSetup(t) setup.initialize(t) @@ -417,7 +415,6 @@ func TestBFTDeliverer_DialRetries(t *testing.T) { }) t.Run("Dial returns several consecutive errors, exponential backoff, then succeeds", func(t *testing.T) { - flogging.ActivateSpec("debug") setup := newBFTDelivererTestSetup(t) setup.initialize(t) @@ -469,7 +466,6 @@ func TestBFTDeliverer_DialRetries(t *testing.T) { }) t.Run("Dial returns repeated consecutive errors, exponential backoff saturates", func(t *testing.T) { - flogging.ActivateSpec("debug") setup := newBFTDelivererTestSetup(t) setup.initialize(t) @@ -506,7 +502,6 @@ func TestBFTDeliverer_DialRetries(t *testing.T) { }) t.Run("Dial returns repeated consecutive errors, total sleep larger than MaxRetryDuration", func(t *testing.T) { - flogging.ActivateSpec("debug") setup := newBFTDelivererTestSetup(t) setup.initialize(t) @@ -554,7 +549,6 @@ func TestBFTDeliverer_DialRetries(t *testing.T) { func TestBFTDeliverer_DeliverRetries(t *testing.T) { t.Run("Deliver returns error, then succeeds", func(t *testing.T) { - flogging.ActivateSpec("debug") setup := newBFTDelivererTestSetup(t) setup.initialize(t) @@ -582,7 +576,6 @@ func TestBFTDeliverer_DeliverRetries(t *testing.T) { }) t.Run("Deliver returns several consecutive errors, exponential backoff, then succeeds", func(t *testing.T) { - flogging.ActivateSpec("debug") setup := newBFTDelivererTestSetup(t) setup.initialize(t) @@ -631,7 +624,6 @@ func TestBFTDeliverer_DeliverRetries(t *testing.T) { }) t.Run("Deliver returns repeated consecutive errors, exponential backoff saturates", func(t *testing.T) { - flogging.ActivateSpec("debug") setup := newBFTDelivererTestSetup(t) setup.initialize(t) @@ -667,7 +659,6 @@ func TestBFTDeliverer_DeliverRetries(t *testing.T) { func TestBFTDeliverer_BlockReception(t *testing.T) { t.Run("Block is valid", func(t *testing.T) { - flogging.ActivateSpec("debug") setup := newBFTDelivererTestSetup(t) setup.initialize(t) startTime := time.Now() @@ -720,7 +711,6 @@ func TestBFTDeliverer_BlockReception(t *testing.T) { }) t.Run("Block is invalid", func(t *testing.T) { - flogging.ActivateSpec("debug") setup := newBFTDelivererTestSetup(t) setup.initialize(t) @@ -766,7 +756,6 @@ func TestBFTDeliverer_BlockReception(t *testing.T) { }) t.Run("Block handling fails", func(t *testing.T) { - flogging.ActivateSpec("debug") setup := newBFTDelivererTestSetup(t) setup.initialize(t) @@ -813,7 +802,6 @@ func TestBFTDeliverer_BlockReception(t *testing.T) { }) t.Run("Block reception resets failure counter", func(t *testing.T) { - flogging.ActivateSpec("debug") setup := newBFTDelivererTestSetup(t) setup.initialize(t) @@ -880,7 +868,6 @@ func TestBFTDeliverer_BlockReception(t *testing.T) { }) t.Run("Block reception resets total sleep time", func(t *testing.T) { // TODO - flogging.ActivateSpec("debug") setup := newBFTDelivererTestSetup(t) setup.initialize(t) setup.fakeDurationExceededHandler.DurationExceededHandlerReturns(true) @@ -953,7 +940,6 @@ func TestBFTDeliverer_BlockReception(t *testing.T) { }) t.Run("Config block is valid, updates verifier, updates connection-source", func(t *testing.T) { - flogging.ActivateSpec("debug") setup := newBFTDelivererTestSetup(t) setup.initialize(t) setup.gWithT.Eventually(setup.fakeOrdererConnectionSource.UpdateCallCount, eventuallyTO).Should(Equal(1)) @@ -1045,8 +1031,6 @@ func TestBFTDeliverer_BlockReception(t *testing.T) { func TestBFTDeliverer_CensorshipMonitorEvents(t *testing.T) { for _, errVal := range []error{nil, errors.New("some error"), &blocksprovider.ErrFatal{Message: "some fatal error"}, &blocksprovider.ErrStopping{Message: "stopping"}} { t.Run("unexpected error or value: "+fmt.Sprintf("%v", errVal), func(t *testing.T) { - flogging.ActivateSpec("debug") - setup := newBFTDelivererTestSetup(t) setup.initialize(t) setup.start() @@ -1072,8 +1056,6 @@ func TestBFTDeliverer_CensorshipMonitorEvents(t *testing.T) { } t.Run("censorship", func(t *testing.T) { - flogging.ActivateSpec("debug") - setup := newBFTDelivererTestSetup(t) setup.initialize(t) setup.start() @@ -1099,8 +1081,6 @@ func TestBFTDeliverer_CensorshipMonitorEvents(t *testing.T) { }) t.Run("repeated censorship events, with exponential backoff", func(t *testing.T) { - flogging.ActivateSpec("debug") - setup := newBFTDelivererTestSetup(t) setup.initialize(t) setup.start() @@ -1166,7 +1146,6 @@ func TestBFTDeliverer_CensorshipMonitorEvents(t *testing.T) { } func TestBFTDeliverer_RefreshEndpoints(t *testing.T) { - flogging.ActivateSpec("debug") setup := newBFTDelivererTestSetup(t) setup.initialize(t) diff --git a/common/deliverclient/blocksprovider/bft_header_receiver_test.go b/common/deliverclient/blocksprovider/bft_header_receiver_test.go index cbf554850..e7d1bbb7b 100644 --- a/common/deliverclient/blocksprovider/bft_header_receiver_test.go +++ b/common/deliverclient/blocksprovider/bft_header_receiver_test.go @@ -12,7 +12,6 @@ import ( "testing" "time" - "github.com/hyperledger/fabric-lib-go/common/flogging" "github.com/hyperledger/fabric-protos-go-apiv2/common" "github.com/hyperledger/fabric-protos-go-apiv2/orderer" "github.com/pkg/errors" @@ -96,7 +95,6 @@ func TestBftHeaderReceiver_NilResponse(t *testing.T) { } func TestBftHeaderReceiver_WithBlocks_Renew(t *testing.T) { - flogging.ActivateSpec("debug") fakeBlockVerifier := &fake.UpdatableBlockVerifier{} fakeBlockVerifier.VerifyBlockAttestationCalls(naiveBlockVerifier) fakeBlockVerifier.CloneReturns(fakeBlockVerifier) @@ -164,7 +162,6 @@ func TestBftHeaderReceiver_WithBlocks_Renew(t *testing.T) { } func TestBftHeaderReceiver_WithBlocks_StopOnVerificationFailure(t *testing.T) { - flogging.ActivateSpec("debug") fakeBlockVerifier := &fake.UpdatableBlockVerifier{} fakeBlockVerifier.VerifyBlockAttestationCalls(naiveBlockVerifier) fakeBlockVerifier.CloneReturns(fakeBlockVerifier) @@ -224,7 +221,6 @@ func TestBftHeaderReceiver_WithBlocks_StopOnVerificationFailure(t *testing.T) { } func TestBftHeaderReceiver_WithBlocks_ConfigVerification(t *testing.T) { - flogging.ActivateSpec("debug") fakeBlockVerifier := &fake.UpdatableBlockVerifier{} fakeBlockVerifier.VerifyBlockAttestationCalls(naiveBlockVerifier) fakeBlockVerifier.CloneReturns(fakeBlockVerifier) @@ -289,7 +285,6 @@ func TestBftHeaderReceiver_WithBlocks_ConfigVerification(t *testing.T) { } func TestBftHeaderReceiver_VerifyOnce(t *testing.T) { - flogging.ActivateSpec("debug") fakeBlockVerifier := &fake.UpdatableBlockVerifier{} fakeBlockVerifier.VerifyBlockAttestationCalls(naiveBlockVerifier) fakeBlockVerifier.CloneReturns(fakeBlockVerifier) diff --git a/common/deliverclient/orderers/connection_test.go b/common/deliverclient/orderers/connection_test.go index 6008388e2..1ab2a1072 100644 --- a/common/deliverclient/orderers/connection_test.go +++ b/common/deliverclient/orderers/connection_test.go @@ -12,7 +12,6 @@ import ( "sort" "strings" - "github.com/hyperledger/fabric-lib-go/common/flogging" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -1078,7 +1077,6 @@ var _ = Describe("Connection", func() { }) When("the global set of addresses shrinks, removing self endpoint", func() { - flogging.ActivateSpec("debug") BeforeEach(func() { cs.Update([]string{"global-addr2"}, map[string]orderers.OrdererOrg{ "org1": org1, diff --git a/common/ledger/blkstorage/pkg_test.go b/common/ledger/blkstorage/pkg_test.go index 9aa6edcf3..70227915f 100644 --- a/common/ledger/blkstorage/pkg_test.go +++ b/common/ledger/blkstorage/pkg_test.go @@ -12,7 +12,6 @@ import ( "os" "testing" - "github.com/hyperledger/fabric-lib-go/common/flogging" "github.com/hyperledger/fabric-lib-go/common/metrics" "github.com/hyperledger/fabric-lib-go/common/metrics/disabled" "github.com/hyperledger/fabric-protos-go-apiv2/common" @@ -24,7 +23,6 @@ import ( ) func TestMain(m *testing.M) { - flogging.ActivateSpec("blkstorage=debug") os.Exit(m.Run()) } diff --git a/common/ledger/blockledger/fileledger/impl_test.go b/common/ledger/blockledger/fileledger/impl_test.go index 7cfae99b4..9cc1b2a52 100644 --- a/common/ledger/blockledger/fileledger/impl_test.go +++ b/common/ledger/blockledger/fileledger/impl_test.go @@ -11,7 +11,6 @@ import ( "fmt" "testing" - "github.com/hyperledger/fabric-lib-go/common/flogging" "github.com/hyperledger/fabric-lib-go/common/metrics/disabled" cb "github.com/hyperledger/fabric-protos-go-apiv2/common" ab "github.com/hyperledger/fabric-protos-go-apiv2/orderer" @@ -28,10 +27,6 @@ import ( var genesisBlock = protoutil.NewBlock(0, nil) -func init() { - flogging.ActivateSpec("common.ledger.blockledger.file=DEBUG") -} - type testEnv struct { t *testing.T location string diff --git a/common/ledger/util/leveldbhelper/leveldb_provider_test.go b/common/ledger/util/leveldbhelper/leveldb_provider_test.go index 1ded2b5aa..af9f9b1db 100644 --- a/common/ledger/util/leveldbhelper/leveldb_provider_test.go +++ b/common/ledger/util/leveldbhelper/leveldb_provider_test.go @@ -15,12 +15,10 @@ import ( "github.com/hyperledger/fabric-x-common/common/ledger/dataformat" - "github.com/hyperledger/fabric-lib-go/common/flogging" "github.com/stretchr/testify/require" ) func TestMain(m *testing.M) { - flogging.ActivateSpec("leveldbhelper=debug") os.Exit(m.Run()) }