Make sure DNS Gossip converges correctly.
- Abide by gossip interface (return nil, not empty gossip) so gossip converges! - Make sure we don't say an old entry version is new to us; add some more tests. - Add dns test for 3 (or N) hosts - Extend mock gossip router to ensure reconsumption off diffs yield nil - Don't increment version when re-adding existing entry.
This commit is contained in:
1 parent
9df7358ded
commit
73210b6a70
5 files changed
+74
-19
No files matched your search
+16
-1
@@ -92,9 +92,24 @@ func (grouter *TestRouter) run(sender router.PeerName, gossiper router.Gossiper,
|
||||
continue
|
||||
}
|
||||
for _, msg := range message.data.Encode() {
|
||||
if _, err := gossiper.OnGossipBroadcast(message.sender, msg); err != nil {
|
||||
// TODO: this should call OnGossipBroadcast, and we should implement
|
||||
// 'trickle' gossip correctly in this mock. But no one depends on this
|
||||
// difference for testing right now, so we abuse the interface here.
|
||||
diff, err := gossiper.OnGossip(msg)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("Error doing gossip broadcast: %s", err))
|
||||
}
|
||||
if diff == nil {
|
||||
continue
|
||||
}
|
||||
// Sanity check - reconsuming the diff should yield nil
|
||||
for _, diffMsg := range diff.Encode() {
|
||||
if nextDiff, err := gossiper.OnGossip(diffMsg); err != nil {
|
||||
panic(fmt.Sprintf("Error doing gossip broadcast: %s", err))
|
||||
} else if nextDiff != nil {
|
||||
panic(fmt.Sprintf("Breach of gossip interface: %v != nil", nextDiff))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
case <-gossipTimer:
|
||||
|
||||
Reference in new issue
Block a user