Fix intermittent send_node_id_handshake unit test failures (#2612)

This commit is contained in:
cryptocode 2020-02-28 20:18:31 +01:00 committed by GitHub
commit ac5f398de0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -92,15 +92,21 @@ TEST (network, send_node_id_handshake)
{
ASSERT_NO_ERROR (system.poll ());
}
ASSERT_EQ (0, node0->network.size ());
ASSERT_EQ (1, node1->network.size ());
system.deadline_set (10s);
while (node0->network.size () != 0 && node1->network.size () != 1)
{
ASSERT_NO_ERROR (system.poll ());
}
system.deadline_set (10s);
while (node0->stats.count (nano::stat::type::message, nano::stat::detail::node_id_handshake, nano::stat::dir::in) < initial + 2)
{
ASSERT_NO_ERROR (system.poll ());
}
ASSERT_EQ (1, node0->network.size ());
ASSERT_EQ (1, node1->network.size ());
system.deadline_set (10s);
while (node0->network.size () != 1 && node1->network.size () != 1)
{
ASSERT_NO_ERROR (system.poll ());
}
auto list1 (node0->network.list (1));
ASSERT_EQ (node1->network.endpoint (), list1[0]->get_endpoint ());
auto list2 (node1->network.list (1));