Rewriting tests to not use block_processor::flush.

This commit is contained in:
Colin LeMahieu 2024-01-26 16:47:10 +00:00
commit 299bfbc4c9
No known key found for this signature in database
GPG key ID: 43708520C8DFB938
2 changed files with 4 additions and 11 deletions

View file

@ -1497,17 +1497,13 @@ TEST (confirmation_height, callback_confirmed_history)
add_callback_stats (*node);
node->process_active (send1);
ASSERT_NE (nano::test::start_election (system, *node, send1->hash ()), nullptr);
std::shared_ptr<nano::election> election;
ASSERT_TIMELY (5s, election = nano::test::start_election (system, *node, send1->hash ()));
{
node->process_active (send);
node->block_processor.flush ();
// The write guard prevents the confirmation height processor doing any writes
auto write_guard = node->write_database_queue.wait (nano::writer::testing);
// Confirm send1
auto election = node->active.election (send1->qualified_root ());
ASSERT_NE (nullptr, election);
election->force_confirm ();
ASSERT_TIMELY_EQ (10s, node->active.size (), 0);
ASSERT_EQ (0, node->active.recently_cemented.list ().size ());

View file

@ -2971,8 +2971,7 @@ TEST (node, block_processor_reject_state)
send1->signature.bytes[0] ^= 1;
ASSERT_FALSE (node.ledger.block_or_pruned_exists (send1->hash ()));
node.process_active (send1);
auto flushed = std::async (std::launch::async, [&node] { node.block_processor.flush (); });
ASSERT_NE (std::future_status::timeout, flushed.wait_for (5s));
ASSERT_TIMELY_EQ (5s, 1, node.stats.count (nano::stat::type::blockprocessor, nano::stat::detail::bad_signature));
ASSERT_FALSE (node.ledger.block_or_pruned_exists (send1->hash ()));
auto send2 = builder.make_block ()
.account (nano::dev::genesis_key.pub)
@ -2984,9 +2983,7 @@ TEST (node, block_processor_reject_state)
.work (*node.work_generate_blocking (nano::dev::genesis->hash ()))
.build_shared ();
node.process_active (send2);
auto flushed2 = std::async (std::launch::async, [&node] { node.block_processor.flush (); });
ASSERT_NE (std::future_status::timeout, flushed2.wait_for (5s));
ASSERT_TRUE (node.ledger.block_or_pruned_exists (send2->hash ()));
ASSERT_TIMELY (5s, node.ledger.block_or_pruned_exists (send2->hash ()));
}
TEST (node, block_processor_full)