Fix race condition in unit test active_transactions.activate_inactive
The stats counters are updated in a callback called after the block has been confirmed.
This commit is contained in:
parent
08008d4830
commit
9553d9b7d6
1 changed files with 3 additions and 3 deletions
|
|
@ -1248,9 +1248,9 @@ TEST (active_transactions, activate_inactive)
|
||||||
ASSERT_TIMELY (5s, node.block_confirmed (send2->hash ()));
|
ASSERT_TIMELY (5s, node.block_confirmed (send2->hash ()));
|
||||||
ASSERT_TIMELY (5s, node.block_confirmed (send->hash ()));
|
ASSERT_TIMELY (5s, node.block_confirmed (send->hash ()));
|
||||||
|
|
||||||
ASSERT_EQ (1, node.stats.count (nano::stat::type::confirmation_observer, nano::stat::detail::inactive_conf_height, nano::stat::dir::out));
|
ASSERT_TIMELY_EQ (5s, 1, node.stats.count (nano::stat::type::confirmation_observer, nano::stat::detail::inactive_conf_height, nano::stat::dir::out));
|
||||||
ASSERT_EQ (1, node.stats.count (nano::stat::type::confirmation_observer, nano::stat::detail::active_quorum, nano::stat::dir::out));
|
ASSERT_TIMELY_EQ (5s, 1, node.stats.count (nano::stat::type::confirmation_observer, nano::stat::detail::active_quorum, nano::stat::dir::out));
|
||||||
ASSERT_EQ (0, node.stats.count (nano::stat::type::confirmation_observer, nano::stat::detail::active_conf_height, nano::stat::dir::out));
|
ASSERT_ALWAYS_EQ (50ms, 0, node.stats.count (nano::stat::type::confirmation_observer, nano::stat::detail::active_conf_height, nano::stat::dir::out));
|
||||||
|
|
||||||
// The first block was not active so no activation takes place
|
// The first block was not active so no activation takes place
|
||||||
ASSERT_FALSE (node.active.active (open->qualified_root ()) || node.block_confirmed_or_being_confirmed (open->hash ()));
|
ASSERT_FALSE (node.active.active (open->qualified_root ()) || node.block_confirmed_or_being_confirmed (open->hash ()));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue