diff options
author | Jon Atack <jon@atack.com> | 2021-06-02 23:15:01 +0200 |
---|---|---|
committer | Jon Atack <jon@atack.com> | 2021-06-13 20:15:51 +0200 |
commit | 3f8105c4d251e0e81bdd31f0999004e36f8990b2 (patch) | |
tree | ea3396646bffe279aa5b1544bf1dc2781a7af9c7 /src/test/net_peer_eviction_tests.cpp | |
parent | 38a81a8e20b0e5ad9fef0eae8abd914619f05b25 (diff) |
test: remove combined onion/localhost eviction protection tests
as we are about the change the behavior sufficiently that when we
have multiple disadvantaged networks and a small number of peers
under test, the number of protected peers per network can be different.
Diffstat (limited to 'src/test/net_peer_eviction_tests.cpp')
-rw-r--r-- | src/test/net_peer_eviction_tests.cpp | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/src/test/net_peer_eviction_tests.cpp b/src/test/net_peer_eviction_tests.cpp index 7e74b6f6a3..9e5b4a47d5 100644 --- a/src/test/net_peer_eviction_tests.cpp +++ b/src/test/net_peer_eviction_tests.cpp @@ -154,78 +154,6 @@ BOOST_AUTO_TEST_CASE(peer_protection_test) /* protected_peer_ids */ {0, 1, 2, 7, 8, 9}, /* unprotected_peer_ids */ {3, 4, 5, 6, 10, 11}, random_context)); - - // Combined test: expect 1/4 onion and 2 localhost peers to be protected - // from eviction, sorted by longest uptime. - BOOST_CHECK(IsProtected( - num_peers, [](NodeEvictionCandidate& c) { - c.nTimeConnected = c.id; - c.m_is_onion = (c.id == 0 || c.id == 5 || c.id == 10); - c.m_is_local = (c.id == 1 || c.id == 9 || c.id == 11); - }, - /* protected_peer_ids */ {0, 1, 2, 5, 9, 10}, - /* unprotected_peer_ids */ {3, 4, 6, 7, 8, 11}, - random_context)); - - // Combined test: expect having only 1 onion to allow allocating the - // remaining 2 of the 1/4 to localhost peers, sorted by longest uptime. - BOOST_CHECK(IsProtected( - num_peers + 4, [](NodeEvictionCandidate& c) { - c.nTimeConnected = c.id; - c.m_is_onion = (c.id == 15); - c.m_is_local = (c.id > 6 && c.id < 11); - }, - /* protected_peer_ids */ {0, 1, 2, 3, 7, 8, 9, 15}, - /* unprotected_peer_ids */ {4, 5, 6, 10, 11, 12, 13, 14}, - random_context)); - - // Combined test: expect 2 onions (< 1/4) to allow allocating the minimum 2 - // localhost peers, sorted by longest uptime. - BOOST_CHECK(IsProtected( - num_peers, [](NodeEvictionCandidate& c) { - c.nTimeConnected = c.id; - c.m_is_onion = (c.id == 7 || c.id == 9); - c.m_is_local = (c.id == 6 || c.id == 11); - }, - /* protected_peer_ids */ {0, 1, 6, 7, 9, 11}, - /* unprotected_peer_ids */ {2, 3, 4, 5, 8, 10}, - random_context)); - - // Combined test: when > 1/4, expect max 1/4 onion and 2 localhost peers - // to be protected from eviction, sorted by longest uptime. - BOOST_CHECK(IsProtected( - num_peers, [](NodeEvictionCandidate& c) { - c.nTimeConnected = c.id; - c.m_is_onion = (c.id > 3 && c.id < 8); - c.m_is_local = (c.id > 7); - }, - /* protected_peer_ids */ {0, 4, 5, 6, 8, 9}, - /* unprotected_peer_ids */ {1, 2, 3, 7, 10, 11}, - random_context)); - - // Combined test: idem > 1/4 with only 8 peers: expect 2 onion and 2 - // localhost peers (1/4 + 2) to be protected, sorted by longest uptime. - BOOST_CHECK(IsProtected( - 8, [](NodeEvictionCandidate& c) { - c.nTimeConnected = c.id; - c.m_is_onion = (c.id > 1 && c.id < 5); - c.m_is_local = (c.id > 4); - }, - /* protected_peer_ids */ {2, 3, 5, 6}, - /* unprotected_peer_ids */ {0, 1, 4, 7}, - random_context)); - - // Combined test: idem > 1/4 with only 6 peers: expect 1 onion peer and no - // localhost peers (1/4 + 0) to be protected, sorted by longest uptime. - BOOST_CHECK(IsProtected( - 6, [](NodeEvictionCandidate& c) { - c.nTimeConnected = c.id; - c.m_is_onion = (c.id == 4 || c.id == 5); - c.m_is_local = (c.id == 3); - }, - /* protected_peer_ids */ {0, 1, 4}, - /* unprotected_peer_ids */ {2, 3, 5}, - random_context)); } // Returns true if any of the node ids in node_ids are selected for eviction. |