@@ -29,7 +29,7 @@ import (
29
29
"github.com/hyperledger/fabric/gossip/common"
30
30
"github.com/hyperledger/fabric/gossip/discovery"
31
31
"github.com/hyperledger/fabric/gossip/gossip/algo"
32
- "github.com/hyperledger/fabric/protos/gossip"
32
+ proto "github.com/hyperledger/fabric/protos/gossip"
33
33
"github.com/stretchr/testify/assert"
34
34
"github.com/stretchr/testify/mock"
35
35
)
@@ -211,8 +211,8 @@ func TestChannelPeriodicalPublishStateInfo(t *testing.T) {
211
211
212
212
adapter := new (gossipAdapterMock )
213
213
configureAdapter (adapter )
214
- adapter .On ("Send" , mock .AnythingOfType ("*proto .GossipMessage" ), mock .Anything )
215
- adapter .On ("Gossip" , mock .AnythingOfType ("*proto .GossipMessage" )).Run (func (arg mock.Arguments ) {
214
+ adapter .On ("Send" , mock .AnythingOfType ("*gossip .GossipMessage" ), mock .Anything )
215
+ adapter .On ("Gossip" , mock .AnythingOfType ("*gossip .GossipMessage" )).Run (func (arg mock.Arguments ) {
216
216
if atomic .LoadInt32 (& receivedMsg ) == int32 (1 ) {
217
217
return
218
218
}
@@ -246,8 +246,8 @@ func TestChannelPull(t *testing.T) {
246
246
receivedBlocksChan := make (chan * proto.GossipMessage )
247
247
adapter := new (gossipAdapterMock )
248
248
configureAdapter (adapter , discovery.NetworkMember {PKIid : pkiIDInOrg1 })
249
- adapter .On ("Gossip" , mock .AnythingOfType ("*proto .GossipMessage" ))
250
- adapter .On ("DeMultiplex" , mock .AnythingOfType ("*proto .GossipMessage" )).Run (func (arg mock.Arguments ) {
249
+ adapter .On ("Gossip" , mock .AnythingOfType ("*gossip .GossipMessage" ))
250
+ adapter .On ("DeMultiplex" , mock .AnythingOfType ("*gossip .GossipMessage" )).Run (func (arg mock.Arguments ) {
251
251
msg := arg .Get (0 ).(* proto.GossipMessage )
252
252
if ! msg .IsDataMsg () {
253
253
return
@@ -261,7 +261,7 @@ func TestChannelPull(t *testing.T) {
261
261
262
262
var wg sync.WaitGroup
263
263
pullPhase := simulatePullPhase (gc , t , & wg , func (* proto.GossipMessage ) {})
264
- adapter .On ("Send" , mock .AnythingOfType ("*proto .GossipMessage" ), mock .Anything ).Run (pullPhase )
264
+ adapter .On ("Send" , mock .AnythingOfType ("*gossip .GossipMessage" ), mock .Anything ).Run (pullPhase )
265
265
266
266
wg .Wait ()
267
267
for expectedSeq := 10 ; expectedSeq < 11 ; expectedSeq ++ {
@@ -282,7 +282,7 @@ func TestChannelPeerNotInChannel(t *testing.T) {
282
282
gossipMessagesSentFromChannel := make (chan * proto.GossipMessage , 1 )
283
283
adapter := new (gossipAdapterMock )
284
284
configureAdapter (adapter )
285
- adapter .On ("Gossip" , mock .AnythingOfType ("*proto .GossipMessage" ))
285
+ adapter .On ("Gossip" , mock .AnythingOfType ("*gossip .GossipMessage" ))
286
286
adapter .On ("Send" , mock .Anything , mock .Anything )
287
287
adapter .On ("DeMultiplex" , mock .Anything )
288
288
gc := NewGossipChannel (cs , channelA , adapter , & joinChanMsg {})
@@ -306,7 +306,7 @@ func TestChannelPeerNotInChannel(t *testing.T) {
306
306
}
307
307
// First, ensure it does that for pull messages from peers that are in the channel
308
308
helloMsg := createHelloMsg (pkiIDInOrg1 )
309
- helloMsg .On ("Respond" , mock .AnythingOfType ("*proto .GossipMessage" )).Run (messageRelayer )
309
+ helloMsg .On ("Respond" , mock .AnythingOfType ("*gossip .GossipMessage" )).Run (messageRelayer )
310
310
gc .HandleMessage (helloMsg )
311
311
select {
312
312
case <- gossipMessagesSentFromChannel :
@@ -315,7 +315,7 @@ func TestChannelPeerNotInChannel(t *testing.T) {
315
315
}
316
316
// And now for peers that are not in the channel (should not send back a message)
317
317
helloMsg = createHelloMsg (pkiIDinOrg2 )
318
- helloMsg .On ("Respond" , mock .AnythingOfType ("*proto .GossipMessage" )).Run (messageRelayer )
318
+ helloMsg .On ("Respond" , mock .AnythingOfType ("*gossip .GossipMessage" )).Run (messageRelayer )
319
319
gc .HandleMessage (helloMsg )
320
320
select {
321
321
case <- gossipMessagesSentFromChannel :
@@ -329,7 +329,7 @@ func TestChannelPeerNotInChannel(t *testing.T) {
329
329
msg : req ,
330
330
PKIID : pkiIDInOrg1 ,
331
331
}
332
- validReceivedMsg .On ("Respond" , mock .AnythingOfType ("*proto .GossipMessage" )).Run (messageRelayer )
332
+ validReceivedMsg .On ("Respond" , mock .AnythingOfType ("*gossip .GossipMessage" )).Run (messageRelayer )
333
333
gc .HandleMessage (validReceivedMsg )
334
334
select {
335
335
case <- gossipMessagesSentFromChannel :
@@ -342,7 +342,7 @@ func TestChannelPeerNotInChannel(t *testing.T) {
342
342
msg : req ,
343
343
PKIID : pkiIDinOrg2 ,
344
344
}
345
- invalidReceivedMsg .On ("Respond" , mock .AnythingOfType ("*proto .GossipMessage" )).Run (messageRelayer )
345
+ invalidReceivedMsg .On ("Respond" , mock .AnythingOfType ("*gossip .GossipMessage" )).Run (messageRelayer )
346
346
gc .HandleMessage (invalidReceivedMsg )
347
347
select {
348
348
case <- gossipMessagesSentFromChannel :
@@ -357,7 +357,7 @@ func TestChannelPeerNotInChannel(t *testing.T) {
357
357
msg : req2 ,
358
358
PKIID : pkiIDInOrg1 ,
359
359
}
360
- invalidReceivedMsg2 .On ("Respond" , mock .AnythingOfType ("*proto .GossipMessage" )).Run (messageRelayer )
360
+ invalidReceivedMsg2 .On ("Respond" , mock .AnythingOfType ("*gossip .GossipMessage" )).Run (messageRelayer )
361
361
gc .HandleMessage (invalidReceivedMsg2 )
362
362
select {
363
363
case <- gossipMessagesSentFromChannel :
@@ -374,7 +374,7 @@ func TestChannelIsInChannel(t *testing.T) {
374
374
adapter := new (gossipAdapterMock )
375
375
configureAdapter (adapter )
376
376
gc := NewGossipChannel (cs , channelA , adapter , & joinChanMsg {})
377
- adapter .On ("Gossip" , mock .AnythingOfType ("*proto .GossipMessage" ))
377
+ adapter .On ("Gossip" , mock .AnythingOfType ("*gossip .GossipMessage" ))
378
378
adapter .On ("Send" , mock .Anything , mock .Anything )
379
379
adapter .On ("DeMultiplex" , mock .Anything )
380
380
@@ -393,7 +393,7 @@ func TestChannelIsSubscribed(t *testing.T) {
393
393
adapter := new (gossipAdapterMock )
394
394
configureAdapter (adapter )
395
395
gc := NewGossipChannel (cs , channelA , adapter , & joinChanMsg {})
396
- adapter .On ("Gossip" , mock .AnythingOfType ("*proto .GossipMessage" ))
396
+ adapter .On ("Gossip" , mock .AnythingOfType ("*gossip .GossipMessage" ))
397
397
adapter .On ("Send" , mock .Anything , mock .Anything )
398
398
adapter .On ("DeMultiplex" , mock .Anything )
399
399
gc .HandleMessage (& receivedMsg {msg : createStateInfoMsg (10 , pkiIDInOrg1 , channelA ), PKIID : pkiIDInOrg1 })
@@ -411,7 +411,7 @@ func TestChannelAddToMessageStore(t *testing.T) {
411
411
gc := NewGossipChannel (cs , channelA , adapter , & joinChanMsg {})
412
412
adapter .On ("Gossip" , mock .Anything )
413
413
adapter .On ("Send" , mock .Anything , mock .Anything )
414
- adapter .On ("DeMultiplex" , mock .AnythingOfType ("*proto .GossipMessage" )).Run (func (arg mock.Arguments ) {
414
+ adapter .On ("DeMultiplex" , mock .AnythingOfType ("*gossip .GossipMessage" )).Run (func (arg mock.Arguments ) {
415
415
demuxedMsgs <- arg .Get (0 ).(* proto.GossipMessage )
416
416
})
417
417
@@ -438,7 +438,7 @@ func TestChannelAddToMessageStore(t *testing.T) {
438
438
gc .AddToMsgStore (createStateInfoMsg (10 , pkiIDInOrg1 , channelA ))
439
439
helloMsg := createHelloMsg (pkiIDInOrg1 )
440
440
respondedChan := make (chan struct {}, 1 )
441
- helloMsg .On ("Respond" , mock .AnythingOfType ("*proto .GossipMessage" )).Run (func (arg mock.Arguments ) {
441
+ helloMsg .On ("Respond" , mock .AnythingOfType ("*gossip .GossipMessage" )).Run (func (arg mock.Arguments ) {
442
442
respondedChan <- struct {}{}
443
443
})
444
444
gc .HandleMessage (helloMsg )
@@ -588,7 +588,7 @@ func TestChannelStateInfoSnapshot(t *testing.T) {
588
588
adapter .On ("Gossip" , mock .Anything )
589
589
sentMessages := make (chan * proto.GossipMessage , 10 )
590
590
adapter .On ("Send" , mock .Anything , mock .Anything )
591
- adapter .On ("ValidateStateInfoMessage" , mock .AnythingOfType ("*proto .GossipMessage" )).Return (nil )
591
+ adapter .On ("ValidateStateInfoMessage" , mock .AnythingOfType ("*gossip .GossipMessage" )).Return (nil )
592
592
593
593
// Ensure we ignore stateInfo snapshots from peers not in the channel
594
594
gc .HandleMessage (& receivedMsg {PKIID : pkiIDInOrg1 , msg : stateInfoSnapshotForChannel (common .ChainID ("B" ), createStateInfoMsg (4 , pkiIDInOrg1 , channelA ))})
@@ -728,7 +728,7 @@ func TestChannelReconfigureChannel(t *testing.T) {
728
728
// Just call it again, to make sure stuff don't crash
729
729
gc .ConfigureChannel (api .JoinChannelMessage (newJoinChanMsg ))
730
730
731
- adapter .On ("Gossip" , mock .AnythingOfType ("*proto .GossipMessage" ))
731
+ adapter .On ("Gossip" , mock .AnythingOfType ("*gossip .GossipMessage" ))
732
732
adapter .On ("Send" , mock .Anything , mock .Anything )
733
733
adapter .On ("DeMultiplex" , mock .Anything )
734
734
@@ -760,7 +760,7 @@ func TestChannelReconfigureChannel(t *testing.T) {
760
760
msg := arg .Get (0 ).(* proto.GossipMessage )
761
761
gossipMessagesSentFromChannel <- msg
762
762
}
763
- invalidReceivedMsg .On ("Respond" , mock .AnythingOfType ("*proto .GossipMessage" )).Run (messageRelayer )
763
+ invalidReceivedMsg .On ("Respond" , mock .AnythingOfType ("*gossip .GossipMessage" )).Run (messageRelayer )
764
764
gc .HandleMessage (invalidReceivedMsg )
765
765
select {
766
766
case <- gossipMessagesSentFromChannel :
0 commit comments