Skip to content

Commit 3f8105c

Browse files
committed
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.
1 parent 38a81a8 commit 3f8105c

File tree

1 file changed

+0
-72
lines changed

1 file changed

+0
-72
lines changed

src/test/net_peer_eviction_tests.cpp

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -154,78 +154,6 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
154154
/* protected_peer_ids */ {0, 1, 2, 7, 8, 9},
155155
/* unprotected_peer_ids */ {3, 4, 5, 6, 10, 11},
156156
random_context));
157-
158-
// Combined test: expect 1/4 onion and 2 localhost peers to be protected
159-
// from eviction, sorted by longest uptime.
160-
BOOST_CHECK(IsProtected(
161-
num_peers, [](NodeEvictionCandidate& c) {
162-
c.nTimeConnected = c.id;
163-
c.m_is_onion = (c.id == 0 || c.id == 5 || c.id == 10);
164-
c.m_is_local = (c.id == 1 || c.id == 9 || c.id == 11);
165-
},
166-
/* protected_peer_ids */ {0, 1, 2, 5, 9, 10},
167-
/* unprotected_peer_ids */ {3, 4, 6, 7, 8, 11},
168-
random_context));
169-
170-
// Combined test: expect having only 1 onion to allow allocating the
171-
// remaining 2 of the 1/4 to localhost peers, sorted by longest uptime.
172-
BOOST_CHECK(IsProtected(
173-
num_peers + 4, [](NodeEvictionCandidate& c) {
174-
c.nTimeConnected = c.id;
175-
c.m_is_onion = (c.id == 15);
176-
c.m_is_local = (c.id > 6 && c.id < 11);
177-
},
178-
/* protected_peer_ids */ {0, 1, 2, 3, 7, 8, 9, 15},
179-
/* unprotected_peer_ids */ {4, 5, 6, 10, 11, 12, 13, 14},
180-
random_context));
181-
182-
// Combined test: expect 2 onions (< 1/4) to allow allocating the minimum 2
183-
// localhost peers, sorted by longest uptime.
184-
BOOST_CHECK(IsProtected(
185-
num_peers, [](NodeEvictionCandidate& c) {
186-
c.nTimeConnected = c.id;
187-
c.m_is_onion = (c.id == 7 || c.id == 9);
188-
c.m_is_local = (c.id == 6 || c.id == 11);
189-
},
190-
/* protected_peer_ids */ {0, 1, 6, 7, 9, 11},
191-
/* unprotected_peer_ids */ {2, 3, 4, 5, 8, 10},
192-
random_context));
193-
194-
// Combined test: when > 1/4, expect max 1/4 onion and 2 localhost peers
195-
// to be protected from eviction, sorted by longest uptime.
196-
BOOST_CHECK(IsProtected(
197-
num_peers, [](NodeEvictionCandidate& c) {
198-
c.nTimeConnected = c.id;
199-
c.m_is_onion = (c.id > 3 && c.id < 8);
200-
c.m_is_local = (c.id > 7);
201-
},
202-
/* protected_peer_ids */ {0, 4, 5, 6, 8, 9},
203-
/* unprotected_peer_ids */ {1, 2, 3, 7, 10, 11},
204-
random_context));
205-
206-
// Combined test: idem > 1/4 with only 8 peers: expect 2 onion and 2
207-
// localhost peers (1/4 + 2) to be protected, sorted by longest uptime.
208-
BOOST_CHECK(IsProtected(
209-
8, [](NodeEvictionCandidate& c) {
210-
c.nTimeConnected = c.id;
211-
c.m_is_onion = (c.id > 1 && c.id < 5);
212-
c.m_is_local = (c.id > 4);
213-
},
214-
/* protected_peer_ids */ {2, 3, 5, 6},
215-
/* unprotected_peer_ids */ {0, 1, 4, 7},
216-
random_context));
217-
218-
// Combined test: idem > 1/4 with only 6 peers: expect 1 onion peer and no
219-
// localhost peers (1/4 + 0) to be protected, sorted by longest uptime.
220-
BOOST_CHECK(IsProtected(
221-
6, [](NodeEvictionCandidate& c) {
222-
c.nTimeConnected = c.id;
223-
c.m_is_onion = (c.id == 4 || c.id == 5);
224-
c.m_is_local = (c.id == 3);
225-
},
226-
/* protected_peer_ids */ {0, 1, 4},
227-
/* unprotected_peer_ids */ {2, 3, 5},
228-
random_context));
229157
}
230158

231159
// Returns true if any of the node ids in node_ids are selected for eviction.

0 commit comments

Comments
 (0)