Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions common/deliverclient/blocksprovider/bft_censorship_monitor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down
21 changes: 0 additions & 21 deletions common/deliverclient/blocksprovider/bft_deliverer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand Down Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions common/deliverclient/orderers/connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"sort"
"strings"

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

Expand Down Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions common/ledger/blkstorage/pkg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -24,7 +23,6 @@ import (
)

func TestMain(m *testing.M) {
flogging.ActivateSpec("blkstorage=debug")
os.Exit(m.Run())
}

Expand Down
5 changes: 0 additions & 5 deletions common/ledger/blockledger/fileledger/impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions common/ledger/util/leveldbhelper/leveldb_provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}

Expand Down