diff options
author | Amiti Uttarwar <amiti@uttarwar.org> | 2023-04-25 17:05:23 +0100 |
---|---|---|
committer | Amiti Uttarwar <amiti@uttarwar.org> | 2023-05-26 15:47:55 -0700 |
commit | cd8ef5b3e66b3f766c9c883259b5feb44540d7df (patch) | |
tree | a0415067fb0d8b3975aed2b6b608333179271bae /src/test/addrman_tests.cpp | |
parent | b9f1e86f129e46bb5770fb421d0ba164b5c7aaf8 (diff) |
test: ensure addrman test is finite
Add a counter to ensure that the error case is bounded rather than leading to a
CI timeout
Diffstat (limited to 'src/test/addrman_tests.cpp')
-rw-r--r-- | src/test/addrman_tests.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/test/addrman_tests.cpp b/src/test/addrman_tests.cpp index 54d923e4a4..2242c7a75a 100644 --- a/src/test/addrman_tests.cpp +++ b/src/test/addrman_tests.cpp @@ -239,8 +239,9 @@ BOOST_AUTO_TEST_CASE(addrman_select_by_network) // ensure that both new and tried table are selected from bool new_selected{false}; bool tried_selected{false}; + int counter = 256; - while (!new_selected || !tried_selected) { + while (--counter > 0 && (!new_selected || !tried_selected)) { const CAddress selected{addrman->Select(/*new_only=*/false, NET_I2P).first}; BOOST_REQUIRE(selected == i2p_addr || selected == i2p_addr2); if (selected == i2p_addr) { @@ -249,6 +250,9 @@ BOOST_AUTO_TEST_CASE(addrman_select_by_network) new_selected = true; } } + + BOOST_CHECK(new_selected); + BOOST_CHECK(tried_selected); } BOOST_AUTO_TEST_CASE(addrman_select_special) |