From 4c6b0766a6cfb28fd2eaf37a917be12edf8398b0 Mon Sep 17 00:00:00 2001 From: clemahieu Date: Fri, 1 Sep 2023 12:43:35 +0100 Subject: [PATCH] Add checking delay within gap_bootstrap to fix intermittently failing test. (#4273) The block is not guaranteed to be broadcast to both other nodes after it is generated with ::send_action so use ASSERT_TIMELY to check for the correct conditions. --- nano/core_test/gap_cache.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nano/core_test/gap_cache.cpp b/nano/core_test/gap_cache.cpp index 0c31c4a373..e0554f61ab 100644 --- a/nano/core_test/gap_cache.cpp +++ b/nano/core_test/gap_cache.cpp @@ -119,8 +119,8 @@ TEST (gap_cache, gap_bootstrap) system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); auto latest_block (system.wallet (0)->send_action (nano::dev::genesis_key.pub, key.pub, 100)); ASSERT_NE (nullptr, latest_block); - ASSERT_EQ (nano::dev::constants.genesis_amount - 200, node1.balance (nano::dev::genesis->account ())); - ASSERT_EQ (nano::dev::constants.genesis_amount, node2.balance (nano::dev::genesis->account ())); + ASSERT_TIMELY (5s, nano::dev::constants.genesis_amount - 200 == node1.balance (nano::dev::genesis->account ())); + ASSERT_TIMELY (5s, nano::dev::constants.genesis_amount == node2.balance (nano::dev::genesis->account ())); ASSERT_TIMELY (5s, node2.balance (nano::dev::genesis->account ()) == nano::dev::constants.genesis_amount - 200); }