Skip to content

Commit

Permalink
[FAB-3707] Delete unused vars, etc in orderer dir
Browse files Browse the repository at this point in the history
This patchset deletes unused vars etc in orderer directory.
Since the test was commented out, there are some variables that
became unused variables. So this patchset deletes the test.

Change-Id: I11986a3e2ac8083788d7b85b04b6b9a48ac26722
Signed-off-by: Nao Nishijima <Nao.nishijima@hal.hitachi.com>
  • Loading branch information
Nao Nishijima authored and Nao Nishijima committed May 16, 2017
1 parent 5c353eb commit 588bf14
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 @@ -33,8 +33,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 @@ -63,18 +61,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 @@ -213,45 +199,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
}
}
*/

// This test brings up the entire system, with the mock consenter, including the broadcasters etc. and creates a new chain
func TestNewChain(t *testing.T) {
expectedLastConfigBlockNumber := uint64(0)
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 588bf14

Please sign in to comment.