Skip to content

Commit 6b99daf

Browse files
committed
Merge #10429: tests: fix spurious addrman test failure
6b51b0a tests: fix spurious addrman test failure (Cory Fields) Tree-SHA512: 3d41723b1a31ff459d950331ffea7f383e4ef6187990be6a634978bead0c29d7c096f68e7edb6d4dc56069c1fe8a6f12a6daf573cb1e542b15d000eaa54ad288
2 parents 993a1d7 + 6b51b0a commit 6b99daf

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/test/addrman_tests.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,14 @@ BOOST_AUTO_TEST_CASE(addrman_simple)
104104

105105

106106
// Test: New table has one addr and we add a diff addr we should
107-
// have two addrs.
107+
// have at least one addr.
108+
// Note that addrman's size cannot be tested reliably after insertion, as
109+
// hash collisions may occur. But we can always be sure of at least one
110+
// success.
111+
108112
CService addr2 = ResolveService("250.1.1.2", 8333);
109113
BOOST_CHECK(addrman.Add(CAddress(addr2, NODE_NONE), source));
110-
BOOST_CHECK_EQUAL(addrman.size(), 2);
114+
BOOST_CHECK(addrman.size() >= 1);
111115

112116
// Test: AddrMan::Clear() should empty the new table.
113117
addrman.Clear();
@@ -120,7 +124,7 @@ BOOST_AUTO_TEST_CASE(addrman_simple)
120124
vAddr.push_back(CAddress(ResolveService("250.1.1.3", 8333), NODE_NONE));
121125
vAddr.push_back(CAddress(ResolveService("250.1.1.4", 8333), NODE_NONE));
122126
BOOST_CHECK(addrman.Add(vAddr, source));
123-
BOOST_CHECK_EQUAL(addrman.size(), 2);
127+
BOOST_CHECK(addrman.size() >= 1);
124128
}
125129

126130
BOOST_AUTO_TEST_CASE(addrman_ports)

0 commit comments

Comments
 (0)