Skip to content

Commit cd8ef5b

Browse files
committed
test: ensure addrman test is finite
Add a counter to ensure that the error case is bounded rather than leading to a CI timeout
1 parent b9f1e86 commit cd8ef5b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/test/addrman_tests.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,9 @@ BOOST_AUTO_TEST_CASE(addrman_select_by_network)
239239
// ensure that both new and tried table are selected from
240240
bool new_selected{false};
241241
bool tried_selected{false};
242+
int counter = 256;
242243

243-
while (!new_selected || !tried_selected) {
244+
while (--counter > 0 && (!new_selected || !tried_selected)) {
244245
const CAddress selected{addrman->Select(/*new_only=*/false, NET_I2P).first};
245246
BOOST_REQUIRE(selected == i2p_addr || selected == i2p_addr2);
246247
if (selected == i2p_addr) {
@@ -249,6 +250,9 @@ BOOST_AUTO_TEST_CASE(addrman_select_by_network)
249250
new_selected = true;
250251
}
251252
}
253+
254+
BOOST_CHECK(new_selected);
255+
BOOST_CHECK(tried_selected);
252256
}
253257

254258
BOOST_AUTO_TEST_CASE(addrman_select_special)

0 commit comments

Comments
 (0)