Rewriting tests to not depend on confirmation request counts.

This commit is contained in:
clemahieu 2019-12-27 18:18:27 -03:00
commit 2e70013bb0
No known key found for this signature in database
GPG key ID: 43708520C8DFB938

View file

@ -205,16 +205,12 @@ TEST (node, node_receive_quorum)
{ {
ASSERT_NO_ERROR (system.poll ()); ASSERT_NO_ERROR (system.poll ());
} }
auto done (false);
while (!done)
{ {
{ nano::lock_guard<std::mutex> guard (system.nodes[0]->active.mutex);
nano::lock_guard<std::mutex> guard (system.nodes[0]->active.mutex); auto info (system.nodes[0]->active.roots.find (nano::qualified_root (previous, previous)));
auto info (system.nodes[0]->active.roots.find (nano::qualified_root (previous, previous))); ASSERT_NE (system.nodes[0]->active.roots.end (), info);
ASSERT_NE (system.nodes[0]->active.roots.end (), info); ASSERT_FALSE (info->election->confirmed);
done = info->election->confirmation_request_count > 2; ASSERT_EQ (1, info->election->last_votes.size ());
}
ASSERT_NO_ERROR (system.poll ());
} }
nano::system system2 (1); nano::system system2 (1);
system2.wallet (0)->insert_adhoc (nano::test_genesis_key.prv); system2.wallet (0)->insert_adhoc (nano::test_genesis_key.prv);
@ -2334,18 +2330,11 @@ TEST (node, confirm_quorum)
{ {
ASSERT_NO_ERROR (system.poll ()); ASSERT_NO_ERROR (system.poll ());
} }
auto done (false); nano::lock_guard<std::mutex> guard (system.nodes[0]->active.mutex);
while (!done) auto info (system.nodes[0]->active.roots.find (nano::qualified_root (send1->hash (), send1->hash ())));
{ ASSERT_NE (system.nodes[0]->active.roots.end (), info);
ASSERT_FALSE (system.nodes[0]->active.empty ()); ASSERT_FALSE (info->election->confirmed);
{ ASSERT_EQ (1, info->election->last_votes.size ());
nano::lock_guard<std::mutex> guard (system.nodes[0]->active.mutex);
auto info (system.nodes[0]->active.roots.find (nano::qualified_root (send1->hash (), send1->hash ())));
ASSERT_NE (system.nodes[0]->active.roots.end (), info);
done = info->election->confirmation_request_count > 2;
}
ASSERT_NO_ERROR (system.poll ());
}
ASSERT_EQ (0, system.nodes[0]->balance (nano::test_genesis_key.pub)); ASSERT_EQ (0, system.nodes[0]->balance (nano::test_genesis_key.pub));
} }