Fix peer_container.tcp_channel_cleanup_works test that was changing config values after node construction.
This commit is contained in:
parent
cb1893a424
commit
32014465e2
3 changed files with 19 additions and 5 deletions
|
@ -68,10 +68,13 @@ TEST (peer_container, tcp_channel_cleanup_works)
|
|||
// Disable the confirm_req messages avoiding them to affect the last_packet_set time
|
||||
node_flags.disable_rep_crawler = true;
|
||||
auto & node1 = *system.add_node (node_config, node_flags);
|
||||
auto outer_node1 = nano::test::add_outer_node (system, node_flags);
|
||||
outer_node1->config.network_params.network.keepalive_period = std::chrono::minutes (10);
|
||||
auto outer_node2 = nano::test::add_outer_node (system, node_flags);
|
||||
outer_node2->config.network_params.network.keepalive_period = std::chrono::minutes (10);
|
||||
|
||||
auto config1 = node_config;
|
||||
config1.network_params.network.keepalive_period = std::chrono::minutes (10);
|
||||
auto outer_node1 = nano::test::add_outer_node (system, config1, node_flags);
|
||||
auto config2 = config1;
|
||||
config2.network_params.network.keepalive_period = std::chrono::minutes (10);
|
||||
auto outer_node2 = nano::test::add_outer_node (system, config2, node_flags);
|
||||
auto now = std::chrono::steady_clock::now ();
|
||||
auto channel1 = nano::test::establish_tcp (system, node1, outer_node1->network.endpoint ());
|
||||
ASSERT_NE (nullptr, channel1);
|
||||
|
|
|
@ -24,6 +24,14 @@ std::shared_ptr<nano::transport::channel_tcp> nano::test::establish_tcp (nano::t
|
|||
return result;
|
||||
}
|
||||
|
||||
std::shared_ptr<nano::node> nano::test::add_outer_node (nano::test::system & system_a, nano::node_config const & config_a, nano::node_flags flags_a)
|
||||
{
|
||||
auto outer_node = std::make_shared<nano::node> (system_a.io_ctx, nano::unique_path (), config_a, system_a.work, flags_a);
|
||||
outer_node->start ();
|
||||
system_a.nodes.push_back (outer_node);
|
||||
return outer_node;
|
||||
}
|
||||
|
||||
std::shared_ptr<nano::node> nano::test::add_outer_node (nano::test::system & system_a, nano::node_flags flags_a)
|
||||
{
|
||||
auto outer_node = std::make_shared<nano::node> (system_a.io_ctx, system_a.get_available_port (), nano::unique_path (), system_a.work, flags_a);
|
||||
|
@ -55,4 +63,4 @@ uint16_t nano::test::speculatively_choose_a_free_tcp_bind_port ()
|
|||
acceptor.close ();
|
||||
|
||||
return port;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,9 @@ namespace test
|
|||
/** Waits until a TCP connection is established and returns the TCP channel on success*/
|
||||
std::shared_ptr<nano::transport::channel_tcp> establish_tcp (nano::test::system &, nano::node &, nano::endpoint const &);
|
||||
|
||||
/** Adds a node to the system without establishing connections */
|
||||
std::shared_ptr<nano::node> add_outer_node (nano::test::system & system, nano::node_config const & config_a, nano::node_flags = nano::node_flags ());
|
||||
|
||||
/** Adds a node to the system without establishing connections */
|
||||
std::shared_ptr<nano::node> add_outer_node (nano::test::system & system, nano::node_flags = nano::node_flags ());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue