Skip to content

Commit

Permalink
Merge "[FAB-3707] Delete unused vars, etc in orderer dir"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Yellick authored and Gerrit Code Review committed May 30, 2017
2 parents a28a10c + 588bf14 commit 5ba27bf
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 124 deletions.
9 changes: 0 additions & 9 deletions orderer/kafka/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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{
Expand Down
5 changes: 0 additions & 5 deletions orderer/kafka/orderer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
11 changes: 5 additions & 6 deletions orderer/ledger/json/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
53 changes: 0 additions & 53 deletions orderer/multichain/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
23 changes: 0 additions & 23 deletions orderer/multichain/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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),
}
}
13 changes: 0 additions & 13 deletions orderer/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
11 changes: 0 additions & 11 deletions orderer/sbft/simplebft/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 0 additions & 4 deletions orderer/sbft/simplebft/testsys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 5ba27bf

Please sign in to comment.