Skip to content

Commit 588bf14

Browse files
Nao NishijimaNao Nishijima
Nao Nishijima
authored and
Nao Nishijima
committed
[FAB-3707] Delete unused vars, etc in orderer dir
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 <[email protected]>
1 parent 5c353eb commit 588bf14

File tree

8 files changed

+5
-124
lines changed

8 files changed

+5
-124
lines changed

orderer/kafka/config_test.go

-9
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"time"
2222

2323
"github.com/Shopify/sarama"
24-
genesisconfig "github.com/hyperledger/fabric/common/configtx/tool/localconfig"
2524
"github.com/hyperledger/fabric/orderer/localconfig"
2625
cb "github.com/hyperledger/fabric/protos/common"
2726
)
@@ -38,14 +37,6 @@ var (
3837
testTimePadding = 200 * time.Millisecond
3938
)
4039

41-
var testGenesisConf = &genesisconfig.TopLevel{
42-
Orderer: &genesisconfig.Orderer{
43-
Kafka: genesisconfig.Kafka{
44-
Brokers: []string{"127.0.0.1:9092"},
45-
},
46-
},
47-
}
48-
4940
var testConf = &config.TopLevel{
5041
Kafka: config.Kafka{
5142
Retry: config.Retry{

orderer/kafka/orderer_test.go

-5
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,9 @@ import (
3636

3737
var cp = newChainPartition(provisional.TestChainID, rawPartition)
3838

39-
func newMockSharedConfigManager() *mockconfig.Orderer {
40-
return &mockconfig.Orderer{KafkaBrokersVal: testGenesisConf.Orderer.Kafka.Brokers}
41-
}
42-
4339
type mockConsenterImpl struct {
4440
consenterImpl
4541
prodDisk, consDisk chan *ab.KafkaMessage
46-
consumerSetUp bool
4742
t *testing.T
4843
}
4944

orderer/ledger/json/impl.go

+5-6
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,11 @@ type cursor struct {
4949
}
5050

5151
type jsonLedger struct {
52-
directory string
53-
fqFormatString string
54-
height uint64
55-
signal chan struct{}
56-
lastHash []byte
57-
marshaler *jsonpb.Marshaler
52+
directory string
53+
height uint64
54+
signal chan struct{}
55+
lastHash []byte
56+
marshaler *jsonpb.Marshaler
5857
}
5958

6059
// readBlock returns the block or nil, and whether the block was found or not, (nil,true) generally indicates an irrecoverable problem

orderer/multichain/manager_test.go

-53
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ import (
3333
ab "github.com/hyperledger/fabric/protos/orderer"
3434
"github.com/hyperledger/fabric/protos/utils"
3535

36-
"errors"
37-
3836
mmsp "github.com/hyperledger/fabric/common/mocks/msp"
3937
logging "github.com/op/go-logging"
4038
"github.com/stretchr/testify/assert"
@@ -63,18 +61,6 @@ func (mch mockCryptoHelper) VerifySignature(sd *cb.SignedData) error {
6361
return nil
6462
}
6563

66-
func mockCryptoRejector() *mockCryptoRejectorHelper {
67-
return &mockCryptoRejectorHelper{LocalSigner: mockcrypto.FakeLocalSigner}
68-
}
69-
70-
type mockCryptoRejectorHelper struct {
71-
*mockcrypto.LocalSigner
72-
}
73-
74-
func (mch mockCryptoRejectorHelper) VerifySignature(sd *cb.SignedData) error {
75-
return errors.New("Nope")
76-
}
77-
7864
func NewRAMLedgerAndFactory(maxSize int) (ledger.Factory, ledger.ReadWriter) {
7965
rlf := ramledger.New(10)
8066
rl, err := rlf.GetOrCreate(provisional.TestChainID)
@@ -213,45 +199,6 @@ func TestManagerImpl(t *testing.T) {
213199
}
214200
}
215201

216-
/*
217-
// This test makes sure that the signature filter works
218-
func TestSignatureFilter(t *testing.T) {
219-
lf, rl := NewRAMLedgerAndFactory(10)
220-
221-
consenters := make(map[string]Consenter)
222-
consenters[conf.Orderer.OrdererType] = &mockConsenter{}
223-
224-
manager := NewManagerImpl(lf, consenters, mockCryptoRejector())
225-
226-
cs, ok := manager.GetChain(provisional.TestChainID)
227-
228-
if !ok {
229-
t.Fatalf("Should have gotten chain which was initialized by ramledger")
230-
}
231-
232-
messages := make([]*cb.Envelope, conf.Orderer.BatchSize.MaxMessageCount)
233-
for i := 0; i < int(conf.Orderer.BatchSize.MaxMessageCount); i++ {
234-
messages[i] = makeSignaturelessTx(provisional.TestChainID, i)
235-
}
236-
237-
for _, message := range messages {
238-
cs.Enqueue(message)
239-
}
240-
241-
// Causes the consenter thread to exit after it processes all messages
242-
close(cs.(*chainSupport).chain.(*mockChain).queue)
243-
244-
it, _ := rl.Iterator(&ab.SeekPosition{Type: &ab.SeekPosition_Specified{Specified: &ab.SeekSpecified{Number: 1}}})
245-
select {
246-
case <-it.ReadyChan():
247-
// Will unblock if a block is created
248-
t.Fatalf("Block 1 should not have been created")
249-
case <-cs.(*chainSupport).chain.(*mockChain).done:
250-
// Will unblock once the consenter thread has exited
251-
}
252-
}
253-
*/
254-
255202
// This test brings up the entire system, with the mock consenter, including the broadcasters etc. and creates a new chain
256203
func TestNewChain(t *testing.T) {
257204
expectedLastConfigBlockNumber := uint64(0)

orderer/multichain/util_test.go

-23
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,6 @@ func (mch *mockChain) Halt() {
7474
close(mch.queue)
7575
}
7676

77-
type mockLedgerWriter struct {
78-
}
79-
80-
func (mlw *mockLedgerWriter) Append(blockContents []*cb.Envelope, metadata [][]byte) *cb.Block {
81-
logger.Debugf("Committed block")
82-
return nil
83-
}
84-
8577
func makeConfigTx(chainID string, i int) *cb.Envelope {
8678
group := cb.NewConfigGroup()
8779
group.Groups[config.OrdererGroupKey] = cb.NewConfigGroup()
@@ -134,18 +126,3 @@ func makeNormalTx(chainID string, i int) *cb.Envelope {
134126
Payload: utils.MarshalOrPanic(payload),
135127
}
136128
}
137-
138-
func makeSignaturelessTx(chainID string, i int) *cb.Envelope {
139-
payload := &cb.Payload{
140-
Header: &cb.Header{
141-
ChannelHeader: utils.MarshalOrPanic(&cb.ChannelHeader{
142-
Type: int32(cb.HeaderType_ENDORSER_TRANSACTION),
143-
ChannelId: chainID,
144-
}),
145-
},
146-
Data: []byte(fmt.Sprintf("%d", i)),
147-
}
148-
return &cb.Envelope{
149-
Payload: utils.MarshalOrPanic(payload),
150-
}
151-
}

orderer/network_test.go

-13
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,8 @@ const maindir = "github.com/hyperledger/fabric/orderer"
5252
var ordererDir string
5353
var mainexe string
5454

55-
type flags struct {
56-
listenAddr string
57-
grpcAddr string
58-
telemetryAddr string
59-
certFile string
60-
keyFile string
61-
dataDir string
62-
genesisFile string
63-
verbose string
64-
init string
65-
}
66-
6755
type Peer struct {
6856
id uint64
69-
config flags
7057
cancel context.CancelFunc
7158
cmd *exec.Cmd
7259
}

orderer/sbft/simplebft/request.go

-11
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,6 @@ func (s *SBFT) cutAndMaybeSend() {
6363
s.maybeSendNextBatch()
6464
}
6565

66-
func (s *SBFT) batchSize() uint64 {
67-
size := uint64(0)
68-
if len(s.batches) == 0 {
69-
return size
70-
}
71-
for _, req := range s.batches[0] {
72-
size += uint64(len(req.Payload))
73-
}
74-
return size
75-
}
76-
7766
func (s *SBFT) maybeSendNextBatch() {
7867
if s.batchTimer != nil {
7968
s.batchTimer.Cancel()

orderer/sbft/simplebft/testsys_test.go

-4
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,6 @@ func newTestSystemWithBatchSize(n uint64, batchSize uint64) *testSystem {
299299
return newTestSystemWithParams(n, batchSize, false)
300300
}
301301

302-
func newTestSystemWOTimers(n uint64) *testSystem {
303-
return newTestSystemWithParams(n, defaultMaxReqCount, true)
304-
}
305-
306302
func newTestSystemWOTimersWithBatchSize(n uint64, batchSize uint64) *testSystem {
307303
return newTestSystemWithParams(n, batchSize, true)
308304
}

0 commit comments

Comments
 (0)