diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-05-19 15:51:11 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-05-19 15:51:35 +0200 |
commit | 6b99dafe4204e8e86091e6dab6271e9d8aedfba7 (patch) | |
tree | f03bf7f3e139e23897cbaf5ba37f1c1469827afe /src | |
parent | 993a1d710e7e18763a81ff469108f6cde86ad81b (diff) | |
parent | 6b51b0a0760d18ad54f36d8b10935501b3ed489c (diff) |
Merge #10429: tests: fix spurious addrman test failure
6b51b0a tests: fix spurious addrman test failure (Cory Fields)
Tree-SHA512: 3d41723b1a31ff459d950331ffea7f383e4ef6187990be6a634978bead0c29d7c096f68e7edb6d4dc56069c1fe8a6f12a6daf573cb1e542b15d000eaa54ad288
Diffstat (limited to 'src')
-rw-r--r-- | src/test/addrman_tests.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/test/addrman_tests.cpp b/src/test/addrman_tests.cpp index 3812490ec0..dc5372a070 100644 --- a/src/test/addrman_tests.cpp +++ b/src/test/addrman_tests.cpp @@ -104,10 +104,14 @@ BOOST_AUTO_TEST_CASE(addrman_simple) // Test: New table has one addr and we add a diff addr we should - // have two addrs. + // have at least one addr. + // Note that addrman's size cannot be tested reliably after insertion, as + // hash collisions may occur. But we can always be sure of at least one + // success. + CService addr2 = ResolveService("250.1.1.2", 8333); BOOST_CHECK(addrman.Add(CAddress(addr2, NODE_NONE), source)); - BOOST_CHECK_EQUAL(addrman.size(), 2); + BOOST_CHECK(addrman.size() >= 1); // Test: AddrMan::Clear() should empty the new table. addrman.Clear(); @@ -120,7 +124,7 @@ BOOST_AUTO_TEST_CASE(addrman_simple) vAddr.push_back(CAddress(ResolveService("250.1.1.3", 8333), NODE_NONE)); vAddr.push_back(CAddress(ResolveService("250.1.1.4", 8333), NODE_NONE)); BOOST_CHECK(addrman.Add(vAddr, source)); - BOOST_CHECK_EQUAL(addrman.size(), 2); + BOOST_CHECK(addrman.size() >= 1); } BOOST_AUTO_TEST_CASE(addrman_ports) |