diff --git a/orderer/kafka/config_test.go b/orderer/kafka/config_test.go index 40e2d42866b..329cfac5798 100644 --- a/orderer/kafka/config_test.go +++ b/orderer/kafka/config_test.go @@ -21,7 +21,6 @@ import ( "time" "github.com/Shopify/sarama" - genesisconfig "github.com/hyperledger/fabric/common/configtx/tool/localconfig" "github.com/hyperledger/fabric/orderer/localconfig" cb "github.com/hyperledger/fabric/protos/common" ) @@ -38,14 +37,6 @@ var ( testTimePadding = 200 * time.Millisecond ) -var testGenesisConf = &genesisconfig.TopLevel{ - Orderer: &genesisconfig.Orderer{ - Kafka: genesisconfig.Kafka{ - Brokers: []string{"127.0.0.1:9092"}, - }, - }, -} - var testConf = &config.TopLevel{ Kafka: config.Kafka{ Retry: config.Retry{ diff --git a/orderer/kafka/orderer_test.go b/orderer/kafka/orderer_test.go index e565f656f7a..ebba5bafd2b 100644 --- a/orderer/kafka/orderer_test.go +++ b/orderer/kafka/orderer_test.go @@ -36,14 +36,9 @@ import ( var cp = newChainPartition(provisional.TestChainID, rawPartition) -func newMockSharedConfigManager() *mockconfig.Orderer { - return &mockconfig.Orderer{KafkaBrokersVal: testGenesisConf.Orderer.Kafka.Brokers} -} - type mockConsenterImpl struct { consenterImpl prodDisk, consDisk chan *ab.KafkaMessage - consumerSetUp bool t *testing.T } diff --git a/orderer/ledger/json/impl.go b/orderer/ledger/json/impl.go index daa730fa1ce..9858c278cf3 100644 --- a/orderer/ledger/json/impl.go +++ b/orderer/ledger/json/impl.go @@ -49,12 +49,11 @@ type cursor struct { } type jsonLedger struct { - directory string - fqFormatString string - height uint64 - signal chan struct{} - lastHash []byte - marshaler *jsonpb.Marshaler + directory string + height uint64 + signal chan struct{} + lastHash []byte + marshaler *jsonpb.Marshaler } // readBlock returns the block or nil, and whether the block was found or not, (nil,true) generally indicates an irrecoverable problem diff --git a/orderer/multichain/manager_test.go b/orderer/multichain/manager_test.go index b1cc22e4fdf..e8517d4d6a6 100644 --- a/orderer/multichain/manager_test.go +++ b/orderer/multichain/manager_test.go @@ -34,8 +34,6 @@ import ( ab "github.com/hyperledger/fabric/protos/orderer" "github.com/hyperledger/fabric/protos/utils" - "errors" - mmsp "github.com/hyperledger/fabric/common/mocks/msp" logging "github.com/op/go-logging" "github.com/stretchr/testify/assert" @@ -64,18 +62,6 @@ func (mch mockCryptoHelper) VerifySignature(sd *cb.SignedData) error { return nil } -func mockCryptoRejector() *mockCryptoRejectorHelper { - return &mockCryptoRejectorHelper{LocalSigner: mockcrypto.FakeLocalSigner} -} - -type mockCryptoRejectorHelper struct { - *mockcrypto.LocalSigner -} - -func (mch mockCryptoRejectorHelper) VerifySignature(sd *cb.SignedData) error { - return errors.New("Nope") -} - func NewRAMLedgerAndFactory(maxSize int) (ledger.Factory, ledger.ReadWriter) { rlf := ramledger.New(10) rl, err := rlf.GetOrCreate(provisional.TestChainID) @@ -214,45 +200,6 @@ func TestManagerImpl(t *testing.T) { } } -/* -// This test makes sure that the signature filter works -func TestSignatureFilter(t *testing.T) { - lf, rl := NewRAMLedgerAndFactory(10) - - consenters := make(map[string]Consenter) - consenters[conf.Orderer.OrdererType] = &mockConsenter{} - - manager := NewManagerImpl(lf, consenters, mockCryptoRejector()) - - cs, ok := manager.GetChain(provisional.TestChainID) - - if !ok { - t.Fatalf("Should have gotten chain which was initialized by ramledger") - } - - messages := make([]*cb.Envelope, conf.Orderer.BatchSize.MaxMessageCount) - for i := 0; i < int(conf.Orderer.BatchSize.MaxMessageCount); i++ { - messages[i] = makeSignaturelessTx(provisional.TestChainID, i) - } - - for _, message := range messages { - cs.Enqueue(message) - } - - // Causes the consenter thread to exit after it processes all messages - close(cs.(*chainSupport).chain.(*mockChain).queue) - - it, _ := rl.Iterator(&ab.SeekPosition{Type: &ab.SeekPosition_Specified{Specified: &ab.SeekSpecified{Number: 1}}}) - select { - case <-it.ReadyChan(): - // Will unblock if a block is created - t.Fatalf("Block 1 should not have been created") - case <-cs.(*chainSupport).chain.(*mockChain).done: - // Will unblock once the consenter thread has exited - } -} -*/ - func TestNewChannelConfig(t *testing.T) { lf, _ := NewRAMLedgerAndFactory(3) diff --git a/orderer/multichain/util_test.go b/orderer/multichain/util_test.go index 981bf336243..0d33f7e928c 100644 --- a/orderer/multichain/util_test.go +++ b/orderer/multichain/util_test.go @@ -74,14 +74,6 @@ func (mch *mockChain) Halt() { close(mch.queue) } -type mockLedgerWriter struct { -} - -func (mlw *mockLedgerWriter) Append(blockContents []*cb.Envelope, metadata [][]byte) *cb.Block { - logger.Debugf("Committed block") - return nil -} - func makeConfigTx(chainID string, i int) *cb.Envelope { group := cb.NewConfigGroup() group.Groups[config.OrdererGroupKey] = cb.NewConfigGroup() @@ -134,18 +126,3 @@ func makeNormalTx(chainID string, i int) *cb.Envelope { Payload: utils.MarshalOrPanic(payload), } } - -func makeSignaturelessTx(chainID string, i int) *cb.Envelope { - payload := &cb.Payload{ - Header: &cb.Header{ - ChannelHeader: utils.MarshalOrPanic(&cb.ChannelHeader{ - Type: int32(cb.HeaderType_ENDORSER_TRANSACTION), - ChannelId: chainID, - }), - }, - Data: []byte(fmt.Sprintf("%d", i)), - } - return &cb.Envelope{ - Payload: utils.MarshalOrPanic(payload), - } -} diff --git a/orderer/network_test.go b/orderer/network_test.go index 6102cb5fa38..be447255f76 100644 --- a/orderer/network_test.go +++ b/orderer/network_test.go @@ -52,21 +52,8 @@ const maindir = "github.com/hyperledger/fabric/orderer" var ordererDir string var mainexe string -type flags struct { - listenAddr string - grpcAddr string - telemetryAddr string - certFile string - keyFile string - dataDir string - genesisFile string - verbose string - init string -} - type Peer struct { id uint64 - config flags cancel context.CancelFunc cmd *exec.Cmd } diff --git a/orderer/sbft/simplebft/request.go b/orderer/sbft/simplebft/request.go index b41acb06dca..c3b2adce922 100644 --- a/orderer/sbft/simplebft/request.go +++ b/orderer/sbft/simplebft/request.go @@ -63,17 +63,6 @@ func (s *SBFT) cutAndMaybeSend() { s.maybeSendNextBatch() } -func (s *SBFT) batchSize() uint64 { - size := uint64(0) - if len(s.batches) == 0 { - return size - } - for _, req := range s.batches[0] { - size += uint64(len(req.Payload)) - } - return size -} - func (s *SBFT) maybeSendNextBatch() { if s.batchTimer != nil { s.batchTimer.Cancel() diff --git a/orderer/sbft/simplebft/testsys_test.go b/orderer/sbft/simplebft/testsys_test.go index ccc2876539d..fce8201f328 100644 --- a/orderer/sbft/simplebft/testsys_test.go +++ b/orderer/sbft/simplebft/testsys_test.go @@ -299,10 +299,6 @@ func newTestSystemWithBatchSize(n uint64, batchSize uint64) *testSystem { return newTestSystemWithParams(n, batchSize, false) } -func newTestSystemWOTimers(n uint64) *testSystem { - return newTestSystemWithParams(n, defaultMaxReqCount, true) -} - func newTestSystemWOTimersWithBatchSize(n uint64, batchSize uint64) *testSystem { return newTestSystemWithParams(n, batchSize, true) }