Commit 2aedac82 authored by Axel Kingsley's avatar Axel Kingsley Committed by GitHub

Fix Flake in TestDiscovery (#8765)

parent bf7f81a9
...@@ -335,22 +335,25 @@ func TestDiscovery(t *testing.T) { ...@@ -335,22 +335,25 @@ func TestDiscovery(t *testing.T) {
} }
} }
// For each node, check that they have recorded metadata about the other nodes during discovery // Check that among known connections (B-A, B-C), we have metadata
for _, n1 := range []*NodeP2P{nodeA, nodeB, nodeC} { type mdcheck struct {
eps, ok := n1.Host().Peerstore().(store.ExtendedPeerstore) n1 *NodeP2P
require.True(t, ok) n2 *NodeP2P
for _, n2 := range []*NodeP2P{nodeA, nodeB, nodeC} { }
if n1 == n2 { cases := []mdcheck{
continue {nodeB, nodeA},
{nodeB, nodeC},
} }
md, err := eps.GetPeerMetadata(n2.Host().ID()) for _, c := range cases {
// make peerstore metadata available
eps, ok := c.n1.Host().Peerstore().(store.ExtendedPeerstore)
require.True(t, ok)
// confirm n1 has metadata about n2
md, err := eps.GetPeerMetadata(c.n2.Host().ID())
require.NoError(t, err) require.NoError(t, err)
// we don't scrutinize the ENR itself, just that it exists
require.NotEmpty(t, md.ENR) require.NotEmpty(t, md.ENR)
require.Equal(t, uint64(901), md.OPStackID) require.Equal(t, uint64(901), md.OPStackID)
} }
}
} }
// Most tests should use mocknets instead of using the actual local host network // Most tests should use mocknets instead of using the actual local host network
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment