mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-05-04 08:51:00 +02:00
test: ensure addrman test is finite
Add a counter to ensure that the error case is bounded rather than leading to a CI timeout
This commit is contained in:
parent
b9f1e86f12
commit
cd8ef5b3e6
@ -239,8 +239,9 @@ BOOST_AUTO_TEST_CASE(addrman_select_by_network)
|
|||||||
// ensure that both new and tried table are selected from
|
// ensure that both new and tried table are selected from
|
||||||
bool new_selected{false};
|
bool new_selected{false};
|
||||||
bool tried_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};
|
const CAddress selected{addrman->Select(/*new_only=*/false, NET_I2P).first};
|
||||||
BOOST_REQUIRE(selected == i2p_addr || selected == i2p_addr2);
|
BOOST_REQUIRE(selected == i2p_addr || selected == i2p_addr2);
|
||||||
if (selected == i2p_addr) {
|
if (selected == i2p_addr) {
|
||||||
@ -249,6 +250,9 @@ BOOST_AUTO_TEST_CASE(addrman_select_by_network)
|
|||||||
new_selected = true;
|
new_selected = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_CHECK(new_selected);
|
||||||
|
BOOST_CHECK(tried_selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(addrman_select_special)
|
BOOST_AUTO_TEST_CASE(addrman_select_special)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user