Skip to content

Commit

Permalink
Rewriting tests to not use block_processor::flush.
Browse files Browse the repository at this point in the history
  • Loading branch information
clemahieu committed Jan 28, 2024
1 parent ec99574 commit 9da3607
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
8 changes: 2 additions & 6 deletions nano/core_test/confirmation_height.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ());
Expand Down
7 changes: 2 additions & 5 deletions nano/core_test/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2992,8 +2992,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)
Expand All @@ -3005,9 +3004,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)
Expand Down

0 comments on commit 9da3607

Please sign in to comment.