mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-24 19:12:34 +02:00
test: speed up and simplify peer_eviction_test
This speeds up the test significantly, which helps when running it repeatedly. Suggest reviewing the diff with: colorMoved = dimmed-zebra colorMovedWs = allow-indentation-change
This commit is contained in:
parent
1cde800523
commit
519e76bb64
@ -15,11 +15,6 @@
|
|||||||
|
|
||||||
BOOST_FIXTURE_TEST_SUITE(net_peer_eviction_tests, BasicTestingSetup)
|
BOOST_FIXTURE_TEST_SUITE(net_peer_eviction_tests, BasicTestingSetup)
|
||||||
|
|
||||||
namespace {
|
|
||||||
constexpr int NODE_EVICTION_TEST_ROUNDS{10};
|
|
||||||
constexpr int NODE_EVICTION_TEST_UP_TO_N_NODES{200};
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
std::vector<NodeEvictionCandidate> GetRandomNodeEvictionCandidates(const int n_candidates, FastRandomContext& random_context)
|
std::vector<NodeEvictionCandidate> GetRandomNodeEvictionCandidates(const int n_candidates, FastRandomContext& random_context)
|
||||||
{
|
{
|
||||||
std::vector<NodeEvictionCandidate> candidates;
|
std::vector<NodeEvictionCandidate> candidates;
|
||||||
@ -257,8 +252,7 @@ BOOST_AUTO_TEST_CASE(peer_eviction_test)
|
|||||||
{
|
{
|
||||||
FastRandomContext random_context{true};
|
FastRandomContext random_context{true};
|
||||||
|
|
||||||
for (int i = 0; i < NODE_EVICTION_TEST_ROUNDS; ++i) {
|
for (int number_of_nodes = 0; number_of_nodes < 200; ++number_of_nodes) {
|
||||||
for (int number_of_nodes = 0; number_of_nodes < NODE_EVICTION_TEST_UP_TO_N_NODES; ++number_of_nodes) {
|
|
||||||
// Four nodes with the highest keyed netgroup values should be
|
// Four nodes with the highest keyed netgroup values should be
|
||||||
// protected from eviction.
|
// protected from eviction.
|
||||||
BOOST_CHECK(!IsEvicted(
|
BOOST_CHECK(!IsEvicted(
|
||||||
@ -342,7 +336,6 @@ BOOST_AUTO_TEST_CASE(peer_eviction_test)
|
|||||||
// * "If any remaining peers are preferred for eviction consider only them. [...]"
|
// * "If any remaining peers are preferred for eviction consider only them. [...]"
|
||||||
// * "Identify the network group with the most connections and youngest member. [...]"
|
// * "Identify the network group with the most connections and youngest member. [...]"
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
Loading…
Reference in New Issue
Block a user