satisfy race detector
This commit is contained in:
parent
b0d384d2e8
commit
f7f33e10cc
|
@ -1584,13 +1584,22 @@ func TestGossipsubMultipleGraftTopics(t *testing.T) {
|
||||||
firstPeer := hosts[0].ID()
|
firstPeer := hosts[0].ID()
|
||||||
secondPeer := hosts[1].ID()
|
secondPeer := hosts[1].ID()
|
||||||
|
|
||||||
|
p2Sub := psubs[1]
|
||||||
p1Router := psubs[0].rt.(*GossipSubRouter)
|
p1Router := psubs[0].rt.(*GossipSubRouter)
|
||||||
p2Router := psubs[1].rt.(*GossipSubRouter)
|
p2Router := psubs[1].rt.(*GossipSubRouter)
|
||||||
|
|
||||||
|
finChan := make(chan struct{})
|
||||||
|
|
||||||
|
p2Sub.eval <- func() {
|
||||||
// Add topics to second peer
|
// Add topics to second peer
|
||||||
p2Router.mesh[firstTopic] = map[peer.ID]struct{}{}
|
p2Router.mesh[firstTopic] = map[peer.ID]struct{}{}
|
||||||
p2Router.mesh[secondTopic] = map[peer.ID]struct{}{}
|
p2Router.mesh[secondTopic] = map[peer.ID]struct{}{}
|
||||||
p2Router.mesh[thirdTopic] = map[peer.ID]struct{}{}
|
p2Router.mesh[thirdTopic] = map[peer.ID]struct{}{}
|
||||||
|
|
||||||
|
finChan <- struct{}{}
|
||||||
|
}
|
||||||
|
<-finChan
|
||||||
|
|
||||||
// Send multiple GRAFT messages to second peer from
|
// Send multiple GRAFT messages to second peer from
|
||||||
// 1st peer
|
// 1st peer
|
||||||
p1Router.sendGraftPrune(map[peer.ID][]string{
|
p1Router.sendGraftPrune(map[peer.ID][]string{
|
||||||
|
@ -1599,6 +1608,7 @@ func TestGossipsubMultipleGraftTopics(t *testing.T) {
|
||||||
|
|
||||||
time.Sleep(time.Second * 1)
|
time.Sleep(time.Second * 1)
|
||||||
|
|
||||||
|
p2Sub.eval <- func() {
|
||||||
if _, ok := p2Router.mesh[firstTopic][firstPeer]; !ok {
|
if _, ok := p2Router.mesh[firstTopic][firstPeer]; !ok {
|
||||||
t.Errorf("First peer wasnt added to mesh of the second peer for the topic %s", firstTopic)
|
t.Errorf("First peer wasnt added to mesh of the second peer for the topic %s", firstTopic)
|
||||||
}
|
}
|
||||||
|
@ -1608,6 +1618,9 @@ func TestGossipsubMultipleGraftTopics(t *testing.T) {
|
||||||
if _, ok := p2Router.mesh[thirdTopic][firstPeer]; !ok {
|
if _, ok := p2Router.mesh[thirdTopic][firstPeer]; !ok {
|
||||||
t.Errorf("First peer wasnt added to mesh of the second peer for the topic %s", thirdTopic)
|
t.Errorf("First peer wasnt added to mesh of the second peer for the topic %s", thirdTopic)
|
||||||
}
|
}
|
||||||
|
finChan <- struct{}{}
|
||||||
|
}
|
||||||
|
<-finChan
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGossipsubOpportunisticGrafting(t *testing.T) {
|
func TestGossipsubOpportunisticGrafting(t *testing.T) {
|
||||||
|
|
Loading…
Reference in New Issue