Move test code into namespace nano::test (#3890)
* Move nano::establish_tcp into nano::test namespace * Move system.hpp declarations into namespace nano::test * Move telemetry test code to namespace nano::test * Move testutil declarations into namespace nano::test
This commit is contained in:
		
					parent
					
						
							
								dbdff7297c
							
						
					
				
			
			
				commit
				
					
						78631a6b1c
					
				
			
		
					 49 changed files with 1214 additions and 1191 deletions
				
			
		|  | @ -32,7 +32,7 @@ namespace nano | |||
| 
 | ||||
| TEST (active_transactions, confirm_election_by_request) | ||||
| { | ||||
| 	nano::system system{}; | ||||
| 	nano::test::system system{}; | ||||
| 	auto & node1 = *system.add_node (); | ||||
| 
 | ||||
| 	nano::node_flags node_flags2{}; | ||||
|  | @ -86,7 +86,7 @@ namespace nano | |||
| { | ||||
| TEST (active_transactions, confirm_frontier) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_request_loop = true; | ||||
| 	// Voting node
 | ||||
|  | @ -132,9 +132,9 @@ TEST (active_transactions, confirm_frontier) | |||
| 
 | ||||
| TEST (active_transactions, keep_local) | ||||
| { | ||||
| 	nano::system system{}; | ||||
| 	nano::test::system system{}; | ||||
| 
 | ||||
| 	nano::node_config node_config{ nano::get_available_port (), system.logging }; | ||||
| 	nano::node_config node_config{ nano::test::get_available_port (), system.logging }; | ||||
| 	node_config.enable_voting = false; | ||||
| 	// Bound to 2, won't drop wallet created transactions, but good to test dropping remote
 | ||||
| 	node_config.active_elections_size = 2; | ||||
|  | @ -208,7 +208,7 @@ TEST (active_transactions, keep_local) | |||
| 
 | ||||
| TEST (active_transactions, inactive_votes_cache) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node = *system.nodes[0]; | ||||
| 	nano::block_hash latest (node.latest (nano::dev::genesis_key.pub)); | ||||
| 	nano::keypair key; | ||||
|  | @ -230,7 +230,7 @@ TEST (active_transactions, inactive_votes_cache) | |||
| 
 | ||||
| TEST (active_transactions, inactive_votes_cache_non_final) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node = *system.nodes[0]; | ||||
| 	nano::block_hash latest (node.latest (nano::dev::genesis_key.pub)); | ||||
| 	nano::keypair key; | ||||
|  | @ -255,7 +255,7 @@ TEST (active_transactions, inactive_votes_cache_non_final) | |||
| 
 | ||||
| TEST (active_transactions, inactive_votes_cache_fork) | ||||
| { | ||||
| 	nano::system system{ 1 }; | ||||
| 	nano::test::system system{ 1 }; | ||||
| 	auto & node = *system.nodes[0]; | ||||
| 
 | ||||
| 	auto const latest = node.latest (nano::dev::genesis_key.pub); | ||||
|  | @ -295,8 +295,8 @@ TEST (active_transactions, inactive_votes_cache_fork) | |||
| 
 | ||||
| TEST (active_transactions, inactive_votes_cache_existing_vote) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto & node = *system.add_node (node_config); | ||||
| 	nano::block_hash latest (node.latest (nano::dev::genesis_key.pub)); | ||||
|  | @ -355,8 +355,8 @@ TEST (active_transactions, inactive_votes_cache_existing_vote) | |||
| // Issue for investigating it: https://github.com/nanocurrency/nano-node/issues/3632
 | ||||
| TEST (active_transactions, DISABLED_inactive_votes_cache_multiple_votes) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto & node = *system.add_node (node_config); | ||||
| 	nano::block_hash latest (node.latest (nano::dev::genesis_key.pub)); | ||||
|  | @ -406,8 +406,8 @@ TEST (active_transactions, DISABLED_inactive_votes_cache_multiple_votes) | |||
| 
 | ||||
| TEST (active_transactions, inactive_votes_cache_election_start) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto & node = *system.add_node (node_config); | ||||
| 	nano::block_hash latest (node.latest (nano::dev::genesis_key.pub)); | ||||
|  | @ -512,8 +512,8 @@ namespace nano | |||
| { | ||||
| TEST (active_transactions, vote_replays) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.enable_voting = false; | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto & node = *system.add_node (node_config); | ||||
|  | @ -541,7 +541,7 @@ TEST (active_transactions, vote_replays) | |||
| 	ASSERT_NE (nullptr, open1); | ||||
| 	node.process_active (send1); | ||||
| 	node.process_active (open1); | ||||
| 	nano::blocks_confirm (node, { send1, open1 }); | ||||
| 	nano::test::blocks_confirm (node, { send1, open1 }); | ||||
| 	ASSERT_EQ (2, node.active.size ()); | ||||
| 	// First vote is not a replay and confirms the election, second vote should be a replay since the election has confirmed but not yet removed
 | ||||
| 	auto vote_send1 (std::make_shared<nano::vote> (nano::dev::genesis_key.pub, nano::dev::genesis_key.prv, nano::vote::timestamp_max, nano::vote::duration_max, std::vector<nano::block_hash>{ send1->hash () })); | ||||
|  | @ -570,7 +570,7 @@ TEST (active_transactions, vote_replays) | |||
| 				 .build_shared (); | ||||
| 	ASSERT_NE (nullptr, send2); | ||||
| 	node.process_active (send2); | ||||
| 	nano::blocks_confirm (node, { send2 }); | ||||
| 	nano::test::blocks_confirm (node, { send2 }); | ||||
| 	ASSERT_EQ (1, node.active.size ()); | ||||
| 	auto vote1_send2 (std::make_shared<nano::vote> (nano::dev::genesis_key.pub, nano::dev::genesis_key.prv, nano::vote::timestamp_max, nano::vote::duration_max, std::vector<nano::block_hash>{ send2->hash () })); | ||||
| 	auto vote2_send2 (std::make_shared<nano::vote> (key.pub, key.prv, 0, 0, std::vector<nano::block_hash>{ send2->hash () })); | ||||
|  | @ -601,7 +601,7 @@ TEST (active_transactions, vote_replays) | |||
| // Tests that blocks are correctly cleared from the duplicate filter for unconfirmed elections
 | ||||
| TEST (active_transactions, dropped_cleanup) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags flags; | ||||
| 	flags.disable_request_loop = true; | ||||
| 	auto & node (*system.add_node (flags)); | ||||
|  | @ -659,11 +659,11 @@ TEST (active_transactions, dropped_cleanup) | |||
| 
 | ||||
| TEST (active_transactions, republish_winner) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config{ nano::get_available_port (), system.logging }; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config{ nano::test::get_available_port (), system.logging }; | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto & node1 = *system.add_node (node_config); | ||||
| 	node_config.peering_port = nano::get_available_port (); | ||||
| 	node_config.peering_port = nano::test::get_available_port (); | ||||
| 	auto & node2 = *system.add_node (node_config); | ||||
| 
 | ||||
| 	nano::keypair key; | ||||
|  | @ -726,9 +726,9 @@ TEST (active_transactions, republish_winner) | |||
| 
 | ||||
| TEST (active_transactions, fork_filter_cleanup) | ||||
| { | ||||
| 	nano::system system{}; | ||||
| 	nano::test::system system{}; | ||||
| 
 | ||||
| 	nano::node_config node_config{ nano::get_available_port (), system.logging }; | ||||
| 	nano::node_config node_config{ nano::test::get_available_port (), system.logging }; | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 
 | ||||
| 	auto & node1 = *system.add_node (node_config); | ||||
|  | @ -776,7 +776,7 @@ TEST (active_transactions, fork_filter_cleanup) | |||
| 	ASSERT_EQ (1, node1.active.size ()); | ||||
| 
 | ||||
| 	// Instantiate a new node
 | ||||
| 	node_config.peering_port = nano::get_available_port (); | ||||
| 	node_config.peering_port = nano::test::get_available_port (); | ||||
| 	auto & node2 = *system.add_node (node_config); | ||||
| 
 | ||||
| 	// Process the first initial block on node2
 | ||||
|  | @ -798,8 +798,8 @@ TEST (active_transactions, fork_filter_cleanup) | |||
| 
 | ||||
| TEST (active_transactions, fork_replacement_tally) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto & node1 (*system.add_node (node_config)); | ||||
| 
 | ||||
|  | @ -904,7 +904,7 @@ TEST (active_transactions, fork_replacement_tally) | |||
| 	} | ||||
| 
 | ||||
| 	// Process correct block
 | ||||
| 	node_config.peering_port = nano::get_available_port (); | ||||
| 	node_config.peering_port = nano::test::get_available_port (); | ||||
| 	auto & node2 (*system.add_node (node_config)); | ||||
| 	node2.network.flood_block (send_last); | ||||
| 	ASSERT_TIMELY (3s, node1.stats.count (nano::stat::type::message, nano::stat::detail::publish, nano::stat::dir::in) > 0); | ||||
|  | @ -944,8 +944,8 @@ namespace nano | |||
| // Blocks that won an election must always be seen as confirming or cemented
 | ||||
| TEST (active_transactions, confirmation_consistency) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto & node = *system.add_node (node_config); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
|  | @ -974,7 +974,7 @@ TEST (active_transactions, confirmation_consistency) | |||
| // Issue for investigating it: https://github.com/nanocurrency/nano-node/issues/3634
 | ||||
| TEST (active_transactions, DISABLED_confirm_new) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node1 = *system.nodes[0]; | ||||
| 	auto send = nano::send_block_builder () | ||||
| 				.previous (nano::dev::genesis->hash ()) | ||||
|  | @ -999,7 +999,7 @@ TEST (active_transactions, DISABLED_confirm_new) | |||
| // Ensures votes are tallied on election::publish even if no vote is inserted through inactive_votes_cache
 | ||||
| TEST (active_transactions, conflicting_block_vote_existing_election) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_request_loop = true; | ||||
| 	auto & node = *system.add_node (node_flags); | ||||
|  | @ -1043,9 +1043,9 @@ TEST (active_transactions, conflicting_block_vote_existing_election) | |||
| 
 | ||||
| TEST (active_transactions, activate_account_chain) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags flags; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto & node = *system.add_node (config, flags); | ||||
| 
 | ||||
|  | @ -1143,9 +1143,9 @@ TEST (active_transactions, activate_account_chain) | |||
| 
 | ||||
| TEST (active_transactions, activate_inactive) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags flags; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto & node = *system.add_node (config, flags); | ||||
| 
 | ||||
|  | @ -1202,7 +1202,7 @@ TEST (active_transactions, activate_inactive) | |||
| 
 | ||||
| TEST (active_transactions, list_active) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node = *system.nodes[0]; | ||||
| 
 | ||||
| 	nano::keypair key; | ||||
|  | @ -1243,7 +1243,7 @@ TEST (active_transactions, list_active) | |||
| 
 | ||||
| 	ASSERT_EQ (nano::process_result::progress, node.process (*open).code); | ||||
| 
 | ||||
| 	nano::blocks_confirm (node, { send, send2, open }); | ||||
| 	nano::test::blocks_confirm (node, { send, send2, open }); | ||||
| 	ASSERT_EQ (3, node.active.size ()); | ||||
| 	ASSERT_EQ (1, node.active.list_active (1).size ()); | ||||
| 	ASSERT_EQ (2, node.active.list_active (2).size ()); | ||||
|  | @ -1257,8 +1257,8 @@ TEST (active_transactions, list_active) | |||
| 
 | ||||
| TEST (active_transactions, vacancy) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config{ nano::get_available_port (), system.logging }; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config{ nano::test::get_available_port (), system.logging }; | ||||
| 	config.active_elections_size = 1; | ||||
| 	auto & node = *system.add_node (config); | ||||
| 	nano::state_block_builder builder; | ||||
|  | @ -1292,9 +1292,9 @@ TEST (active_transactions, vacancy) | |||
| // Ensure transactions in excess of capacity are removed in fifo order
 | ||||
| TEST (active_transactions, fifo) | ||||
| { | ||||
| 	nano::system system{}; | ||||
| 	nano::test::system system{}; | ||||
| 
 | ||||
| 	nano::node_config config{ nano::get_available_port (), system.logging }; | ||||
| 	nano::node_config config{ nano::test::get_available_port (), system.logging }; | ||||
| 	config.active_elections_size = 1; | ||||
| 
 | ||||
| 	auto & node = *system.add_node (config); | ||||
|  | @ -1374,8 +1374,8 @@ TEST (active_transactions, fifo) | |||
| // Ensures we limit the number of vote hinted elections in AEC
 | ||||
| TEST (active_transactions, limit_vote_hinted_elections) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config{ nano::get_available_port (), system.logging }; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config{ nano::test::get_available_port (), system.logging }; | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	config.active_elections_size = 10; | ||||
| 	config.active_elections_hinted_limit_percentage = 10; // Should give us a limit of 1 hinted election
 | ||||
|  | @ -1426,7 +1426,7 @@ TEST (active_transactions, limit_vote_hinted_elections) | |||
| 		ASSERT_EQ (nano::process_result::progress, node.process (*send2).code); | ||||
| 		ASSERT_EQ (nano::process_result::progress, node.process (*open1).code); | ||||
| 		ASSERT_EQ (nano::process_result::progress, node.process (*open2).code); | ||||
| 		nano::blocks_confirm (node, { send1, send2, open1, open2 }, true); | ||||
| 		nano::test::blocks_confirm (node, { send1, send2, open1, open2 }, true); | ||||
| 		ASSERT_TIMELY (1s, node.block_confirmed (send1->hash ())); | ||||
| 		ASSERT_TIMELY (1s, node.block_confirmed (send2->hash ())); | ||||
| 		ASSERT_TIMELY (1s, node.block_confirmed (open1->hash ())); | ||||
|  | @ -1452,7 +1452,7 @@ TEST (active_transactions, limit_vote_hinted_elections) | |||
| 					 .work (*system.work.generate (latest)) | ||||
| 					 .build_shared (); | ||||
| 		ASSERT_EQ (nano::process_result::progress, node.process (*send0).code); | ||||
| 		nano::blocks_confirm (node, { send0 }, true); | ||||
| 		nano::test::blocks_confirm (node, { send0 }, true); | ||||
| 		ASSERT_TIMELY (1s, node.block_confirmed (send0->hash ())); | ||||
| 		ASSERT_TIMELY (1s, node.active.empty ()); | ||||
| 		auto send1 = builder.make_block () | ||||
|  | @ -1465,7 +1465,7 @@ TEST (active_transactions, limit_vote_hinted_elections) | |||
| 					 .work (*system.work.generate (send0->hash ())) | ||||
| 					 .build_shared (); | ||||
| 		ASSERT_EQ (nano::process_result::progress, node.process (*send1).code); | ||||
| 		nano::blocks_confirm (node, { send1 }, true); | ||||
| 		nano::test::blocks_confirm (node, { send1 }, true); | ||||
| 		ASSERT_TIMELY (1s, node.block_confirmed (send1->hash ())); | ||||
| 		ASSERT_TIMELY (1s, node.active.empty ()); | ||||
| 
 | ||||
|  |  | |||
|  | @ -416,7 +416,7 @@ TEST (block_store, genesis) | |||
| // deleting it from the database
 | ||||
| TEST (unchecked, simple) | ||||
| { | ||||
| 	nano::system system{}; | ||||
| 	nano::test::system system{}; | ||||
| 	nano::logger_mt logger{}; | ||||
| 	auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); | ||||
| 	nano::unchecked_map unchecked{ *store, false }; | ||||
|  | @ -456,7 +456,7 @@ TEST (unchecked, simple) | |||
| // This test ensures the unchecked table is able to receive more than one block
 | ||||
| TEST (unchecked, multiple) | ||||
| { | ||||
| 	nano::system system{}; | ||||
| 	nano::test::system system{}; | ||||
| 	if (nano::rocksdb_config::using_rocksdb_in_tests ()) | ||||
| 	{ | ||||
| 		// Don't test this in rocksdb mode
 | ||||
|  | @ -494,7 +494,7 @@ TEST (unchecked, multiple) | |||
| // This test ensures that a block can't occur twice in the unchecked table.
 | ||||
| TEST (unchecked, double_put) | ||||
| { | ||||
| 	nano::system system{}; | ||||
| 	nano::test::system system{}; | ||||
| 	nano::logger_mt logger{}; | ||||
| 	auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); | ||||
| 	nano::unchecked_map unchecked{ *store, false }; | ||||
|  | @ -528,7 +528,7 @@ TEST (unchecked, double_put) | |||
| // Tests that recurrent get calls return the correct values
 | ||||
| TEST (unchecked, multiple_get) | ||||
| { | ||||
| 	nano::system system{}; | ||||
| 	nano::test::system system{}; | ||||
| 	nano::logger_mt logger{}; | ||||
| 	auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); | ||||
| 	nano::unchecked_map unchecked{ *store, false }; | ||||
|  | @ -2649,7 +2649,7 @@ TEST (rocksdb_block_store, tombstone_count) | |||
| 	{ | ||||
| 		return; | ||||
| 	} | ||||
| 	nano::system system{}; | ||||
| 	nano::test::system system{}; | ||||
| 	nano::logger_mt logger; | ||||
| 	auto store = std::make_unique<nano::rocksdb::store> (logger, nano::unique_path (), nano::dev::constants); | ||||
| 	ASSERT_TRUE (!store->init_error ()); | ||||
|  |  | |||
|  | @ -12,11 +12,11 @@ using namespace std::chrono_literals; | |||
| 
 | ||||
| TEST (block_processor, broadcast_block_on_arrival) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config1{ nano::get_available_port (), system.logging }; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config1{ nano::test::get_available_port (), system.logging }; | ||||
| 	// Deactivates elections on both nodes.
 | ||||
| 	config1.active_elections_size = 0; | ||||
| 	nano::node_config config2{ nano::get_available_port (), system.logging }; | ||||
| 	nano::node_config config2{ nano::test::get_available_port (), system.logging }; | ||||
| 	config2.active_elections_size = 0; | ||||
| 	nano::node_flags flags; | ||||
| 	// Disables bootstrap listener to make sure the block won't be shared by this channel.
 | ||||
|  |  | |||
|  | @ -11,7 +11,7 @@ using namespace std::chrono_literals; | |||
| // If the account doesn't exist, current == end so there's no iteration
 | ||||
| TEST (bulk_pull, no_address) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto connection (std::make_shared<nano::bootstrap_server> (std::make_shared<nano::socket> (*system.nodes[0], nano::socket::endpoint_type_t::server), system.nodes[0])); | ||||
| 	auto req = std::make_unique<nano::bulk_pull> (nano::dev::network_params.network); | ||||
| 	req->start = 1; | ||||
|  | @ -23,7 +23,7 @@ TEST (bulk_pull, no_address) | |||
| 
 | ||||
| TEST (bulk_pull, genesis_to_end) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto connection (std::make_shared<nano::bootstrap_server> (std::make_shared<nano::socket> (*system.nodes[0], nano::socket::endpoint_type_t::server), system.nodes[0])); | ||||
| 	auto req = std::make_unique<nano::bulk_pull> (nano::dev::network_params.network); | ||||
| 	req->start = nano::dev::genesis_key.pub; | ||||
|  | @ -36,7 +36,7 @@ TEST (bulk_pull, genesis_to_end) | |||
| // If we can't find the end block, send everything
 | ||||
| TEST (bulk_pull, no_end) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto connection (std::make_shared<nano::bootstrap_server> (std::make_shared<nano::socket> (*system.nodes[0], nano::socket::endpoint_type_t::server), system.nodes[0])); | ||||
| 	auto req = std::make_unique<nano::bulk_pull> (nano::dev::network_params.network); | ||||
| 	req->start = nano::dev::genesis_key.pub; | ||||
|  | @ -48,7 +48,7 @@ TEST (bulk_pull, no_end) | |||
| 
 | ||||
| TEST (bulk_pull, end_not_owned) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	nano::keypair key2; | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
| 	ASSERT_NE (nullptr, system.wallet (0)->send_action (nano::dev::genesis_key.pub, key2.pub, 100)); | ||||
|  | @ -79,7 +79,7 @@ TEST (bulk_pull, end_not_owned) | |||
| 
 | ||||
| TEST (bulk_pull, none) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto connection (std::make_shared<nano::bootstrap_server> (std::make_shared<nano::socket> (*system.nodes[0], nano::socket::endpoint_type_t::server), system.nodes[0])); | ||||
| 	auto req = std::make_unique<nano::bulk_pull> (nano::dev::network_params.network); | ||||
| 	req->start = nano::dev::genesis_key.pub; | ||||
|  | @ -91,7 +91,7 @@ TEST (bulk_pull, none) | |||
| 
 | ||||
| TEST (bulk_pull, get_next_on_open) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto connection (std::make_shared<nano::bootstrap_server> (std::make_shared<nano::socket> (*system.nodes[0], nano::socket::endpoint_type_t::server), system.nodes[0])); | ||||
| 	auto req = std::make_unique<nano::bulk_pull> (nano::dev::network_params.network); | ||||
| 	req->start = nano::dev::genesis_key.pub; | ||||
|  | @ -108,7 +108,7 @@ TEST (bulk_pull, get_next_on_open) | |||
|  */ | ||||
| TEST (bulk_pull, ascending_one_hash) | ||||
| { | ||||
| 	nano::system system{ 1 }; | ||||
| 	nano::test::system system{ 1 }; | ||||
| 	auto & node = *system.nodes[0]; | ||||
| 	nano::state_block_builder builder; | ||||
| 	auto block1 = builder | ||||
|  | @ -140,7 +140,7 @@ TEST (bulk_pull, ascending_one_hash) | |||
|  */ | ||||
| TEST (bulk_pull, ascending_two_account) | ||||
| { | ||||
| 	nano::system system{ 1 }; | ||||
| 	nano::test::system system{ 1 }; | ||||
| 	auto & node = *system.nodes[0]; | ||||
| 	nano::state_block_builder builder; | ||||
| 	auto block1 = builder | ||||
|  | @ -175,7 +175,7 @@ TEST (bulk_pull, ascending_two_account) | |||
|  */ | ||||
| TEST (bulk_pull, ascending_end) | ||||
| { | ||||
| 	nano::system system{ 1 }; | ||||
| 	nano::test::system system{ 1 }; | ||||
| 	auto & node = *system.nodes[0]; | ||||
| 	nano::state_block_builder builder; | ||||
| 	auto block1 = builder | ||||
|  | @ -204,7 +204,7 @@ TEST (bulk_pull, ascending_end) | |||
| 
 | ||||
| TEST (bulk_pull, by_block) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto connection (std::make_shared<nano::bootstrap_server> (std::make_shared<nano::socket> (*system.nodes[0], nano::socket::endpoint_type_t::server), system.nodes[0])); | ||||
| 	auto req = std::make_unique<nano::bulk_pull> (nano::dev::network_params.network); | ||||
| 	req->start = nano::dev::genesis->hash (); | ||||
|  | @ -220,7 +220,7 @@ TEST (bulk_pull, by_block) | |||
| 
 | ||||
| TEST (bulk_pull, by_block_single) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto connection (std::make_shared<nano::bootstrap_server> (std::make_shared<nano::socket> (*system.nodes[0], nano::socket::endpoint_type_t::server), system.nodes[0])); | ||||
| 	auto req = std::make_unique<nano::bulk_pull> (nano::dev::network_params.network); | ||||
| 	req->start = nano::dev::genesis->hash (); | ||||
|  | @ -236,7 +236,7 @@ TEST (bulk_pull, by_block_single) | |||
| 
 | ||||
| TEST (bulk_pull, count_limit) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto node0 (system.nodes[0]); | ||||
| 
 | ||||
| 	nano::block_builder builder; | ||||
|  | @ -281,8 +281,8 @@ TEST (bulk_pull, count_limit) | |||
| 
 | ||||
| TEST (bootstrap_processor, DISABLED_process_none) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	nano::test::system system (1); | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::test::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	ASSERT_FALSE (node1->init_error ()); | ||||
| 	auto done (false); | ||||
| 	node1->bootstrap_initiator.bootstrap (system.nodes[0]->network.endpoint (), false); | ||||
|  | @ -296,8 +296,8 @@ TEST (bootstrap_processor, DISABLED_process_none) | |||
| // Bootstrap can pull one basic block
 | ||||
| TEST (bootstrap_processor, process_one) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	node_config.enable_voting = false; | ||||
| 	nano::node_flags node_flags; | ||||
|  | @ -307,7 +307,7 @@ TEST (bootstrap_processor, process_one) | |||
| 	auto send (system.wallet (0)->send_action (nano::dev::genesis_key.pub, nano::dev::genesis_key.pub, 100)); | ||||
| 	ASSERT_NE (nullptr, send); | ||||
| 
 | ||||
| 	node_config.peering_port = nano::get_available_port (); | ||||
| 	node_config.peering_port = nano::test::get_available_port (); | ||||
| 	node_flags.disable_rep_crawler = true; | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::unique_path (), node_config, system.work, node_flags)); | ||||
| 	nano::block_hash hash1 (node0->latest (nano::dev::genesis_key.pub)); | ||||
|  | @ -322,8 +322,8 @@ TEST (bootstrap_processor, process_one) | |||
| 
 | ||||
| TEST (bootstrap_processor, process_two) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_bootstrap_bulk_push_client = true; | ||||
|  | @ -338,7 +338,7 @@ TEST (bootstrap_processor, process_two) | |||
| 	ASSERT_NE (hash1, hash3); | ||||
| 	ASSERT_NE (hash2, hash3); | ||||
| 
 | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::test::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	ASSERT_FALSE (node1->init_error ()); | ||||
| 	node1->bootstrap_initiator.bootstrap (node0->network.endpoint (), false); | ||||
| 	ASSERT_NE (node1->latest (nano::dev::genesis_key.pub), node0->latest (nano::dev::genesis_key.pub)); | ||||
|  | @ -349,8 +349,8 @@ TEST (bootstrap_processor, process_two) | |||
| // Bootstrap can pull universal blocks
 | ||||
| TEST (bootstrap_processor, process_state) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_bootstrap_bulk_push_client = true; | ||||
|  | @ -383,7 +383,7 @@ TEST (bootstrap_processor, process_state) | |||
| 	ASSERT_EQ (nano::process_result::progress, node0->process (*block1).code); | ||||
| 	ASSERT_EQ (nano::process_result::progress, node0->process (*block2).code); | ||||
| 
 | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::get_available_port (), nano::unique_path (), system.logging, system.work, node_flags)); | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::test::get_available_port (), nano::unique_path (), system.logging, system.work, node_flags)); | ||||
| 	ASSERT_EQ (node0->latest (nano::dev::genesis_key.pub), block2->hash ()); | ||||
| 	ASSERT_NE (node1->latest (nano::dev::genesis_key.pub), block2->hash ()); | ||||
| 	node1->bootstrap_initiator.bootstrap (node0->network.endpoint (), false); | ||||
|  | @ -395,13 +395,13 @@ TEST (bootstrap_processor, process_state) | |||
| 
 | ||||
| TEST (bootstrap_processor, process_new) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_bootstrap_bulk_push_client = true; | ||||
| 	auto node1 (system.add_node (config, node_flags)); | ||||
| 	config.peering_port = nano::get_available_port (); | ||||
| 	config.peering_port = nano::test::get_available_port (); | ||||
| 	auto node2 (system.add_node (config, node_flags)); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
| 	nano::keypair key2; | ||||
|  | @ -415,7 +415,7 @@ TEST (bootstrap_processor, process_new) | |||
| 	nano::uint128_t balance2 (node1->balance (key2.pub)); | ||||
| 	ASSERT_TIMELY (10s, node1->block_confirmed (send->hash ()) && node1->block_confirmed (receive->hash ()) && node1->active.empty () && node2->active.empty ()); // All blocks should be propagated & confirmed
 | ||||
| 
 | ||||
| 	auto node3 (std::make_shared<nano::node> (system.io_ctx, nano::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	auto node3 (std::make_shared<nano::node> (system.io_ctx, nano::test::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	ASSERT_FALSE (node3->init_error ()); | ||||
| 	node3->bootstrap_initiator.bootstrap (node1->network.endpoint (), false); | ||||
| 	ASSERT_TIMELY (10s, node3->balance (key2.pub) == balance2); | ||||
|  | @ -425,8 +425,8 @@ TEST (bootstrap_processor, process_new) | |||
| 
 | ||||
| TEST (bootstrap_processor, pull_diamond) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_bootstrap_bulk_push_client = true; | ||||
|  | @ -468,7 +468,7 @@ TEST (bootstrap_processor, pull_diamond) | |||
| 				   .work (*system.work.generate (send1->hash ())) | ||||
| 				   .build_shared (); | ||||
| 	ASSERT_EQ (nano::process_result::progress, node0->process (*receive).code); | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::test::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	ASSERT_FALSE (node1->init_error ()); | ||||
| 	node1->bootstrap_initiator.bootstrap (node0->network.endpoint (), false); | ||||
| 	ASSERT_TIMELY (10s, node1->balance (nano::dev::genesis_key.pub) == 100); | ||||
|  | @ -479,13 +479,13 @@ TEST (bootstrap_processor, pull_diamond) | |||
| TEST (bootstrap_processor, DISABLED_pull_requeue_network_error) | ||||
| { | ||||
| 	// Bootstrap attempt stopped before requeue & then cannot be found in attempts list
 | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_bootstrap_bulk_push_client = true; | ||||
| 	auto node1 (system.add_node (config, node_flags)); | ||||
| 	config.peering_port = nano::get_available_port (); | ||||
| 	config.peering_port = nano::test::get_available_port (); | ||||
| 	auto node2 (system.add_node (config, node_flags)); | ||||
| 	nano::keypair key1; | ||||
| 
 | ||||
|  | @ -524,12 +524,12 @@ TEST (bootstrap_processor, DISABLED_pull_requeue_network_error) | |||
| // CI run in which it failed: https://github.com/nanocurrency/nano-node/runs/4280675502?check_suite_focus=true#step:6:398
 | ||||
| TEST (bootstrap_processor, DISABLED_push_diamond) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto node0 (system.add_node (config)); | ||||
| 	nano::keypair key; | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::test::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	ASSERT_FALSE (node1->init_error ()); | ||||
| 	auto wallet1 (node1->wallets.create (100)); | ||||
| 	wallet1->insert_adhoc (nano::dev::genesis_key.prv); | ||||
|  | @ -582,12 +582,12 @@ TEST (bootstrap_processor, DISABLED_push_diamond) | |||
| // Issue for investigating it: https://github.com/nanocurrency/nano-node/issues/3517
 | ||||
| TEST (bootstrap_processor, DISABLED_push_diamond_pruning) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto node0 (system.add_node (config)); | ||||
| 	nano::keypair key; | ||||
| 	config.peering_port = nano::get_available_port (); | ||||
| 	config.peering_port = nano::test::get_available_port (); | ||||
| 	config.enable_voting = false; // Remove after allowing pruned voting
 | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.enable_pruning = true; | ||||
|  | @ -657,12 +657,12 @@ TEST (bootstrap_processor, DISABLED_push_diamond_pruning) | |||
| 
 | ||||
| TEST (bootstrap_processor, push_one) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto node0 (system.add_node (config)); | ||||
| 	nano::keypair key1; | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::test::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	auto wallet (node1->wallets.create (nano::random_wallet_id ())); | ||||
| 	ASSERT_NE (nullptr, wallet); | ||||
| 	wallet->insert_adhoc (nano::dev::genesis_key.prv); | ||||
|  | @ -677,8 +677,8 @@ TEST (bootstrap_processor, push_one) | |||
| 
 | ||||
| TEST (bootstrap_processor, lazy_hash) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_bootstrap_bulk_push_client = true; | ||||
|  | @ -736,7 +736,7 @@ TEST (bootstrap_processor, lazy_hash) | |||
| 	node0->block_processor.add (receive2); | ||||
| 	node0->block_processor.flush (); | ||||
| 	// Start lazy bootstrap with last block in chain known
 | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::test::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	node1->network.udp_channels.insert (node0->network.endpoint (), node1->network_params.network.protocol_version); | ||||
| 	node1->bootstrap_initiator.bootstrap_lazy (receive2->hash (), true); | ||||
| 	{ | ||||
|  | @ -751,8 +751,8 @@ TEST (bootstrap_processor, lazy_hash) | |||
| 
 | ||||
| TEST (bootstrap_processor, lazy_hash_bootstrap_id) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_bootstrap_bulk_push_client = true; | ||||
|  | @ -810,7 +810,7 @@ TEST (bootstrap_processor, lazy_hash_bootstrap_id) | |||
| 	node0->block_processor.add (receive2); | ||||
| 	node0->block_processor.flush (); | ||||
| 	// Start lazy bootstrap with last block in chain known
 | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::test::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	node1->network.udp_channels.insert (node0->network.endpoint (), node1->network_params.network.protocol_version); | ||||
| 	node1->bootstrap_initiator.bootstrap_lazy (receive2->hash (), true, true, "123456"); | ||||
| 	{ | ||||
|  | @ -825,8 +825,8 @@ TEST (bootstrap_processor, lazy_hash_bootstrap_id) | |||
| 
 | ||||
| TEST (bootstrap_processor, lazy_hash_pruning) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	config.enable_voting = false; // Remove after allowing pruned voting
 | ||||
| 	nano::node_flags node_flags; | ||||
|  | @ -931,14 +931,14 @@ TEST (bootstrap_processor, lazy_hash_pruning) | |||
| 	node0->block_processor.flush (); | ||||
| 	ASSERT_EQ (9, node0->ledger.cache.block_count); | ||||
| 	// Processing chain to prune for node1
 | ||||
| 	config.peering_port = nano::get_available_port (); | ||||
| 	config.peering_port = nano::test::get_available_port (); | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::unique_path (), config, system.work, node_flags, 1)); | ||||
| 	node1->process_active (send1); | ||||
| 	node1->process_active (receive1); | ||||
| 	node1->process_active (change1); | ||||
| 	node1->process_active (change2); | ||||
| 	// Confirm last block to prune previous
 | ||||
| 	nano::blocks_confirm (*node1, { send1, receive1, change1, change2 }, true); | ||||
| 	nano::test::blocks_confirm (*node1, { send1, receive1, change1, change2 }, true); | ||||
| 	ASSERT_TIMELY (10s, node1->block_confirmed (send1->hash ()) && node1->block_confirmed (receive1->hash ()) && node1->block_confirmed (change1->hash ()) && node1->block_confirmed (change2->hash ()) && node1->active.empty ()); | ||||
| 	ASSERT_EQ (5, node1->ledger.cache.block_count); | ||||
| 	ASSERT_EQ (5, node1->ledger.cache.cemented_count); | ||||
|  | @ -960,8 +960,8 @@ TEST (bootstrap_processor, lazy_hash_pruning) | |||
| 
 | ||||
| TEST (bootstrap_processor, lazy_max_pull_count) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_bootstrap_bulk_push_client = true; | ||||
|  | @ -1051,7 +1051,7 @@ TEST (bootstrap_processor, lazy_max_pull_count) | |||
| 	node0->block_processor.add (change3); | ||||
| 	node0->block_processor.flush (); | ||||
| 	// Start lazy bootstrap with last block in chain known
 | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::test::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	node1->network.udp_channels.insert (node0->network.endpoint (), node1->network_params.network.protocol_version); | ||||
| 	node1->bootstrap_initiator.bootstrap_lazy (change3->hash ()); | ||||
| 	// Check processed blocks
 | ||||
|  | @ -1065,8 +1065,8 @@ TEST (bootstrap_processor, lazy_max_pull_count) | |||
| // Issue for investigating it: https://github.com/nanocurrency/nano-node/issues/3640
 | ||||
| TEST (bootstrap_processor, DISABLED_lazy_unclear_state_link) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_bootstrap_bulk_push_client = true; | ||||
|  | @ -1120,7 +1120,7 @@ TEST (bootstrap_processor, DISABLED_lazy_unclear_state_link) | |||
| 				   .build_shared (); | ||||
| 	ASSERT_EQ (nano::process_result::progress, node1->process (*receive).code); | ||||
| 	// Start lazy bootstrap with last block in chain known
 | ||||
| 	auto node2 = system.add_node (nano::node_config (nano::get_available_port (), system.logging), node_flags); | ||||
| 	auto node2 = system.add_node (nano::node_config (nano::test::get_available_port (), system.logging), node_flags); | ||||
| 	node2->network.udp_channels.insert (node1->network.endpoint (), node1->network_params.network.protocol_version); | ||||
| 	node2->bootstrap_initiator.bootstrap_lazy (receive->hash ()); | ||||
| 	// Check processed blocks
 | ||||
|  | @ -1134,8 +1134,8 @@ TEST (bootstrap_processor, DISABLED_lazy_unclear_state_link) | |||
| 
 | ||||
| TEST (bootstrap_processor, lazy_unclear_state_link_not_existing) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_bootstrap_bulk_push_client = true; | ||||
|  | @ -1179,7 +1179,7 @@ TEST (bootstrap_processor, lazy_unclear_state_link_not_existing) | |||
| 	ASSERT_EQ (nano::process_result::progress, node1->process (*send2).code); | ||||
| 
 | ||||
| 	// Start lazy bootstrap with last block in chain known
 | ||||
| 	auto node2 = system.add_node (nano::node_config (nano::get_available_port (), system.logging), node_flags); | ||||
| 	auto node2 = system.add_node (nano::node_config (nano::test::get_available_port (), system.logging), node_flags); | ||||
| 	node2->network.udp_channels.insert (node1->network.endpoint (), node1->network_params.network.protocol_version); | ||||
| 	node2->bootstrap_initiator.bootstrap_lazy (send2->hash ()); | ||||
| 	// Check processed blocks
 | ||||
|  | @ -1192,8 +1192,8 @@ TEST (bootstrap_processor, lazy_unclear_state_link_not_existing) | |||
| 
 | ||||
| TEST (bootstrap_processor, DISABLED_lazy_destinations) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_bootstrap_bulk_push_client = true; | ||||
|  | @ -1248,7 +1248,7 @@ TEST (bootstrap_processor, DISABLED_lazy_destinations) | |||
| 	ASSERT_EQ (nano::process_result::progress, node1->process (*state_open).code); | ||||
| 
 | ||||
| 	// Start lazy bootstrap with last block in sender chain
 | ||||
| 	auto node2 = system.add_node (nano::node_config (nano::get_available_port (), system.logging), node_flags); | ||||
| 	auto node2 = system.add_node (nano::node_config (nano::test::get_available_port (), system.logging), node_flags); | ||||
| 	node2->network.udp_channels.insert (node1->network.endpoint (), node1->network_params.network.protocol_version); | ||||
| 	node2->bootstrap_initiator.bootstrap_lazy (send2->hash ()); | ||||
| 	// Check processed blocks
 | ||||
|  | @ -1261,8 +1261,8 @@ TEST (bootstrap_processor, DISABLED_lazy_destinations) | |||
| 
 | ||||
| TEST (bootstrap_processor, lazy_pruning_missing_block) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	config.enable_voting = false; // Remove after allowing pruned voting
 | ||||
| 	nano::node_flags node_flags; | ||||
|  | @ -1319,7 +1319,7 @@ TEST (bootstrap_processor, lazy_pruning_missing_block) | |||
| 
 | ||||
| 	node1->process_active (state_open); | ||||
| 	// Confirm last block to prune previous
 | ||||
| 	nano::blocks_confirm (*node1, { send1, send2, open, state_open }, true); | ||||
| 	nano::test::blocks_confirm (*node1, { send1, send2, open, state_open }, true); | ||||
| 	ASSERT_TIMELY (10s, node1->block_confirmed (send1->hash ()) && node1->block_confirmed (send2->hash ()) && node1->block_confirmed (open->hash ()) && node1->block_confirmed (state_open->hash ()) && node1->active.empty ()); | ||||
| 	ASSERT_EQ (5, node1->ledger.cache.block_count); | ||||
| 	ASSERT_EQ (5, node1->ledger.cache.cemented_count); | ||||
|  | @ -1332,7 +1332,7 @@ TEST (bootstrap_processor, lazy_pruning_missing_block) | |||
| 	ASSERT_TRUE (node1->ledger.block_or_pruned_exists (open->hash ())); | ||||
| 	ASSERT_TRUE (node1->ledger.block_or_pruned_exists (state_open->hash ())); | ||||
| 	// Start lazy bootstrap with last block in sender chain
 | ||||
| 	config.peering_port = nano::get_available_port (); | ||||
| 	config.peering_port = nano::test::get_available_port (); | ||||
| 	auto node2 (std::make_shared<nano::node> (system.io_ctx, nano::unique_path (), config, system.work, node_flags, 1)); | ||||
| 	node2->network.udp_channels.insert (node1->network.endpoint (), node1->network_params.network.protocol_version); | ||||
| 	node2->bootstrap_initiator.bootstrap_lazy (send2->hash ()); | ||||
|  | @ -1366,8 +1366,8 @@ TEST (bootstrap_processor, lazy_pruning_missing_block) | |||
| 
 | ||||
| TEST (bootstrap_processor, lazy_cancel) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_bootstrap_bulk_push_client = true; | ||||
|  | @ -1388,7 +1388,7 @@ TEST (bootstrap_processor, lazy_cancel) | |||
| 				 .build_shared (); | ||||
| 
 | ||||
| 	// Start lazy bootstrap with last block in chain known
 | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::test::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	node1->network.udp_channels.insert (node0->network.endpoint (), node1->network_params.network.protocol_version); | ||||
| 	node1->bootstrap_initiator.bootstrap_lazy (send1->hash (), true); // Start "confirmed" block bootstrap
 | ||||
| 	{ | ||||
|  | @ -1403,8 +1403,8 @@ TEST (bootstrap_processor, lazy_cancel) | |||
| 
 | ||||
| TEST (bootstrap_processor, wallet_lazy_frontier) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_bootstrap_bulk_push_client = true; | ||||
|  | @ -1463,7 +1463,7 @@ TEST (bootstrap_processor, wallet_lazy_frontier) | |||
| 	node0->block_processor.add (receive2); | ||||
| 	node0->block_processor.flush (); | ||||
| 	// Start wallet lazy bootstrap
 | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::test::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	node1->network.udp_channels.insert (node0->network.endpoint (), node1->network_params.network.protocol_version); | ||||
| 	auto wallet (node1->wallets.create (nano::random_wallet_id ())); | ||||
| 	ASSERT_NE (nullptr, wallet); | ||||
|  | @ -1481,8 +1481,8 @@ TEST (bootstrap_processor, wallet_lazy_frontier) | |||
| 
 | ||||
| TEST (bootstrap_processor, wallet_lazy_pending) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_bootstrap_bulk_push_client = true; | ||||
|  | @ -1542,8 +1542,8 @@ TEST (bootstrap_processor, wallet_lazy_pending) | |||
| 
 | ||||
| TEST (bootstrap_processor, multiple_attempts) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_bootstrap_bulk_push_client = true; | ||||
|  | @ -1601,7 +1601,7 @@ TEST (bootstrap_processor, multiple_attempts) | |||
| 	node1->block_processor.add (receive2); | ||||
| 	node1->block_processor.flush (); | ||||
| 	// Start 2 concurrent bootstrap attempts
 | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.bootstrap_initiator_threads = 3; | ||||
| 	auto node2 (std::make_shared<nano::node> (system.io_ctx, nano::unique_path (), node_config, system.work)); | ||||
| 	node2->network.udp_channels.insert (node1->network.endpoint (), node2->network_params.network.protocol_version); | ||||
|  | @ -1626,7 +1626,7 @@ TEST (frontier_req_response, DISABLED_destruction) | |||
| 	{ | ||||
| 		std::shared_ptr<nano::frontier_req_server> hold; // Destructing tcp acceptor on non-existent io_context
 | ||||
| 		{ | ||||
| 			nano::system system (1); | ||||
| 			nano::test::system system (1); | ||||
| 			auto connection (std::make_shared<nano::bootstrap_server> (nullptr, system.nodes[0])); | ||||
| 			auto req = std::make_unique<nano::frontier_req> (nano::dev::network_params.network); | ||||
| 			req->start.clear (); | ||||
|  | @ -1640,7 +1640,7 @@ TEST (frontier_req_response, DISABLED_destruction) | |||
| 
 | ||||
| TEST (frontier_req, begin) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto connection (std::make_shared<nano::bootstrap_server> (std::make_shared<nano::socket> (*system.nodes[0], nano::socket::endpoint_type_t::server), system.nodes[0])); | ||||
| 	auto req = std::make_unique<nano::frontier_req> (nano::dev::network_params.network); | ||||
| 	req->start.clear (); | ||||
|  | @ -1653,7 +1653,7 @@ TEST (frontier_req, begin) | |||
| 
 | ||||
| TEST (frontier_req, end) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto connection (std::make_shared<nano::bootstrap_server> (std::make_shared<nano::socket> (*system.nodes[0], nano::socket::endpoint_type_t::server), system.nodes[0])); | ||||
| 	auto req = std::make_unique<nano::frontier_req> (nano::dev::network_params.network); | ||||
| 	req->start = nano::dev::genesis_key.pub.number () + 1; | ||||
|  | @ -1665,7 +1665,7 @@ TEST (frontier_req, end) | |||
| 
 | ||||
| TEST (frontier_req, count) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto node1 = system.nodes[0]; | ||||
| 	// Public key FB93... after genesis in accounts table
 | ||||
| 	nano::keypair key1 ("ED5AE0A6505B14B67435C29FD9FEEBC26F597D147BC92F6D795FFAD7AFD3D967"); | ||||
|  | @ -1707,7 +1707,7 @@ TEST (frontier_req, count) | |||
| 
 | ||||
| TEST (frontier_req, time_bound) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto connection (std::make_shared<nano::bootstrap_server> (std::make_shared<nano::socket> (*system.nodes[0], nano::socket::endpoint_type_t::server), system.nodes[0])); | ||||
| 	auto req = std::make_unique<nano::frontier_req> (nano::dev::network_params.network); | ||||
| 	req->start.clear (); | ||||
|  | @ -1728,7 +1728,7 @@ TEST (frontier_req, time_bound) | |||
| 
 | ||||
| TEST (frontier_req, time_cutoff) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto connection (std::make_shared<nano::bootstrap_server> (std::make_shared<nano::socket> (*system.nodes[0], nano::socket::endpoint_type_t::server), system.nodes[0])); | ||||
| 	auto req = std::make_unique<nano::frontier_req> (nano::dev::network_params.network); | ||||
| 	req->start.clear (); | ||||
|  | @ -1750,7 +1750,7 @@ TEST (frontier_req, time_cutoff) | |||
| 
 | ||||
| TEST (frontier_req, confirmed_frontier) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto node1 = system.nodes[0]; | ||||
| 	nano::keypair key_before_genesis; | ||||
| 	// Public key before genesis in accounts table
 | ||||
|  | @ -1876,7 +1876,7 @@ TEST (frontier_req, confirmed_frontier) | |||
| 	ASSERT_EQ (receive2->hash (), request5->frontier); | ||||
| 
 | ||||
| 	// Confirm account before genesis (confirmed only)
 | ||||
| 	nano::blocks_confirm (*node1, { send1, receive1 }, true); | ||||
| 	nano::test::blocks_confirm (*node1, { send1, receive1 }, true); | ||||
| 	ASSERT_TIMELY (5s, node1->block_confirmed (send1->hash ()) && node1->block_confirmed (receive1->hash ())); | ||||
| 	auto connection6 (std::make_shared<nano::bootstrap_server> (std::make_shared<nano::socket> (*node1, nano::socket::endpoint_type_t::server), node1)); | ||||
| 	auto req6 = std::make_unique<nano::frontier_req> (nano::dev::network_params.network); | ||||
|  | @ -1891,7 +1891,7 @@ TEST (frontier_req, confirmed_frontier) | |||
| 	ASSERT_EQ (receive1->hash (), request6->frontier); | ||||
| 
 | ||||
| 	// Confirm account after genesis (confirmed only)
 | ||||
| 	nano::blocks_confirm (*node1, { send2, receive2 }, true); | ||||
| 	nano::test::blocks_confirm (*node1, { send2, receive2 }, true); | ||||
| 	ASSERT_TIMELY (5s, node1->block_confirmed (send2->hash ()) && node1->block_confirmed (receive2->hash ())); | ||||
| 	auto connection7 (std::make_shared<nano::bootstrap_server> (std::make_shared<nano::socket> (*node1, nano::socket::endpoint_type_t::server), node1)); | ||||
| 	auto req7 = std::make_unique<nano::frontier_req> (nano::dev::network_params.network); | ||||
|  | @ -1908,15 +1908,15 @@ TEST (frontier_req, confirmed_frontier) | |||
| 
 | ||||
| TEST (bulk, genesis) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_bootstrap_bulk_push_client = true; | ||||
| 	node_flags.disable_lazy_bootstrap = true; | ||||
| 	auto node1 = system.add_node (config, node_flags); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
| 	auto node2 (std::make_shared<nano::node> (system.io_ctx, nano::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	auto node2 (std::make_shared<nano::node> (system.io_ctx, nano::test::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	ASSERT_FALSE (node2->init_error ()); | ||||
| 	nano::block_hash latest1 (node1->latest (nano::dev::genesis_key.pub)); | ||||
| 	nano::block_hash latest2 (node2->latest (nano::dev::genesis_key.pub)); | ||||
|  | @ -1935,15 +1935,15 @@ TEST (bulk, genesis) | |||
| 
 | ||||
| TEST (bulk, offline_send) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_bootstrap_bulk_push_client = true; | ||||
| 	node_flags.disable_lazy_bootstrap = true; | ||||
| 	auto node1 = system.add_node (config, node_flags); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
| 	auto node2 (std::make_shared<nano::node> (system.io_ctx, nano::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	auto node2 (std::make_shared<nano::node> (system.io_ctx, nano::test::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	ASSERT_FALSE (node2->init_error ()); | ||||
| 	node2->start (); | ||||
| 	system.nodes.push_back (node2); | ||||
|  | @ -1978,8 +1978,8 @@ TEST (bulk, offline_send) | |||
| // Issue for investigating it: https://github.com/nanocurrency/nano-node/issues/3613
 | ||||
| TEST (bulk, DISABLED_genesis_pruning) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	config.enable_voting = false; // Remove after allowing pruned voting
 | ||||
| 	nano::node_flags node_flags; | ||||
|  | @ -1990,7 +1990,7 @@ TEST (bulk, DISABLED_genesis_pruning) | |||
| 	auto node1 = system.add_node (config, node_flags); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
| 	node_flags.enable_pruning = false; | ||||
| 	auto node2 (std::make_shared<nano::node> (system.io_ctx, nano::get_available_port (), nano::unique_path (), system.logging, system.work, node_flags)); | ||||
| 	auto node2 (std::make_shared<nano::node> (system.io_ctx, nano::test::get_available_port (), nano::unique_path (), system.logging, system.work, node_flags)); | ||||
| 	ASSERT_FALSE (node2->init_error ()); | ||||
| 	nano::block_hash latest1 (node1->latest (nano::dev::genesis_key.pub)); | ||||
| 	nano::block_hash latest2 (node2->latest (nano::dev::genesis_key.pub)); | ||||
|  | @ -2061,7 +2061,7 @@ TEST (bulk, DISABLED_genesis_pruning) | |||
| 
 | ||||
| TEST (bulk_pull_account, basics) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	system.nodes[0]->config.receive_minimum = 20; | ||||
| 	nano::keypair key1; | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
|  |  | |||
|  | @ -74,7 +74,7 @@ namespace | |||
| std::string call_cli_command (boost::program_options::variables_map const & vm) | ||||
| { | ||||
| 	std::stringstream ss; | ||||
| 	nano::cout_redirect redirect (ss.rdbuf ()); | ||||
| 	nano::test::cout_redirect redirect (ss.rdbuf ()); | ||||
| 
 | ||||
| 	// Execute CLI command. This populates the stringstream with a string like: "Private: 123\n Public: 456\n Account: nano_123"
 | ||||
| 	auto ec = nano::handle_node_options (vm); | ||||
|  |  | |||
|  | @ -33,7 +33,7 @@ TEST (confirmation_height, single) | |||
| { | ||||
| 	auto test_mode = [] (nano::confirmation_height_mode mode_a) { | ||||
| 		auto amount (std::numeric_limits<nano::uint128_t>::max ()); | ||||
| 		nano::system system; | ||||
| 		nano::test::system system; | ||||
| 		nano::node_flags node_flags; | ||||
| 		node_flags.confirmation_height_processor_mode = mode_a; | ||||
| 		auto node = system.add_node (node_flags); | ||||
|  | @ -91,10 +91,10 @@ TEST (confirmation_height, single) | |||
| TEST (confirmation_height, multiple_accounts) | ||||
| { | ||||
| 	auto test_mode = [] (nano::confirmation_height_mode mode_a) { | ||||
| 		nano::system system; | ||||
| 		nano::test::system system; | ||||
| 		nano::node_flags node_flags; | ||||
| 		node_flags.confirmation_height_processor_mode = mode_a; | ||||
| 		nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 		nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 		node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 		auto node = system.add_node (node_config, node_flags); | ||||
| 		nano::keypair key1; | ||||
|  | @ -311,7 +311,7 @@ TEST (confirmation_height, multiple_accounts) | |||
| TEST (confirmation_height, gap_bootstrap) | ||||
| { | ||||
| 	auto test_mode = [] (nano::confirmation_height_mode mode_a) { | ||||
| 		nano::system system{}; | ||||
| 		nano::test::system system{}; | ||||
| 		nano::node_flags node_flags{}; | ||||
| 		node_flags.confirmation_height_processor_mode = mode_a; | ||||
| 		auto & node1 = *system.add_node (node_flags); | ||||
|  | @ -436,13 +436,13 @@ TEST (confirmation_height, gap_bootstrap) | |||
| TEST (confirmation_height, gap_live) | ||||
| { | ||||
| 	auto test_mode = [] (nano::confirmation_height_mode mode_a) { | ||||
| 		nano::system system{}; | ||||
| 		nano::test::system system{}; | ||||
| 		nano::node_flags node_flags{}; | ||||
| 		node_flags.confirmation_height_processor_mode = mode_a; | ||||
| 		nano::node_config node_config{ nano::get_available_port (), system.logging }; | ||||
| 		nano::node_config node_config{ nano::test::get_available_port (), system.logging }; | ||||
| 		node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 		auto node = system.add_node (node_config, node_flags); | ||||
| 		node_config.peering_port = nano::get_available_port (); | ||||
| 		node_config.peering_port = nano::test::get_available_port (); | ||||
| 		node_config.receive_minimum = nano::dev::constants.genesis_amount; // Prevent auto-receive & open1/receive1/receive2 blocks conflicts
 | ||||
| 		system.add_node (node_config, node_flags); | ||||
| 		nano::keypair destination; | ||||
|  | @ -570,10 +570,10 @@ TEST (confirmation_height, gap_live) | |||
| TEST (confirmation_height, send_receive_between_2_accounts) | ||||
| { | ||||
| 	auto test_mode = [] (nano::confirmation_height_mode mode_a) { | ||||
| 		nano::system system; | ||||
| 		nano::test::system system; | ||||
| 		nano::node_flags node_flags; | ||||
| 		node_flags.confirmation_height_processor_mode = mode_a; | ||||
| 		nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 		nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 		node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 		auto node = system.add_node (node_config, node_flags); | ||||
| 		nano::keypair key1; | ||||
|  | @ -726,10 +726,10 @@ TEST (confirmation_height, send_receive_between_2_accounts) | |||
| TEST (confirmation_height, send_receive_self) | ||||
| { | ||||
| 	auto test_mode = [] (nano::confirmation_height_mode mode_a) { | ||||
| 		nano::system system; | ||||
| 		nano::test::system system; | ||||
| 		nano::node_flags node_flags; | ||||
| 		node_flags.confirmation_height_processor_mode = mode_a; | ||||
| 		nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 		nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 		node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 		auto node = system.add_node (node_config, node_flags); | ||||
| 		nano::block_hash latest (node->latest (nano::dev::genesis_key.pub)); | ||||
|  | @ -835,10 +835,10 @@ TEST (confirmation_height, send_receive_self) | |||
| TEST (confirmation_height, all_block_types) | ||||
| { | ||||
| 	auto test_mode = [] (nano::confirmation_height_mode mode_a) { | ||||
| 		nano::system system; | ||||
| 		nano::test::system system; | ||||
| 		nano::node_flags node_flags; | ||||
| 		node_flags.confirmation_height_processor_mode = mode_a; | ||||
| 		nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 		nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 		node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 		auto node = system.add_node (node_config, node_flags); | ||||
| 		nano::block_hash latest (node->latest (nano::dev::genesis_key.pub)); | ||||
|  | @ -1102,7 +1102,7 @@ TEST (confirmation_height, conflict_rollback_cemented) | |||
| 		nano::state_block_builder builder{}; | ||||
| 		auto const genesis_hash = nano::dev::genesis->hash (); | ||||
| 
 | ||||
| 		nano::system system{}; | ||||
| 		nano::test::system system{}; | ||||
| 		nano::node_flags node_flags{}; | ||||
| 		node_flags.confirmation_height_processor_mode = mode_a; | ||||
| 
 | ||||
|  | @ -1246,7 +1246,7 @@ TEST (confirmation_height, observers) | |||
| { | ||||
| 	auto test_mode = [] (nano::confirmation_height_mode mode_a) { | ||||
| 		auto amount (std::numeric_limits<nano::uint128_t>::max ()); | ||||
| 		nano::system system; | ||||
| 		nano::test::system system; | ||||
| 		nano::node_flags node_flags; | ||||
| 		node_flags.confirmation_height_processor_mode = mode_a; | ||||
| 		auto node1 = system.add_node (node_flags); | ||||
|  | @ -1452,10 +1452,10 @@ namespace nano | |||
| TEST (confirmation_height, pending_observer_callbacks) | ||||
| { | ||||
| 	auto test_mode = [] (nano::confirmation_height_mode mode_a) { | ||||
| 		nano::system system; | ||||
| 		nano::test::system system; | ||||
| 		nano::node_flags node_flags; | ||||
| 		node_flags.confirmation_height_processor_mode = mode_a; | ||||
| 		nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 		nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 		node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 		auto node = system.add_node (node_config, node_flags); | ||||
| 
 | ||||
|  | @ -1509,11 +1509,11 @@ TEST (confirmation_height, pending_observer_callbacks) | |||
| TEST (confirmation_height, callback_confirmed_history) | ||||
| { | ||||
| 	auto test_mode = [] (nano::confirmation_height_mode mode_a) { | ||||
| 		nano::system system; | ||||
| 		nano::test::system system; | ||||
| 		nano::node_flags node_flags; | ||||
| 		node_flags.force_use_write_database_queue = true; | ||||
| 		node_flags.confirmation_height_processor_mode = mode_a; | ||||
| 		nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 		nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 		node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 		auto node = system.add_node (node_config, node_flags); | ||||
| 
 | ||||
|  | @ -1605,11 +1605,11 @@ namespace nano | |||
| TEST (confirmation_height, dependent_election) | ||||
| { | ||||
| 	auto test_mode = [] (nano::confirmation_height_mode mode_a) { | ||||
| 		nano::system system; | ||||
| 		nano::test::system system; | ||||
| 		nano::node_flags node_flags; | ||||
| 		node_flags.confirmation_height_processor_mode = mode_a; | ||||
| 		node_flags.force_use_write_database_queue = true; | ||||
| 		nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 		nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 		node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 		auto node = system.add_node (node_config, node_flags); | ||||
| 
 | ||||
|  | @ -1678,10 +1678,10 @@ TEST (confirmation_height, dependent_election) | |||
| TEST (confirmation_height, cemented_gap_below_receive) | ||||
| { | ||||
| 	auto test_mode = [] (nano::confirmation_height_mode mode_a) { | ||||
| 		nano::system system; | ||||
| 		nano::test::system system; | ||||
| 		nano::node_flags node_flags; | ||||
| 		node_flags.confirmation_height_processor_mode = mode_a; | ||||
| 		nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 		nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 		node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 		auto node = system.add_node (node_config, node_flags); | ||||
| 
 | ||||
|  | @ -1839,10 +1839,10 @@ TEST (confirmation_height, cemented_gap_below_receive) | |||
| TEST (confirmation_height, cemented_gap_below_no_cache) | ||||
| { | ||||
| 	auto test_mode = [] (nano::confirmation_height_mode mode_a) { | ||||
| 		nano::system system; | ||||
| 		nano::test::system system; | ||||
| 		nano::node_flags node_flags; | ||||
| 		node_flags.confirmation_height_processor_mode = mode_a; | ||||
| 		nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 		nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 		node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 		auto node = system.add_node (node_config, node_flags); | ||||
| 
 | ||||
|  | @ -1998,12 +1998,12 @@ TEST (confirmation_height, cemented_gap_below_no_cache) | |||
| TEST (confirmation_height, election_winner_details_clearing) | ||||
| { | ||||
| 	auto test_mode = [] (nano::confirmation_height_mode mode_a) { | ||||
| 		nano::system system{}; | ||||
| 		nano::test::system system{}; | ||||
| 
 | ||||
| 		nano::node_flags node_flags{}; | ||||
| 		node_flags.confirmation_height_processor_mode = mode_a; | ||||
| 
 | ||||
| 		nano::node_config node_config{ nano::get_available_port (), system.logging }; | ||||
| 		nano::node_config node_config{ nano::test::get_available_port (), system.logging }; | ||||
| 		node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 
 | ||||
| 		auto node = system.add_node (node_config, node_flags); | ||||
|  | @ -2065,7 +2065,7 @@ TEST (confirmation_height, election_winner_details_clearing) | |||
| TEST (confirmation_height, election_winner_details_clearing_node_process_confirmed) | ||||
| { | ||||
| 	// Make sure election_winner_details is also cleared if the block never enters the confirmation height processor from node::process_confirmed
 | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto node = system.nodes.front (); | ||||
| 
 | ||||
| 	nano::block_builder builder; | ||||
|  |  | |||
|  | @ -9,7 +9,7 @@ using namespace std::chrono_literals; | |||
| 
 | ||||
| TEST (confirmation_solicitor, batches) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_request_loop = true; | ||||
| 	node_flags.disable_rep_crawler = true; | ||||
|  | @ -61,7 +61,7 @@ namespace nano | |||
| { | ||||
| TEST (confirmation_solicitor, different_hash) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_request_loop = true; | ||||
| 	node_flags.disable_rep_crawler = true; | ||||
|  | @ -103,7 +103,7 @@ TEST (confirmation_solicitor, different_hash) | |||
| 
 | ||||
| TEST (confirmation_solicitor, bypass_max_requests_cap) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_request_loop = true; | ||||
| 	node_flags.disable_rep_crawler = true; | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ using namespace std::chrono_literals; | |||
| 
 | ||||
| TEST (conflicts, start_stop) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node1 (*system.nodes[0]); | ||||
| 	nano::keypair key1; | ||||
| 	nano::block_builder builder; | ||||
|  | @ -35,7 +35,7 @@ TEST (conflicts, start_stop) | |||
| 
 | ||||
| TEST (conflicts, add_existing) | ||||
| { | ||||
| 	nano::system system{ 1 }; | ||||
| 	nano::test::system system{ 1 }; | ||||
| 	auto & node1 = *system.nodes[0]; | ||||
| 	nano::keypair key1; | ||||
| 	nano::block_builder builder; | ||||
|  | @ -67,7 +67,7 @@ TEST (conflicts, add_existing) | |||
| 
 | ||||
| TEST (conflicts, add_two) | ||||
| { | ||||
| 	nano::system system{}; | ||||
| 	nano::test::system system{}; | ||||
| 	auto const & node = system.add_node (); | ||||
| 
 | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
|  |  | |||
|  | @ -8,7 +8,10 @@ | |||
| 
 | ||||
| namespace nano | ||||
| { | ||||
| void cleanup_dev_directories_on_exit (); | ||||
| namespace test | ||||
| { | ||||
| 	void cleanup_dev_directories_on_exit (); | ||||
| } | ||||
| void force_nano_dev_network (); | ||||
| } | ||||
| 
 | ||||
|  | @ -22,6 +25,6 @@ GTEST_API_ int main (int argc, char ** argv) | |||
| 	logging.init (nano::unique_path ()); | ||||
| 	testing::InitGoogleTest (&argc, argv); | ||||
| 	auto res = RUN_ALL_TESTS (); | ||||
| 	nano::cleanup_dev_directories_on_exit (); | ||||
| 	nano::test::cleanup_dev_directories_on_exit (); | ||||
| 	return res; | ||||
| } | ||||
|  |  | |||
|  | @ -8,14 +8,14 @@ using namespace std::chrono_literals; | |||
| 
 | ||||
| TEST (distributed_work, stopped) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	system.nodes[0]->distributed_work.stop (); | ||||
| 	ASSERT_TRUE (system.nodes[0]->distributed_work.make (nano::work_version::work_1, nano::block_hash (), {}, nano::dev::network_params.work.base, {})); | ||||
| } | ||||
| 
 | ||||
| TEST (distributed_work, no_peers) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto node (system.nodes[0]); | ||||
| 	nano::block_hash hash{ 1 }; | ||||
| 	boost::optional<uint64_t> work; | ||||
|  | @ -39,8 +39,8 @@ TEST (distributed_work, no_peers) | |||
| 
 | ||||
| TEST (distributed_work, no_peers_disabled) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.work_threads = 0; | ||||
| 	auto & node = *system.add_node (node_config); | ||||
| 	ASSERT_TRUE (node.distributed_work.make (nano::work_version::work_1, nano::block_hash (), node.config.work_peers, nano::dev::network_params.work.base, {})); | ||||
|  | @ -48,8 +48,8 @@ TEST (distributed_work, no_peers_disabled) | |||
| 
 | ||||
| TEST (distributed_work, no_peers_cancel) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.max_work_generate_multiplier = 1e6; | ||||
| 	auto & node = *system.add_node (node_config); | ||||
| 	nano::block_hash hash{ 1 }; | ||||
|  | @ -78,7 +78,7 @@ TEST (distributed_work, no_peers_cancel) | |||
| 
 | ||||
| TEST (distributed_work, no_peers_multi) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto node (system.nodes[0]); | ||||
| 	nano::block_hash hash{ 1 }; | ||||
| 	unsigned total{ 10 }; | ||||
|  | @ -117,9 +117,9 @@ TEST (distributed_work, no_peers_multi) | |||
| 
 | ||||
| TEST (distributed_work, peer) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config; | ||||
| 	node_config.peering_port = nano::get_available_port (); | ||||
| 	node_config.peering_port = nano::test::get_available_port (); | ||||
| 	// Disable local work generation
 | ||||
| 	node_config.work_threads = 0; | ||||
| 	auto node (system.add_node (node_config)); | ||||
|  | @ -132,7 +132,7 @@ TEST (distributed_work, peer) | |||
| 		work = work_a; | ||||
| 		done = true; | ||||
| 	}; | ||||
| 	auto work_peer (std::make_shared<fake_work_peer> (node->work, node->io_ctx, nano::get_available_port (), work_peer_type::good)); | ||||
| 	auto work_peer (std::make_shared<fake_work_peer> (node->work, node->io_ctx, nano::test::get_available_port (), work_peer_type::good)); | ||||
| 	work_peer->start (); | ||||
| 	decltype (node->config.work_peers) peers; | ||||
| 	peers.emplace_back ("::ffff:127.0.0.1", work_peer->port ()); | ||||
|  | @ -147,7 +147,7 @@ TEST (distributed_work, peer) | |||
| 
 | ||||
| TEST (distributed_work, peer_malicious) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto node (system.nodes[0]); | ||||
| 	ASSERT_TRUE (node->local_work_generation_enabled ()); | ||||
| 	nano::block_hash hash{ 1 }; | ||||
|  | @ -158,7 +158,7 @@ TEST (distributed_work, peer_malicious) | |||
| 		work = work_a; | ||||
| 		done = true; | ||||
| 	}; | ||||
| 	auto malicious_peer (std::make_shared<fake_work_peer> (node->work, node->io_ctx, nano::get_available_port (), work_peer_type::malicious)); | ||||
| 	auto malicious_peer (std::make_shared<fake_work_peer> (node->work, node->io_ctx, nano::test::get_available_port (), work_peer_type::malicious)); | ||||
| 	malicious_peer->start (); | ||||
| 	decltype (node->config.work_peers) peers; | ||||
| 	peers.emplace_back ("::ffff:127.0.0.1", malicious_peer->port ()); | ||||
|  | @ -176,7 +176,7 @@ TEST (distributed_work, peer_malicious) | |||
| 	// Test again with no local work generation enabled to make sure the malicious peer is sent more than one request
 | ||||
| 	node->config.work_threads = 0; | ||||
| 	ASSERT_FALSE (node->local_work_generation_enabled ()); | ||||
| 	auto malicious_peer2 (std::make_shared<fake_work_peer> (node->work, node->io_ctx, nano::get_available_port (), work_peer_type::malicious)); | ||||
| 	auto malicious_peer2 (std::make_shared<fake_work_peer> (node->work, node->io_ctx, nano::test::get_available_port (), work_peer_type::malicious)); | ||||
| 	malicious_peer2->start (); | ||||
| 	peers[0].second = malicious_peer2->port (); | ||||
| 	ASSERT_FALSE (node->distributed_work.make (nano::work_version::work_1, hash, peers, node->network_params.work.base, {}, nano::account ())); | ||||
|  | @ -190,7 +190,7 @@ TEST (distributed_work, peer_malicious) | |||
| // Issue for investigating it: https://github.com/nanocurrency/nano-node/issues/3630
 | ||||
| TEST (distributed_work, DISABLED_peer_multi) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto node (system.nodes[0]); | ||||
| 	ASSERT_TRUE (node->local_work_generation_enabled ()); | ||||
| 	nano::block_hash hash{ 1 }; | ||||
|  | @ -201,9 +201,9 @@ TEST (distributed_work, DISABLED_peer_multi) | |||
| 		work = work_a; | ||||
| 		done = true; | ||||
| 	}; | ||||
| 	auto good_peer (std::make_shared<fake_work_peer> (node->work, node->io_ctx, nano::get_available_port (), work_peer_type::good)); | ||||
| 	auto malicious_peer (std::make_shared<fake_work_peer> (node->work, node->io_ctx, nano::get_available_port (), work_peer_type::malicious)); | ||||
| 	auto slow_peer (std::make_shared<fake_work_peer> (node->work, node->io_ctx, nano::get_available_port (), work_peer_type::slow)); | ||||
| 	auto good_peer (std::make_shared<fake_work_peer> (node->work, node->io_ctx, nano::test::get_available_port (), work_peer_type::good)); | ||||
| 	auto malicious_peer (std::make_shared<fake_work_peer> (node->work, node->io_ctx, nano::test::get_available_port (), work_peer_type::malicious)); | ||||
| 	auto slow_peer (std::make_shared<fake_work_peer> (node->work, node->io_ctx, nano::test::get_available_port (), work_peer_type::slow)); | ||||
| 	good_peer->start (); | ||||
| 	malicious_peer->start (); | ||||
| 	slow_peer->start (); | ||||
|  | @ -230,7 +230,7 @@ TEST (distributed_work, DISABLED_peer_multi) | |||
| 
 | ||||
| TEST (distributed_work, fail_resolve) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto node (system.nodes[0]); | ||||
| 	nano::block_hash hash{ 1 }; | ||||
| 	boost::optional<uint64_t> work; | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ using namespace std::chrono_literals; | |||
| 
 | ||||
| TEST (election, construction) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node = *system.nodes[0]; | ||||
| 	node.block_confirm (nano::dev::genesis); | ||||
| 	node.scheduler.flush (); | ||||
|  | @ -18,9 +18,9 @@ TEST (election, construction) | |||
| 
 | ||||
| TEST (election, quorum_minimum_flip_success) | ||||
| { | ||||
| 	nano::system system{}; | ||||
| 	nano::test::system system{}; | ||||
| 
 | ||||
| 	nano::node_config node_config{ nano::get_available_port (), system.logging }; | ||||
| 	nano::node_config node_config{ nano::test::get_available_port (), system.logging }; | ||||
| 	node_config.online_weight_minimum = nano::dev::constants.genesis_amount; | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 
 | ||||
|  | @ -69,9 +69,9 @@ TEST (election, quorum_minimum_flip_success) | |||
| 
 | ||||
| TEST (election, quorum_minimum_flip_fail) | ||||
| { | ||||
| 	nano::system system{}; | ||||
| 	nano::test::system system{}; | ||||
| 
 | ||||
| 	nano::node_config node_config{ nano::get_available_port (), system.logging }; | ||||
| 	nano::node_config node_config{ nano::test::get_available_port (), system.logging }; | ||||
| 	node_config.online_weight_minimum = nano::dev::constants.genesis_amount; | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 
 | ||||
|  | @ -122,8 +122,8 @@ TEST (election, quorum_minimum_flip_fail) | |||
| 
 | ||||
| TEST (election, quorum_minimum_confirm_success) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.online_weight_minimum = nano::dev::constants.genesis_amount; | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto & node1 = *system.add_node (node_config); | ||||
|  | @ -155,8 +155,8 @@ TEST (election, quorum_minimum_confirm_success) | |||
| 
 | ||||
| TEST (election, quorum_minimum_confirm_fail) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.online_weight_minimum = nano::dev::constants.genesis_amount; | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto & node1 = *system.add_node (node_config); | ||||
|  | @ -190,9 +190,9 @@ namespace nano | |||
| { | ||||
| TEST (election, quorum_minimum_update_weight_before_quorum_checks) | ||||
| { | ||||
| 	nano::system system{}; | ||||
| 	nano::test::system system{}; | ||||
| 
 | ||||
| 	nano::node_config node_config{ nano::get_available_port (), system.logging }; | ||||
| 	nano::node_config node_config{ nano::test::get_available_port (), system.logging }; | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 
 | ||||
| 	auto & node1 = *system.add_node (node_config); | ||||
|  | @ -226,7 +226,7 @@ TEST (election, quorum_minimum_update_weight_before_quorum_checks) | |||
| 	ASSERT_EQ (nano::process_result::progress, node1.process (*send2).code); | ||||
| 	ASSERT_TIMELY (5s, node1.ledger.cache.block_count == 4); | ||||
| 
 | ||||
| 	node_config.peering_port = nano::get_available_port (); | ||||
| 	node_config.peering_port = nano::test::get_available_port (); | ||||
| 	auto & node2 = *system.add_node (node_config); | ||||
| 
 | ||||
| 	system.wallet (1)->insert_adhoc (key1.prv); | ||||
|  |  | |||
|  | @ -10,12 +10,12 @@ using namespace std::chrono_literals; | |||
| 
 | ||||
| TEST (election_scheduler, construction) | ||||
| { | ||||
| 	nano::system system{ 1 }; | ||||
| 	nano::test::system system{ 1 }; | ||||
| } | ||||
| 
 | ||||
| TEST (election_scheduler, activate_one_timely) | ||||
| { | ||||
| 	nano::system system{ 1 }; | ||||
| 	nano::test::system system{ 1 }; | ||||
| 	nano::state_block_builder builder; | ||||
| 	auto send1 = builder.make_block () | ||||
| 				 .account (nano::dev::genesis_key.pub) | ||||
|  | @ -33,7 +33,7 @@ TEST (election_scheduler, activate_one_timely) | |||
| 
 | ||||
| TEST (election_scheduler, activate_one_flush) | ||||
| { | ||||
| 	nano::system system{ 1 }; | ||||
| 	nano::test::system system{ 1 }; | ||||
| 	nano::state_block_builder builder; | ||||
| 	auto send1 = builder.make_block () | ||||
| 				 .account (nano::dev::genesis_key.pub) | ||||
|  | @ -67,9 +67,9 @@ TEST (election_scheduler, activate_one_flush) | |||
|  */ | ||||
| TEST (election_scheduler, no_vacancy) | ||||
| { | ||||
| 	nano::system system{}; | ||||
| 	nano::test::system system{}; | ||||
| 
 | ||||
| 	nano::node_config config{ nano::get_available_port (), system.logging }; | ||||
| 	nano::node_config config{ nano::test::get_available_port (), system.logging }; | ||||
| 	config.active_elections_size = 1; | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 
 | ||||
|  | @ -144,8 +144,8 @@ TEST (election_scheduler, no_vacancy) | |||
| // Ensure that election_scheduler::flush terminates even if no elections can currently be queued e.g. shutdown or no active_transactions vacancy
 | ||||
| TEST (election_scheduler, flush_vacancy) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config{ nano::get_available_port (), system.logging }; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config{ nano::test::get_available_port (), system.logging }; | ||||
| 	// No elections can be activated
 | ||||
| 	config.active_elections_size = 0; | ||||
| 	auto & node = *system.add_node (config); | ||||
|  |  | |||
|  | @ -13,8 +13,8 @@ TEST (frontiers_confirmation, mode) | |||
| 	nano::node_flags node_flags; | ||||
| 	// Always mode
 | ||||
| 	{ | ||||
| 		nano::system system; | ||||
| 		nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 		nano::test::system system; | ||||
| 		nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 		node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::always; | ||||
| 		auto node = system.add_node (node_config, node_flags); | ||||
| 		auto send = builder | ||||
|  | @ -35,8 +35,8 @@ TEST (frontiers_confirmation, mode) | |||
| 	} | ||||
| 	// Auto mode
 | ||||
| 	{ | ||||
| 		nano::system system; | ||||
| 		nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 		nano::test::system system; | ||||
| 		nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 		node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::automatic; | ||||
| 		auto node = system.add_node (node_config, node_flags); | ||||
| 		auto send = builder | ||||
|  | @ -57,8 +57,8 @@ TEST (frontiers_confirmation, mode) | |||
| 	} | ||||
| 	// Disabled mode
 | ||||
| 	{ | ||||
| 		nano::system system; | ||||
| 		nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 		nano::test::system system; | ||||
| 		nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 		node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 		auto node = system.add_node (node_config, node_flags); | ||||
| 		auto send = builder | ||||
|  |  | |||
|  | @ -7,7 +7,7 @@ using namespace std::chrono_literals; | |||
| 
 | ||||
| TEST (gap_cache, add_new) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	nano::gap_cache cache (*system.nodes[0]); | ||||
| 	nano::block_builder builder; | ||||
| 	auto block1 = builder | ||||
|  | @ -23,7 +23,7 @@ TEST (gap_cache, add_new) | |||
| 
 | ||||
| TEST (gap_cache, add_existing) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	nano::gap_cache cache (*system.nodes[0]); | ||||
| 	nano::block_builder builder; | ||||
| 	auto block1 = builder | ||||
|  | @ -51,7 +51,7 @@ TEST (gap_cache, add_existing) | |||
| 
 | ||||
| TEST (gap_cache, comparison) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	nano::gap_cache cache (*system.nodes[0]); | ||||
| 	nano::block_builder builder; | ||||
| 	auto block1 = builder | ||||
|  | @ -92,7 +92,7 @@ TEST (gap_cache, gap_bootstrap) | |||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_legacy_bootstrap = true; | ||||
| 	node_flags.disable_request_loop = true; // to avoid fallback behavior of broadcasting blocks
 | ||||
| 	nano::system system (2, nano::transport::transport_type::tcp, node_flags); | ||||
| 	nano::test::system system (2, nano::transport::transport_type::tcp, node_flags); | ||||
| 
 | ||||
| 	auto & node1 (*system.nodes[0]); | ||||
| 	auto & node2 (*system.nodes[1]); | ||||
|  | @ -127,7 +127,7 @@ TEST (gap_cache, gap_bootstrap) | |||
| 
 | ||||
| TEST (gap_cache, two_dependencies) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node1 (*system.nodes[0]); | ||||
| 	nano::keypair key; | ||||
| 	nano::block_builder builder; | ||||
|  |  | |||
|  | @ -19,7 +19,7 @@ using namespace std::chrono_literals; | |||
| 
 | ||||
| TEST (ipc, asynchronous) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	system.nodes[0]->config.ipc_config.transport_tcp.enabled = true; | ||||
| 	system.nodes[0]->config.ipc_config.transport_tcp.port = 24077; | ||||
| 	nano::node_rpc_config node_rpc_config; | ||||
|  | @ -59,7 +59,7 @@ TEST (ipc, asynchronous) | |||
| 
 | ||||
| TEST (ipc, synchronous) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	system.nodes[0]->config.ipc_config.transport_tcp.enabled = true; | ||||
| 	system.nodes[0]->config.ipc_config.transport_tcp.port = 24077; | ||||
| 	nano::node_rpc_config node_rpc_config; | ||||
|  | @ -192,7 +192,7 @@ TEST (ipc, permissions_default_user_order) | |||
| 
 | ||||
| TEST (ipc, invalid_endpoint) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	system.nodes[0]->config.ipc_config.transport_tcp.enabled = true; | ||||
| 	system.nodes[0]->config.ipc_config.transport_tcp.port = 24077; | ||||
| 	nano::node_rpc_config node_rpc_config; | ||||
|  |  | |||
|  | @ -895,8 +895,8 @@ TEST (ledger, double_receive) | |||
| 
 | ||||
| TEST (votes, check_signature) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.online_weight_minimum = std::numeric_limits<nano::uint128_t>::max (); | ||||
| 	auto & node1 = *system.add_node (node_config); | ||||
| 	nano::keypair key1; | ||||
|  | @ -928,7 +928,7 @@ TEST (votes, check_signature) | |||
| 
 | ||||
| TEST (votes, add_one) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node1 (*system.nodes[0]); | ||||
| 	nano::keypair key1; | ||||
| 	nano::block_builder builder; | ||||
|  | @ -967,8 +967,8 @@ namespace nano | |||
| // Higher timestamps change the vote
 | ||||
| TEST (votes, add_existing) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.online_weight_minimum = nano::dev::constants.genesis_amount; | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto & node1 = *system.add_node (node_config); | ||||
|  | @ -1029,7 +1029,7 @@ TEST (votes, add_existing) | |||
| // Lower timestamps are ignored
 | ||||
| TEST (votes, add_old) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node1 (*system.nodes[0]); | ||||
| 	nano::keypair key1; | ||||
| 	nano::block_builder builder; | ||||
|  | @ -1080,7 +1080,7 @@ TEST (votes, add_old) | |||
| // Issue for investigating it: https://github.com/nanocurrency/nano-node/issues/3631
 | ||||
| TEST (votes, DISABLED_add_old_different_account) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node1 (*system.nodes[0]); | ||||
| 	nano::keypair key1; | ||||
| 	nano::block_builder builder; | ||||
|  | @ -1104,7 +1104,7 @@ TEST (votes, DISABLED_add_old_different_account) | |||
| 	node1.work_generate_blocking (*send2); | ||||
| 	ASSERT_EQ (nano::process_result::progress, node1.process (*send1).code); | ||||
| 	ASSERT_EQ (nano::process_result::progress, node1.process (*send2).code); | ||||
| 	nano::blocks_confirm (node1, { send1, send2 }); | ||||
| 	nano::test::blocks_confirm (node1, { send1, send2 }); | ||||
| 	auto election1 = node1.active.election (send1->qualified_root ()); | ||||
| 	ASSERT_NE (nullptr, election1); | ||||
| 	auto election2 = node1.active.election (send2->qualified_root ()); | ||||
|  | @ -1135,7 +1135,7 @@ TEST (votes, DISABLED_add_old_different_account) | |||
| // The voting cooldown is respected
 | ||||
| TEST (votes, add_cooldown) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node1 (*system.nodes[0]); | ||||
| 	nano::keypair key1; | ||||
| 	nano::block_builder builder; | ||||
|  | @ -1178,7 +1178,7 @@ TEST (votes, add_cooldown) | |||
| // Query for block successor
 | ||||
| TEST (ledger, successor) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node1 (*system.nodes[0]); | ||||
| 	nano::keypair key1; | ||||
| 	nano::block_builder builder; | ||||
|  | @ -3909,7 +3909,7 @@ TEST (ledger, epoch_blocks_fork) | |||
| 
 | ||||
| TEST (ledger, successor_epoch) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node1 (*system.nodes[0]); | ||||
| 	nano::keypair key1; | ||||
| 	nano::work_pool pool{ nano::dev::network_params.network, std::numeric_limits<unsigned>::max () }; | ||||
|  | @ -3976,7 +3976,7 @@ TEST (ledger, successor_epoch) | |||
| TEST (ledger, epoch_open_pending) | ||||
| { | ||||
| 	nano::block_builder builder{}; | ||||
| 	nano::system system{ 1 }; | ||||
| 	nano::test::system system{ 1 }; | ||||
| 	auto & node1 = *system.nodes[0]; | ||||
| 	nano::work_pool pool{ nano::dev::network_params.network, std::numeric_limits<unsigned>::max () }; | ||||
| 	nano::keypair key1{}; | ||||
|  | @ -4018,7 +4018,7 @@ TEST (ledger, epoch_open_pending) | |||
| TEST (ledger, block_hash_account_conflict) | ||||
| { | ||||
| 	nano::block_builder builder; | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node1 (*system.nodes[0]); | ||||
| 	nano::keypair key1; | ||||
| 	nano::keypair key2; | ||||
|  | @ -4086,7 +4086,7 @@ TEST (ledger, block_hash_account_conflict) | |||
| 	ASSERT_EQ (nano::process_result::progress, node1.process (*receive1).code); | ||||
| 	ASSERT_EQ (nano::process_result::progress, node1.process (*send2).code); | ||||
| 	ASSERT_EQ (nano::process_result::progress, node1.process (*open_epoch1).code); | ||||
| 	nano::blocks_confirm (node1, { send1, receive1, send2, open_epoch1 }); | ||||
| 	nano::test::blocks_confirm (node1, { send1, receive1, send2, open_epoch1 }); | ||||
| 	auto election1 = node1.active.election (send1->qualified_root ()); | ||||
| 	ASSERT_NE (nullptr, election1); | ||||
| 	auto election2 = node1.active.election (receive1->qualified_root ()); | ||||
|  | @ -4249,7 +4249,7 @@ TEST (ledger, could_fit) | |||
| 
 | ||||
| TEST (ledger, unchecked_epoch) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node1 (*system.nodes[0]); | ||||
| 	nano::keypair destination; | ||||
| 	nano::block_builder builder; | ||||
|  | @ -4308,8 +4308,8 @@ TEST (ledger, unchecked_epoch) | |||
| 
 | ||||
| TEST (ledger, unchecked_epoch_invalid) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto & node1 (*system.add_node (node_config)); | ||||
| 	nano::keypair destination; | ||||
|  | @ -4395,7 +4395,7 @@ TEST (ledger, unchecked_epoch_invalid) | |||
| 
 | ||||
| TEST (ledger, unchecked_open) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node1 (*system.nodes[0]); | ||||
| 	nano::keypair destination; | ||||
| 	nano::block_builder builder; | ||||
|  | @ -4447,7 +4447,7 @@ TEST (ledger, unchecked_open) | |||
| 
 | ||||
| TEST (ledger, unchecked_receive) | ||||
| { | ||||
| 	nano::system system{ 1 }; | ||||
| 	nano::test::system system{ 1 }; | ||||
| 	auto & node1 = *system.nodes[0]; | ||||
| 	nano::keypair destination{}; | ||||
| 	nano::block_builder builder; | ||||
|  | @ -4561,7 +4561,7 @@ TEST (ledger, confirmation_height_not_updated) | |||
| 
 | ||||
| TEST (ledger, zero_rep) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node1 (*system.nodes[0]); | ||||
| 	nano::block_builder builder; | ||||
| 	auto block1 = builder.state () | ||||
|  |  | |||
|  | @ -13,7 +13,7 @@ using namespace std::chrono_literals; | |||
| 
 | ||||
| TEST (ledger_walker, genesis_block) | ||||
| { | ||||
| 	nano::system system{}; | ||||
| 	nano::test::system system{}; | ||||
| 	auto const node = system.add_node (); | ||||
| 
 | ||||
| 	nano::ledger_walker ledger_walker{ node->ledger }; | ||||
|  | @ -41,8 +41,8 @@ namespace nano | |||
| { | ||||
| TEST (ledger_walker, genesis_account_longer) | ||||
| { | ||||
| 	nano::system system{}; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system{}; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.enable_voting = true; | ||||
| 	node_config.receive_minimum = 1; | ||||
| 
 | ||||
|  | @ -90,8 +90,8 @@ TEST (ledger_walker, genesis_account_longer) | |||
| 
 | ||||
| TEST (ledger_walker, cross_account) | ||||
| { | ||||
| 	nano::system system{}; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system{}; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.enable_voting = true; | ||||
| 	node_config.receive_minimum = 1; | ||||
| 
 | ||||
|  | @ -140,9 +140,9 @@ TEST (ledger_walker, cross_account) | |||
| // Issue for investigating it: https://github.com/nanocurrency/nano-node/issues/3603
 | ||||
| TEST (ledger_walker, DISABLED_ladder_geometry) | ||||
| { | ||||
| 	nano::system system{}; | ||||
| 	nano::test::system system{}; | ||||
| 
 | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.enable_voting = true; | ||||
| 	node_config.receive_minimum = 1; | ||||
| 
 | ||||
|  |  | |||
|  | @ -29,7 +29,7 @@ unsigned num_matches (std::string const & str) | |||
| TEST (locks, no_conflicts) | ||||
| { | ||||
| 	std::stringstream ss; | ||||
| 	nano::cout_redirect (ss.rdbuf ()); | ||||
| 	nano::test::cout_redirect (ss.rdbuf ()); | ||||
| 
 | ||||
| 	nano::mutex guard_mutex; | ||||
| 	nano::lock_guard<nano::mutex> guard (guard_mutex); | ||||
|  | @ -47,7 +47,7 @@ TEST (locks, lock_guard) | |||
| 	ASSERT_LE (NANO_TIMED_LOCKS, 10000); | ||||
| 
 | ||||
| 	std::stringstream ss; | ||||
| 	nano::cout_redirect redirect (ss.rdbuf ()); | ||||
| 	nano::test::cout_redirect redirect (ss.rdbuf ()); | ||||
| 
 | ||||
| 	nano::mutex mutex{ xstr (NANO_TIMED_LOCKS_FILTER) }; | ||||
| 
 | ||||
|  | @ -81,7 +81,7 @@ TEST (locks, unique_lock) | |||
| 	ASSERT_LE (NANO_TIMED_LOCKS, 10000); | ||||
| 
 | ||||
| 	std::stringstream ss; | ||||
| 	nano::cout_redirect redirect (ss.rdbuf ()); | ||||
| 	nano::test::cout_redirect redirect (ss.rdbuf ()); | ||||
| 
 | ||||
| 	nano::mutex mutex{ xstr (NANO_TIMED_LOCKS_FILTER) }; | ||||
| 
 | ||||
|  | @ -119,7 +119,7 @@ TEST (locks, condition_variable_wait) | |||
| 	ASSERT_LE (NANO_TIMED_LOCKS, 10000); | ||||
| 
 | ||||
| 	std::stringstream ss; | ||||
| 	nano::cout_redirect redirect (ss.rdbuf ()); | ||||
| 	nano::test::cout_redirect redirect (ss.rdbuf ()); | ||||
| 
 | ||||
| 	nano::condition_variable cv; | ||||
| 	nano::mutex mutex; | ||||
|  | @ -152,7 +152,7 @@ TEST (locks, condition_variable_wait_until) | |||
| 	ASSERT_LE (NANO_TIMED_LOCKS, 10000); | ||||
| 
 | ||||
| 	std::stringstream ss; | ||||
| 	nano::cout_redirect redirect (ss.rdbuf ()); | ||||
| 	nano::test::cout_redirect redirect (ss.rdbuf ()); | ||||
| 
 | ||||
| 	nano::condition_variable cv; | ||||
| 	nano::mutex mutex; | ||||
|  |  | |||
|  | @ -29,7 +29,7 @@ TEST (logger, try_log) | |||
| { | ||||
| 	auto path1 (nano::unique_path ()); | ||||
| 	std::stringstream ss; | ||||
| 	nano::boost_log_cerr_redirect redirect_cerr (ss.rdbuf ()); | ||||
| 	nano::test::boost_log_cerr_redirect redirect_cerr (ss.rdbuf ()); | ||||
| 	nano::logger_mt my_logger (100ms); | ||||
| 	auto output1 = "logger.try_log1"; | ||||
| 	auto error (my_logger.try_log (output1)); | ||||
|  | @ -54,7 +54,7 @@ TEST (logger, always_log) | |||
| { | ||||
| 	auto path1 (nano::unique_path ()); | ||||
| 	std::stringstream ss; | ||||
| 	nano::boost_log_cerr_redirect redirect_cerr (ss.rdbuf ()); | ||||
| 	nano::test::boost_log_cerr_redirect redirect_cerr (ss.rdbuf ()); | ||||
| 	nano::logger_mt my_logger (20s); // Make time interval effectively unreachable
 | ||||
| 	auto output1 = "logger.always_log1"; | ||||
| 	auto error (my_logger.try_log (output1)); | ||||
|  |  | |||
|  | @ -62,7 +62,7 @@ public: | |||
| 
 | ||||
| TEST (message_parser, exact_confirm_ack_size) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	dev_visitor visitor; | ||||
| 	nano::network_filter filter (1); | ||||
| 	nano::block_uniquer block_uniquer; | ||||
|  | @ -104,7 +104,7 @@ TEST (message_parser, exact_confirm_ack_size) | |||
| 
 | ||||
| TEST (message_parser, exact_confirm_req_size) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	dev_visitor visitor; | ||||
| 	nano::network_filter filter (1); | ||||
| 	nano::block_uniquer block_uniquer; | ||||
|  | @ -145,7 +145,7 @@ TEST (message_parser, exact_confirm_req_size) | |||
| 
 | ||||
| TEST (message_parser, exact_confirm_req_hash_size) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	dev_visitor visitor; | ||||
| 	nano::network_filter filter (1); | ||||
| 	nano::block_uniquer block_uniquer; | ||||
|  | @ -186,7 +186,7 @@ TEST (message_parser, exact_confirm_req_hash_size) | |||
| 
 | ||||
| TEST (message_parser, exact_publish_size) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	dev_visitor visitor; | ||||
| 	nano::network_filter filter (1); | ||||
| 	nano::block_uniquer block_uniquer; | ||||
|  | @ -227,7 +227,7 @@ TEST (message_parser, exact_publish_size) | |||
| 
 | ||||
| TEST (message_parser, exact_keepalive_size) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	dev_visitor visitor; | ||||
| 	nano::network_filter filter (1); | ||||
| 	nano::block_uniquer block_uniquer; | ||||
|  |  | |||
|  | @ -17,7 +17,7 @@ TEST (network, tcp_connection) | |||
| { | ||||
| 	boost::asio::io_context io_ctx; | ||||
| 	boost::asio::ip::tcp::acceptor acceptor (io_ctx); | ||||
| 	auto port = nano::get_available_port (); | ||||
| 	auto port = nano::test::get_available_port (); | ||||
| 	boost::asio::ip::tcp::endpoint endpoint (boost::asio::ip::address_v4::any (), port); | ||||
| 	acceptor.open (endpoint.protocol ()); | ||||
| 	acceptor.set_option (boost::asio::ip::tcp::acceptor::reuse_address (true)); | ||||
|  | @ -56,8 +56,8 @@ TEST (network, tcp_connection) | |||
| 
 | ||||
| TEST (network, construction_with_specified_port) | ||||
| { | ||||
| 	nano::system system{}; | ||||
| 	auto const port = nano::get_available_port (); | ||||
| 	nano::test::system system{}; | ||||
| 	auto const port = nano::test::get_available_port (); | ||||
| 	auto const node = system.add_node (nano::node_config{ port, system.logging }); | ||||
| 	EXPECT_EQ (port, node->network.port); | ||||
| 	EXPECT_EQ (port, node->network.endpoint ().port ()); | ||||
|  | @ -66,7 +66,7 @@ TEST (network, construction_with_specified_port) | |||
| 
 | ||||
| TEST (network, construction_without_specified_port) | ||||
| { | ||||
| 	nano::system system{}; | ||||
| 	nano::test::system system{}; | ||||
| 	auto const node = system.add_node (); | ||||
| 	auto const port = node->network.port.load (); | ||||
| 	EXPECT_NE (0, port); | ||||
|  | @ -78,7 +78,7 @@ TEST (network, self_discard) | |||
| { | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_udp = false; | ||||
| 	nano::system system (1, nano::transport::transport_type::tcp, node_flags); | ||||
| 	nano::test::system system (1, nano::transport::transport_type::tcp, node_flags); | ||||
| 	nano::message_buffer data; | ||||
| 	data.endpoint = system.nodes[0]->network.endpoint (); | ||||
| 	ASSERT_EQ (0, system.nodes[0]->stats.count (nano::stat::type::error, nano::stat::detail::bad_sender)); | ||||
|  | @ -93,10 +93,10 @@ TEST (network, DISABLED_send_node_id_handshake) | |||
| { | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_udp = false; | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	auto node0 = system.add_node (node_flags); | ||||
| 	ASSERT_EQ (0, node0->network.size ()); | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::get_available_port (), nano::unique_path (), system.logging, system.work, node_flags)); | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::test::get_available_port (), nano::unique_path (), system.logging, system.work, node_flags)); | ||||
| 	node1->start (); | ||||
| 	system.nodes.push_back (node1); | ||||
| 	auto initial (node0->stats.count (nano::stat::type::message, nano::stat::detail::node_id_handshake, nano::stat::dir::in)); | ||||
|  | @ -118,10 +118,10 @@ TEST (network, DISABLED_send_node_id_handshake) | |||
| 
 | ||||
| TEST (network, send_node_id_handshake_tcp) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto node0 (system.nodes[0]); | ||||
| 	ASSERT_EQ (0, node0->network.size ()); | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::test::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	node1->start (); | ||||
| 	system.nodes.push_back (node1); | ||||
| 	auto initial (node0->stats.count (nano::stat::type::message, nano::stat::detail::node_id_handshake, nano::stat::dir::in)); | ||||
|  | @ -148,18 +148,18 @@ TEST (network, send_node_id_handshake_tcp) | |||
| 
 | ||||
| TEST (network, last_contacted) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 
 | ||||
| 	auto node0 = system.nodes[0]; | ||||
| 	ASSERT_EQ (0, node0->network.size ()); | ||||
| 
 | ||||
| 	nano::node_config node1_config (nano::get_available_port (), system.logging); | ||||
| 	nano::node_config node1_config (nano::test::get_available_port (), system.logging); | ||||
| 	node1_config.tcp_incoming_connections_max = 0; // Prevent ephemeral node1->node0 channel repacement with incoming connection
 | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::unique_path (), node1_config, system.work)); | ||||
| 	node1->start (); | ||||
| 	system.nodes.push_back (node1); | ||||
| 
 | ||||
| 	auto channel1 = nano::establish_tcp (system, *node1, node0->network.endpoint ()); | ||||
| 	auto channel1 = nano::test::establish_tcp (system, *node1, node0->network.endpoint ()); | ||||
| 	ASSERT_NE (nullptr, channel1); | ||||
| 	ASSERT_TIMELY (3s, node0->network.size () == 1); | ||||
| 
 | ||||
|  | @ -196,10 +196,10 @@ TEST (network, last_contacted) | |||
| 
 | ||||
| TEST (network, multi_keepalive) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto node0 = system.nodes[0]; | ||||
| 	ASSERT_EQ (0, node0->network.size ()); | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::test::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	ASSERT_FALSE (node1->init_error ()); | ||||
| 	node1->start (); | ||||
| 	system.nodes.push_back (node1); | ||||
|  | @ -207,7 +207,7 @@ TEST (network, multi_keepalive) | |||
| 	ASSERT_EQ (0, node0->network.size ()); | ||||
| 	node1->network.tcp_channels.start_tcp (node0->network.endpoint ()); | ||||
| 	ASSERT_TIMELY (10s, node0->network.size () == 1 && node0->stats.count (nano::stat::type::message, nano::stat::detail::keepalive) >= 1); | ||||
| 	auto node2 (std::make_shared<nano::node> (system.io_ctx, nano::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	auto node2 (std::make_shared<nano::node> (system.io_ctx, nano::test::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	ASSERT_FALSE (node2->init_error ()); | ||||
| 	node2->start (); | ||||
| 	system.nodes.push_back (node2); | ||||
|  | @ -217,7 +217,7 @@ TEST (network, multi_keepalive) | |||
| 
 | ||||
| TEST (network, send_discarded_publish) | ||||
| { | ||||
| 	nano::system system (2); | ||||
| 	nano::test::system system (2); | ||||
| 	auto & node1 (*system.nodes[0]); | ||||
| 	auto & node2 (*system.nodes[1]); | ||||
| 	nano::block_builder builder; | ||||
|  | @ -243,7 +243,7 @@ TEST (network, send_discarded_publish) | |||
| 
 | ||||
| TEST (network, send_invalid_publish) | ||||
| { | ||||
| 	nano::system system (2); | ||||
| 	nano::test::system system (2); | ||||
| 	auto & node1 (*system.nodes[0]); | ||||
| 	auto & node2 (*system.nodes[1]); | ||||
| 	nano::block_builder builder; | ||||
|  | @ -279,7 +279,7 @@ TEST (network, send_valid_confirm_ack) | |||
| 			node_flags.disable_bootstrap_listener = true; | ||||
| 			node_flags.disable_udp = false; | ||||
| 		} | ||||
| 		nano::system system (2, type, node_flags); | ||||
| 		nano::test::system system (2, type, node_flags); | ||||
| 		auto & node1 (*system.nodes[0]); | ||||
| 		auto & node2 (*system.nodes[1]); | ||||
| 		nano::keypair key2; | ||||
|  | @ -316,7 +316,7 @@ TEST (network, send_valid_publish) | |||
| 			node_flags.disable_bootstrap_listener = true; | ||||
| 			node_flags.disable_udp = false; | ||||
| 		} | ||||
| 		nano::system system (2, type, node_flags); | ||||
| 		nano::test::system system (2, type, node_flags); | ||||
| 		auto & node1 (*system.nodes[0]); | ||||
| 		auto & node2 (*system.nodes[1]); | ||||
| 		node1.bootstrap_initiator.stop (); | ||||
|  | @ -346,7 +346,7 @@ TEST (network, send_valid_publish) | |||
| 
 | ||||
| TEST (network, send_insufficient_work_udp) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_udp = false; | ||||
| 	auto & node1 = *system.add_node (node_flags); | ||||
|  | @ -370,7 +370,7 @@ TEST (network, send_insufficient_work_udp) | |||
| 
 | ||||
| TEST (network, send_insufficient_work) | ||||
| { | ||||
| 	nano::system system (2); | ||||
| 	nano::test::system system (2); | ||||
| 	auto & node1 = *system.nodes[0]; | ||||
| 	auto & node2 = *system.nodes[1]; | ||||
| 	// Block zero work
 | ||||
|  | @ -436,7 +436,7 @@ TEST (network, send_insufficient_work) | |||
| 
 | ||||
| TEST (receivable_processor, confirm_insufficient_pos) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node1 (*system.nodes[0]); | ||||
| 	nano::block_builder builder; | ||||
| 	auto block1 = builder | ||||
|  | @ -458,7 +458,7 @@ TEST (receivable_processor, confirm_insufficient_pos) | |||
| 
 | ||||
| TEST (receivable_processor, confirm_sufficient_pos) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node1 (*system.nodes[0]); | ||||
| 	nano::block_builder builder; | ||||
| 	auto block1 = builder | ||||
|  | @ -489,7 +489,7 @@ TEST (receivable_processor, send_with_receive) | |||
| 			node_flags.disable_bootstrap_listener = true; | ||||
| 			node_flags.disable_udp = false; | ||||
| 		} | ||||
| 		nano::system system (2, type, node_flags); | ||||
| 		nano::test::system system (2, type, node_flags); | ||||
| 		auto & node1 (*system.nodes[0]); | ||||
| 		auto & node2 (*system.nodes[1]); | ||||
| 		auto amount (std::numeric_limits<nano::uint128_t>::max ()); | ||||
|  | @ -528,7 +528,7 @@ TEST (receivable_processor, send_with_receive) | |||
| 
 | ||||
| TEST (network, receive_weight_change) | ||||
| { | ||||
| 	nano::system system (2); | ||||
| 	nano::test::system system (2); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
| 	nano::keypair key2; | ||||
| 	system.wallet (1)->insert_adhoc (key2.prv); | ||||
|  | @ -620,8 +620,8 @@ TEST (network, ipv6_from_ipv4) | |||
| TEST (network, ipv6_bind_send_ipv4) | ||||
| { | ||||
| 	boost::asio::io_context io_ctx; | ||||
| 	auto port1 = nano::get_available_port (); | ||||
| 	auto port2 = nano::get_available_port (); | ||||
| 	auto port1 = nano::test::get_available_port (); | ||||
| 	auto port2 = nano::test::get_available_port (); | ||||
| 	nano::endpoint endpoint1 (boost::asio::ip::address_v6::any (), port1); | ||||
| 	nano::endpoint endpoint2 (boost::asio::ip::address_v4::any (), port2); | ||||
| 	std::array<uint8_t, 16> bytes1{}; | ||||
|  | @ -662,7 +662,7 @@ TEST (network, ipv6_bind_send_ipv4) | |||
| 
 | ||||
| TEST (network, endpoint_bad_fd) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	system.nodes[0]->stop (); | ||||
| 	auto endpoint (system.nodes[0]->network.endpoint ()); | ||||
| 	ASSERT_TRUE (endpoint.address ().is_loopback ()); | ||||
|  | @ -672,7 +672,7 @@ TEST (network, endpoint_bad_fd) | |||
| 
 | ||||
| TEST (network, reserved_address) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	// 0 port test
 | ||||
| 	ASSERT_TRUE (nano::transport::reserved_address (nano::endpoint (boost::asio::ip::make_address_v6 ("2001::"), 0))); | ||||
| 	// Valid address test
 | ||||
|  | @ -728,7 +728,7 @@ TEST (network, network_range_ipv4) | |||
| 
 | ||||
| TEST (node, port_mapping) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto node0 (system.nodes[0]); | ||||
| 	node0->port_mapping.refresh_devices (); | ||||
| 	node0->port_mapping.start (); | ||||
|  | @ -890,7 +890,7 @@ TEST (message_buffer_manager, stats) | |||
| 
 | ||||
| TEST (tcp_listener, tcp_node_id_handshake) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto socket (std::make_shared<nano::client_socket> (*system.nodes[0])); | ||||
| 	auto bootstrap_endpoint (system.nodes[0]->bootstrap.endpoint ()); | ||||
| 	auto cookie (system.nodes[0]->network.syn_cookies.assign (nano::transport::map_tcp_to_endpoint (bootstrap_endpoint))); | ||||
|  | @ -925,7 +925,7 @@ TEST (tcp_listener, tcp_node_id_handshake) | |||
| // Issue for investigating it: https://github.com/nanocurrency/nano-node/issues/3615
 | ||||
| TEST (tcp_listener, DISABLED_tcp_listener_timeout_empty) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto node0 (system.nodes[0]); | ||||
| 	auto socket (std::make_shared<nano::client_socket> (*node0)); | ||||
| 	std::atomic<bool> connected (false); | ||||
|  | @ -948,7 +948,7 @@ TEST (tcp_listener, DISABLED_tcp_listener_timeout_empty) | |||
| 
 | ||||
| TEST (tcp_listener, tcp_listener_timeout_node_id_handshake) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto node0 (system.nodes[0]); | ||||
| 	auto socket (std::make_shared<nano::client_socket> (*node0)); | ||||
| 	auto cookie (node0->network.syn_cookies.assign (nano::transport::map_tcp_to_endpoint (node0->bootstrap.endpoint ()))); | ||||
|  | @ -979,16 +979,16 @@ TEST (tcp_listener, tcp_listener_timeout_node_id_handshake) | |||
| 
 | ||||
| TEST (network, replace_port) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_udp = false; | ||||
| 	node_flags.disable_ongoing_telemetry_requests = true; | ||||
| 	node_flags.disable_initial_telemetry_requests = true; | ||||
| 	nano::node_config node0_config (nano::get_available_port (), system.logging); | ||||
| 	nano::node_config node0_config (nano::test::get_available_port (), system.logging); | ||||
| 	node0_config.io_threads = 8; | ||||
| 	auto node0 = system.add_node (node0_config, node_flags); | ||||
| 	ASSERT_EQ (0, node0->network.size ()); | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::get_available_port (), nano::unique_path (), system.logging, system.work, node_flags)); | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::test::get_available_port (), nano::unique_path (), system.logging, system.work, node_flags)); | ||||
| 	node1->start (); | ||||
| 	system.nodes.push_back (node1); | ||||
| 	auto wrong_endpoint = nano::endpoint (node1->network.endpoint ().address (), nano::test_node_port ()); | ||||
|  | @ -1015,18 +1015,18 @@ TEST (network, peer_max_tcp_attempts) | |||
| 	// Add nodes that can accept TCP connection, but not node ID handshake
 | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_connection_cleanup = true; | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	auto node = system.add_node (node_flags); | ||||
| 	for (auto i (0); i < node->network_params.network.max_peers_per_ip; ++i) | ||||
| 	{ | ||||
| 		auto node2 (std::make_shared<nano::node> (system.io_ctx, nano::get_available_port (), nano::unique_path (), system.logging, system.work, node_flags)); | ||||
| 		auto node2 (std::make_shared<nano::node> (system.io_ctx, nano::test::get_available_port (), nano::unique_path (), system.logging, system.work, node_flags)); | ||||
| 		node2->start (); | ||||
| 		system.nodes.push_back (node2); | ||||
| 		// Start TCP attempt
 | ||||
| 		node->network.merge_peer (node2->network.endpoint ()); | ||||
| 	} | ||||
| 	ASSERT_EQ (0, node->network.size ()); | ||||
| 	ASSERT_TRUE (node->network.tcp_channels.reachout (nano::endpoint (node->network.endpoint ().address (), nano::get_available_port ()))); | ||||
| 	ASSERT_TRUE (node->network.tcp_channels.reachout (nano::endpoint (node->network.endpoint ().address (), nano::test::get_available_port ()))); | ||||
| 	ASSERT_EQ (1, node->stats.count (nano::stat::type::tcp, nano::stat::detail::tcp_max_per_ip, nano::stat::dir::out)); | ||||
| } | ||||
| #endif | ||||
|  | @ -1039,18 +1039,18 @@ namespace transport | |||
| 	{ | ||||
| 		nano::node_flags node_flags; | ||||
| 		node_flags.disable_max_peers_per_ip = true; | ||||
| 		nano::system system; | ||||
| 		nano::test::system system; | ||||
| 		system.add_node (node_flags); | ||||
| 		auto node (system.nodes[0]); | ||||
| 		for (auto i (0); i < node->network_params.network.max_peers_per_subnetwork; ++i) | ||||
| 		{ | ||||
| 			auto address (boost::asio::ip::address_v6::v4_mapped (boost::asio::ip::address_v4 (0x7f000001 + i))); // 127.0.0.1 hex
 | ||||
| 			nano::endpoint endpoint (address, nano::get_available_port ()); | ||||
| 			nano::endpoint endpoint (address, nano::test::get_available_port ()); | ||||
| 			ASSERT_FALSE (node->network.tcp_channels.reachout (endpoint)); | ||||
| 		} | ||||
| 		ASSERT_EQ (0, node->network.size ()); | ||||
| 		ASSERT_EQ (0, node->stats.count (nano::stat::type::tcp, nano::stat::detail::tcp_max_per_subnetwork, nano::stat::dir::out)); | ||||
| 		ASSERT_TRUE (node->network.tcp_channels.reachout (nano::endpoint (boost::asio::ip::make_address_v6 ("::ffff:127.0.0.1"), nano::get_available_port ()))); | ||||
| 		ASSERT_TRUE (node->network.tcp_channels.reachout (nano::endpoint (boost::asio::ip::make_address_v6 ("::ffff:127.0.0.1"), nano::test::get_available_port ()))); | ||||
| 		ASSERT_EQ (1, node->stats.count (nano::stat::type::tcp, nano::stat::detail::tcp_max_per_subnetwork, nano::stat::dir::out)); | ||||
| 	} | ||||
| } | ||||
|  | @ -1058,7 +1058,7 @@ namespace transport | |||
| 
 | ||||
| TEST (network, duplicate_detection) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_udp = false; | ||||
| 	auto & node0 (*system.add_node (node_flags)); | ||||
|  | @ -1081,7 +1081,7 @@ TEST (network, duplicate_detection) | |||
| 
 | ||||
| TEST (network, duplicate_revert_publish) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.block_processor_full_size = 0; | ||||
| 	auto & node (*system.add_node (node_flags)); | ||||
|  | @ -1098,10 +1098,10 @@ TEST (network, duplicate_revert_publish) | |||
| 	nano::uint128_t digest; | ||||
| 	ASSERT_FALSE (node.network.publish_filter.apply (bytes.data (), bytes.size (), &digest)); | ||||
| 	ASSERT_TRUE (node.network.publish_filter.apply (bytes.data (), bytes.size ())); | ||||
| 	auto other_node (std::make_shared<nano::node> (system.io_ctx, nano::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	auto other_node (std::make_shared<nano::node> (system.io_ctx, nano::test::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	other_node->start (); | ||||
| 	system.nodes.push_back (other_node); | ||||
| 	auto channel = nano::establish_tcp (system, *other_node, node.network.endpoint ()); | ||||
| 	auto channel = nano::test::establish_tcp (system, *other_node, node.network.endpoint ()); | ||||
| 	ASSERT_NE (nullptr, channel); | ||||
| 	ASSERT_EQ (0, publish.digest); | ||||
| 	node.network.inbound (publish, channel); | ||||
|  | @ -1114,11 +1114,11 @@ TEST (network, duplicate_revert_publish) | |||
| // The test must be completed in less than 1 second
 | ||||
| TEST (network, bandwidth_limiter) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::publish message{ nano::dev::network_params.network, nano::dev::genesis }; | ||||
| 	auto message_size = message.to_bytes ()->size (); | ||||
| 	auto message_limit = 4; // must be multiple of the number of channels
 | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.bandwidth_limit = message_limit * message_size; | ||||
| 	node_config.bandwidth_limit_burst_ratio = 1.0; | ||||
| 	auto & node = *system.add_node (node_config); | ||||
|  | @ -1215,10 +1215,10 @@ TEST (peer_exclusion, validate) | |||
| 
 | ||||
| TEST (network, tcp_no_connect_excluded_peers) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto node0 (system.nodes[0]); | ||||
| 	ASSERT_EQ (0, node0->network.size ()); | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::test::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	node1->start (); | ||||
| 	system.nodes.push_back (node1); | ||||
| 	auto endpoint1 (node1->network.endpoint ()); | ||||
|  | @ -1317,10 +1317,10 @@ TEST (network, cleanup_purge) | |||
| { | ||||
| 	auto test_start = std::chrono::steady_clock::now (); | ||||
| 
 | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node1 (*system.nodes[0]); | ||||
| 
 | ||||
| 	auto node2 (std::make_shared<nano::node> (system.io_ctx, nano::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	auto node2 (std::make_shared<nano::node> (system.io_ctx, nano::test::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 	node2->start (); | ||||
| 	system.nodes.push_back (node2); | ||||
| 
 | ||||
|  | @ -1349,7 +1349,7 @@ TEST (network, cleanup_purge) | |||
| 
 | ||||
| TEST (network, loopback_channel) | ||||
| { | ||||
| 	nano::system system (2); | ||||
| 	nano::test::system system (2); | ||||
| 	auto & node1 = *system.nodes[0]; | ||||
| 	auto & node2 = *system.nodes[1]; | ||||
| 	nano::transport::inproc::channel channel1 (node1, node1); | ||||
|  | @ -1369,7 +1369,7 @@ TEST (network, loopback_channel) | |||
| // Ensure the network filters messages with the incorrect magic number
 | ||||
| TEST (network, filter_invalid_network_bytes) | ||||
| { | ||||
| 	nano::system system{ 2 }; | ||||
| 	nano::test::system system{ 2 }; | ||||
| 	auto & node1 = *system.nodes[0]; | ||||
| 	auto & node2 = *system.nodes[1]; | ||||
| 
 | ||||
|  | @ -1388,7 +1388,7 @@ TEST (network, filter_invalid_network_bytes) | |||
| // Ensure the network filters messages with the incorrect minimum version
 | ||||
| TEST (network, filter_invalid_version_using) | ||||
| { | ||||
| 	nano::system system{ 2 }; | ||||
| 	nano::test::system system{ 2 }; | ||||
| 	auto & node1 = *system.nodes[0]; | ||||
| 	auto & node2 = *system.nodes[1]; | ||||
| 
 | ||||
|  | @ -1406,7 +1406,7 @@ TEST (network, filter_invalid_version_using) | |||
| 
 | ||||
| TEST (network, fill_keepalive_self) | ||||
| { | ||||
| 	nano::system system{ 2 }; | ||||
| 	nano::test::system system{ 2 }; | ||||
| 	std::array<nano::endpoint, 8> target; | ||||
| 	system.nodes[0]->network.fill_keepalive_self (target); | ||||
| 	ASSERT_TRUE (target[2].port () == system.nodes[1]->network.port); | ||||
|  |  | |||
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							|  | @ -5,7 +5,7 @@ | |||
| 
 | ||||
| TEST (peer_container, empty_peers) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	nano::network & network (system.nodes[0]->network); | ||||
| 	system.nodes[0]->network.cleanup (std::chrono::steady_clock::now ()); | ||||
| 	ASSERT_EQ (0, network.size ()); | ||||
|  | @ -13,7 +13,7 @@ TEST (peer_container, empty_peers) | |||
| 
 | ||||
| TEST (peer_container, no_recontact) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node1 (*system.nodes[0]); | ||||
| 	nano::network & network (node1.network); | ||||
| 	auto observed_peer (0); | ||||
|  | @ -33,14 +33,14 @@ TEST (peer_container, no_recontact) | |||
| 
 | ||||
| TEST (peer_container, no_self_incoming) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	ASSERT_EQ (nullptr, system.nodes[0]->network.udp_channels.insert (system.nodes[0]->network.endpoint (), 0)); | ||||
| 	ASSERT_TRUE (system.nodes[0]->network.empty ()); | ||||
| } | ||||
| 
 | ||||
| TEST (peer_container, reserved_peers_no_contact) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & channels (system.nodes[0]->network.udp_channels); | ||||
| 	ASSERT_EQ (nullptr, channels.insert (nano::endpoint (boost::asio::ip::address_v6::v4_mapped (boost::asio::ip::address_v4 (0x00000001)), 10000), 0)); | ||||
| 	ASSERT_EQ (nullptr, channels.insert (nano::endpoint (boost::asio::ip::address_v6::v4_mapped (boost::asio::ip::address_v4 (0xc0000201)), 10000), 0)); | ||||
|  | @ -54,7 +54,7 @@ TEST (peer_container, reserved_peers_no_contact) | |||
| 
 | ||||
| TEST (peer_container, split) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node1 (*system.nodes[0]); | ||||
| 	auto now (std::chrono::steady_clock::now ()); | ||||
| 	nano::endpoint endpoint1 (boost::asio::ip::address_v6::loopback (), 100); | ||||
|  | @ -80,7 +80,7 @@ TEST (peer_container, split) | |||
| 
 | ||||
| TEST (channels, fill_random_clear) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	std::array<nano::endpoint, 8> target; | ||||
| 	std::fill (target.begin (), target.end (), nano::endpoint (boost::asio::ip::address_v6::loopback (), 10000)); | ||||
| 	system.nodes[0]->network.random_fill (target); | ||||
|  | @ -89,7 +89,7 @@ TEST (channels, fill_random_clear) | |||
| 
 | ||||
| TEST (channels, fill_random_full) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	for (uint16_t i (0u); i < 100u; ++i) | ||||
| 	{ | ||||
| 		system.nodes[0]->network.udp_channels.insert (nano::endpoint (boost::asio::ip::address_v6::loopback (), i), 0); | ||||
|  | @ -102,7 +102,7 @@ TEST (channels, fill_random_full) | |||
| 
 | ||||
| TEST (channels, fill_random_part) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	std::array<nano::endpoint, 8> target; | ||||
| 	auto half (target.size () / 2); | ||||
| 	for (auto i (0); i < half; ++i) | ||||
|  | @ -118,7 +118,7 @@ TEST (channels, fill_random_part) | |||
| 
 | ||||
| TEST (peer_container, list_fanout) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node (*system.nodes[0]); | ||||
| 	ASSERT_EQ (0, node.network.size ()); | ||||
| 	ASSERT_EQ (0.0, node.network.size_sqrt ()); | ||||
|  | @ -155,11 +155,11 @@ TEST (peer_container, list_fanout) | |||
| // Test to make sure we don't repeatedly send keepalive messages to nodes that aren't responding
 | ||||
| TEST (peer_container, reachout) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_udp = false; | ||||
| 	auto & node1 = *system.add_node (node_flags); | ||||
| 	nano::endpoint endpoint0 (boost::asio::ip::address_v6::loopback (), nano::get_available_port ()); | ||||
| 	nano::endpoint endpoint0 (boost::asio::ip::address_v6::loopback (), nano::test::get_available_port ()); | ||||
| 	// Make sure having been contacted by them already indicates we shouldn't reach out
 | ||||
| 	node1.network.udp_channels.insert (endpoint0, node1.network_params.network.protocol_version); | ||||
| 	ASSERT_TRUE (node1.network.reachout (endpoint0)); | ||||
|  | @ -177,7 +177,7 @@ TEST (peer_container, reachout) | |||
| 
 | ||||
| TEST (peer_container, depeer) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	nano::endpoint endpoint0 (boost::asio::ip::address_v6::loopback (), nano::test_node_port ()); | ||||
| 	nano::keepalive message{ nano::dev::network_params.network }; | ||||
| 	const_cast<uint8_t &> (message.header.version_using) = 1; | ||||
|  |  | |||
|  | @ -9,8 +9,8 @@ using namespace std::chrono_literals; | |||
| 
 | ||||
| TEST (request_aggregator, one) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto & node (*system.add_node (node_config)); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
|  | @ -54,8 +54,8 @@ TEST (request_aggregator, one) | |||
| 
 | ||||
| TEST (request_aggregator, one_update) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto & node (*system.add_node (node_config)); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
|  | @ -119,8 +119,8 @@ TEST (request_aggregator, one_update) | |||
| 
 | ||||
| TEST (request_aggregator, two) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto & node (*system.add_node (node_config)); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
|  | @ -191,13 +191,13 @@ TEST (request_aggregator, two) | |||
| 
 | ||||
| TEST (request_aggregator, two_endpoints) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_rep_crawler = true; | ||||
| 	auto & node1 (*system.add_node (node_config, node_flags)); | ||||
| 	node_config.peering_port = nano::get_available_port (); | ||||
| 	node_config.peering_port = nano::test::get_available_port (); | ||||
| 	auto & node2 (*system.add_node (node_config, node_flags)); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
| 	nano::block_builder builder; | ||||
|  | @ -236,8 +236,8 @@ TEST (request_aggregator, two_endpoints) | |||
| TEST (request_aggregator, split) | ||||
| { | ||||
| 	constexpr size_t max_vbh = nano::network::confirm_ack_hashes_max; | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto & node (*system.add_node (node_config)); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
|  | @ -289,8 +289,8 @@ TEST (request_aggregator, split) | |||
| 
 | ||||
| TEST (request_aggregator, channel_lifetime) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto & node (*system.add_node (node_config)); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
|  | @ -319,8 +319,8 @@ TEST (request_aggregator, channel_lifetime) | |||
| 
 | ||||
| TEST (request_aggregator, channel_update) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto & node (*system.add_node (node_config)); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
|  | @ -356,8 +356,8 @@ TEST (request_aggregator, channel_update) | |||
| 
 | ||||
| TEST (request_aggregator, channel_max_queue) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	node_config.max_queued_requests = 1; | ||||
| 	auto & node (*system.add_node (node_config)); | ||||
|  | @ -384,8 +384,8 @@ TEST (request_aggregator, channel_max_queue) | |||
| 
 | ||||
| TEST (request_aggregator, unique) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto & node (*system.add_node (node_config)); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
|  | @ -416,7 +416,7 @@ namespace nano | |||
| { | ||||
| TEST (request_aggregator, cannot_vote) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags flags; | ||||
| 	flags.disable_request_loop = true; | ||||
| 	auto & node (*system.add_node (flags)); | ||||
|  |  | |||
|  | @ -18,11 +18,11 @@ using namespace std::chrono_literals; | |||
| 
 | ||||
| TEST (socket, max_connections) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 
 | ||||
| 	auto node = system.add_node (); | ||||
| 
 | ||||
| 	auto server_port = nano::get_available_port (); | ||||
| 	auto server_port = nano::test::get_available_port (); | ||||
| 	boost::asio::ip::tcp::endpoint listen_endpoint{ boost::asio::ip::address_v6::any (), server_port }; | ||||
| 	boost::asio::ip::tcp::endpoint dst_endpoint{ boost::asio::ip::address_v6::loopback (), server_port }; | ||||
| 
 | ||||
|  | @ -109,12 +109,12 @@ TEST (socket, max_connections) | |||
| 
 | ||||
| TEST (socket, max_connections_per_ip) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 
 | ||||
| 	auto node = system.add_node (); | ||||
| 	ASSERT_FALSE (node->flags.disable_max_peers_per_ip); | ||||
| 
 | ||||
| 	auto server_port = nano::get_available_port (); | ||||
| 	auto server_port = nano::test::get_available_port (); | ||||
| 	boost::asio::ip::tcp::endpoint listen_endpoint{ boost::asio::ip::address_v6::any (), server_port }; | ||||
| 	boost::asio::ip::tcp::endpoint dst_endpoint{ boost::asio::ip::address_v6::loopback (), server_port }; | ||||
| 
 | ||||
|  | @ -192,7 +192,7 @@ TEST (socket, last_ipv6_subnet_address) | |||
| 
 | ||||
| TEST (socket, count_subnetwork_connections) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	auto node = system.add_node (); | ||||
| 
 | ||||
| 	auto address0 = boost::asio::ip::make_address ("a41d:b7b1:ffff:ffff:ffff:ffff:ffff:ffff"); // out of network prefix
 | ||||
|  | @ -226,7 +226,7 @@ TEST (socket, count_subnetwork_connections) | |||
| 
 | ||||
| TEST (socket, max_connections_per_subnetwork) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 
 | ||||
| 	nano::node_flags node_flags; | ||||
| 	// disabling IP limit because it will be used the same IP address to check they come from the same subnetwork.
 | ||||
|  | @ -236,7 +236,7 @@ TEST (socket, max_connections_per_subnetwork) | |||
| 	ASSERT_TRUE (node->flags.disable_max_peers_per_ip); | ||||
| 	ASSERT_FALSE (node->flags.disable_max_peers_per_subnetwork); | ||||
| 
 | ||||
| 	auto server_port = nano::get_available_port (); | ||||
| 	auto server_port = nano::test::get_available_port (); | ||||
| 	boost::asio::ip::tcp::endpoint listen_endpoint{ boost::asio::ip::address_v6::any (), server_port }; | ||||
| 	boost::asio::ip::tcp::endpoint dst_endpoint{ boost::asio::ip::address_v6::loopback (), server_port }; | ||||
| 
 | ||||
|  | @ -292,14 +292,14 @@ TEST (socket, max_connections_per_subnetwork) | |||
| 
 | ||||
| TEST (socket, disabled_max_peers_per_ip) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 
 | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_max_peers_per_ip = true; | ||||
| 	auto node = system.add_node (node_flags); | ||||
| 	ASSERT_TRUE (node->flags.disable_max_peers_per_ip); | ||||
| 
 | ||||
| 	auto server_port = nano::get_available_port (); | ||||
| 	auto server_port = nano::test::get_available_port (); | ||||
| 	boost::asio::ip::tcp::endpoint listen_endpoint{ boost::asio::ip::address_v6::any (), server_port }; | ||||
| 	boost::asio::ip::tcp::endpoint dst_endpoint{ boost::asio::ip::address_v6::loopback (), server_port }; | ||||
| 
 | ||||
|  | @ -355,7 +355,7 @@ TEST (socket, disabled_max_peers_per_ip) | |||
| 
 | ||||
| TEST (socket, disconnection_of_silent_connections) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 
 | ||||
| 	nano::node_config config; | ||||
| 	// Increasing the timer timeout, so we don't let the connection to timeout due to the timer checker.
 | ||||
|  | @ -366,7 +366,7 @@ TEST (socket, disconnection_of_silent_connections) | |||
| 
 | ||||
| 	auto node = system.add_node (config); | ||||
| 
 | ||||
| 	auto server_port = nano::get_available_port (); | ||||
| 	auto server_port = nano::test::get_available_port (); | ||||
| 	boost::asio::ip::tcp::endpoint listen_endpoint{ boost::asio::ip::address_v6::any (), server_port }; | ||||
| 	boost::asio::ip::tcp::endpoint dst_endpoint{ boost::asio::ip::address_v6::loopback (), server_port }; | ||||
| 
 | ||||
|  | @ -422,7 +422,7 @@ TEST (socket, drop_policy) | |||
| 	std::vector<std::shared_ptr<nano::socket>> connections; | ||||
| 
 | ||||
| 	auto func = [&] (size_t total_message_count, nano::buffer_drop_policy drop_policy) { | ||||
| 		auto server_port (nano::get_available_port ()); | ||||
| 		auto server_port (nano::test::get_available_port ()); | ||||
| 		boost::asio::ip::tcp::endpoint endpoint (boost::asio::ip::address_v6::any (), server_port); | ||||
| 
 | ||||
| 		auto server_socket = std::make_shared<nano::server_socket> (*node, endpoint, 1); | ||||
|  | @ -438,7 +438,7 @@ TEST (socket, drop_policy) | |||
| 
 | ||||
| 		auto client = std::make_shared<nano::client_socket> (*node); | ||||
| 		nano::transport::channel_tcp channel{ *node, client }; | ||||
| 		nano::util::counted_completion write_completion (static_cast<unsigned> (total_message_count)); | ||||
| 		nano::test::counted_completion write_completion (static_cast<unsigned> (total_message_count)); | ||||
| 
 | ||||
| 		client->async_connect (boost::asio::ip::tcp::endpoint (boost::asio::ip::address_v6::loopback (), server_socket->listening_port ()), | ||||
| 		[&channel, total_message_count, node, &write_completion, &drop_policy, client] (boost::system::error_code const & ec_a) mutable { | ||||
|  | @ -492,7 +492,7 @@ TEST (socket, concurrent_writes) | |||
| 	constexpr size_t total_message_count = client_count * message_count; | ||||
| 
 | ||||
| 	// We're expecting client_count*4 messages
 | ||||
| 	nano::util::counted_completion read_count_completion (total_message_count); | ||||
| 	nano::test::counted_completion read_count_completion (total_message_count); | ||||
| 	std::function<void (std::shared_ptr<nano::socket> const &)> reader = [&read_count_completion, &total_message_count, &reader] (std::shared_ptr<nano::socket> const & socket_a) { | ||||
| 		auto buff (std::make_shared<std::vector<uint8_t>> ()); | ||||
| 		buff->resize (1); | ||||
|  | @ -546,7 +546,7 @@ TEST (socket, concurrent_writes) | |||
| 		return true; | ||||
| 	}); | ||||
| 
 | ||||
| 	nano::util::counted_completion connection_count_completion (client_count); | ||||
| 	nano::test::counted_completion connection_count_completion (client_count); | ||||
| 	std::vector<std::shared_ptr<nano::socket>> clients; | ||||
| 	for (unsigned i = 0; i < client_count; i++) | ||||
| 	{ | ||||
|  | @ -618,14 +618,14 @@ TEST (socket, concurrent_writes) | |||
| TEST (socket_timeout, connect) | ||||
| { | ||||
| 	// create one node and set timeout to 1 second
 | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	std::shared_ptr<nano::node> node = system.nodes[0]; | ||||
| 	node->config.tcp_io_timeout = std::chrono::seconds (1); | ||||
| 
 | ||||
| 	// try to connect to an IP address that most likely does not exist and will not reply
 | ||||
| 	// we want the tcp stack to not receive a negative reply, we want it to see silence and to keep trying
 | ||||
| 	// I use the un-routable IP address 10.255.254.253, which is likely to not exist
 | ||||
| 	boost::asio::ip::tcp::endpoint endpoint (boost::asio::ip::make_address_v6 ("::ffff:10.255.254.253"), nano::get_available_port ()); | ||||
| 	boost::asio::ip::tcp::endpoint endpoint (boost::asio::ip::make_address_v6 ("::ffff:10.255.254.253"), nano::test::get_available_port ()); | ||||
| 
 | ||||
| 	// create a client socket and try to connect to the IP address that wil not respond
 | ||||
| 	auto socket = std::make_shared<nano::client_socket> (*node); | ||||
|  | @ -651,12 +651,12 @@ TEST (socket_timeout, connect) | |||
| TEST (socket_timeout, read) | ||||
| { | ||||
| 	// create one node and set timeout to 1 second
 | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	std::shared_ptr<nano::node> node = system.nodes[0]; | ||||
| 	node->config.tcp_io_timeout = std::chrono::seconds (2); | ||||
| 
 | ||||
| 	// create a server socket
 | ||||
| 	boost::asio::ip::tcp::endpoint endpoint (boost::asio::ip::address_v6::loopback (), nano::get_available_port ()); | ||||
| 	boost::asio::ip::tcp::endpoint endpoint (boost::asio::ip::address_v6::loopback (), nano::test::get_available_port ()); | ||||
| 	boost::asio::ip::tcp::acceptor acceptor (system.io_ctx); | ||||
| 	acceptor.open (endpoint.protocol ()); | ||||
| 	acceptor.bind (endpoint); | ||||
|  | @ -696,12 +696,12 @@ TEST (socket_timeout, read) | |||
| TEST (socket_timeout, write) | ||||
| { | ||||
| 	// create one node and set timeout to 1 second
 | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	std::shared_ptr<nano::node> node = system.nodes[0]; | ||||
| 	node->config.tcp_io_timeout = std::chrono::seconds (2); | ||||
| 
 | ||||
| 	// create a server socket
 | ||||
| 	boost::asio::ip::tcp::endpoint endpoint (boost::asio::ip::address_v6::loopback (), nano::get_available_port ()); | ||||
| 	boost::asio::ip::tcp::endpoint endpoint (boost::asio::ip::address_v6::loopback (), nano::test::get_available_port ()); | ||||
| 	boost::asio::ip::tcp::acceptor acceptor (system.io_ctx); | ||||
| 	acceptor.open (endpoint.protocol ()); | ||||
| 	acceptor.bind (endpoint); | ||||
|  | @ -746,12 +746,12 @@ TEST (socket_timeout, write) | |||
| TEST (socket_timeout, read_overlapped) | ||||
| { | ||||
| 	// create one node and set timeout to 1 second
 | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	std::shared_ptr<nano::node> node = system.nodes[0]; | ||||
| 	node->config.tcp_io_timeout = std::chrono::seconds (2); | ||||
| 
 | ||||
| 	// create a server socket
 | ||||
| 	boost::asio::ip::tcp::endpoint endpoint (boost::asio::ip::address_v6::loopback (), nano::get_available_port ()); | ||||
| 	boost::asio::ip::tcp::endpoint endpoint (boost::asio::ip::address_v6::loopback (), nano::test::get_available_port ()); | ||||
| 	boost::asio::ip::tcp::acceptor acceptor (system.io_ctx); | ||||
| 	acceptor.open (endpoint.protocol ()); | ||||
| 	acceptor.bind (endpoint); | ||||
|  | @ -802,12 +802,12 @@ TEST (socket_timeout, read_overlapped) | |||
| TEST (socket_timeout, write_overlapped) | ||||
| { | ||||
| 	// create one node and set timeout to 1 second
 | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	std::shared_ptr<nano::node> node = system.nodes[0]; | ||||
| 	node->config.tcp_io_timeout = std::chrono::seconds (2); | ||||
| 
 | ||||
| 	// create a server socket
 | ||||
| 	boost::asio::ip::tcp::endpoint endpoint (boost::asio::ip::address_v6::loopback (), nano::get_available_port ()); | ||||
| 	boost::asio::ip::tcp::endpoint endpoint (boost::asio::ip::address_v6::loopback (), nano::test::get_available_port ()); | ||||
| 	boost::asio::ip::tcp::acceptor acceptor (system.io_ctx); | ||||
| 	acceptor.open (endpoint.protocol ()); | ||||
| 	acceptor.bind (endpoint); | ||||
|  |  | |||
|  | @ -9,7 +9,7 @@ using namespace std::chrono_literals; | |||
| 
 | ||||
| TEST (system, work_generate_limited) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::block_hash key (1); | ||||
| 	auto min = nano::dev::network_params.work.entry; | ||||
| 	auto max = nano::dev::network_params.work.base; | ||||
|  | @ -25,7 +25,7 @@ TEST (system, work_generate_limited) | |||
| // All nodes in the system should agree on the genesis balance
 | ||||
| TEST (system, system_genesis) | ||||
| { | ||||
| 	nano::system system (2); | ||||
| 	nano::test::system system (2); | ||||
| 	for (auto & i : system.nodes) | ||||
| 	{ | ||||
| 		auto transaction (i->store.tx_begin_read ()); | ||||
|  | @ -35,7 +35,7 @@ TEST (system, system_genesis) | |||
| 
 | ||||
| TEST (system, DISABLED_generate_send_existing) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node1 (*system.nodes[0]); | ||||
| 	nano::thread_runner runner (system.io_ctx, node1.config.io_threads); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
|  | @ -90,7 +90,7 @@ TEST (system, DISABLED_generate_send_existing) | |||
| 
 | ||||
| TEST (system, DISABLED_generate_send_new) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node1 (*system.nodes[0]); | ||||
| 	nano::thread_runner runner (system.io_ctx, node1.config.io_threads); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
|  | @ -148,7 +148,7 @@ TEST (system, DISABLED_generate_send_new) | |||
| 
 | ||||
| TEST (system, rep_initialize_one) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::keypair key; | ||||
| 	system.ledger_initialization_set ({ key }); | ||||
| 	auto node = system.add_node (); | ||||
|  | @ -157,7 +157,7 @@ TEST (system, rep_initialize_one) | |||
| 
 | ||||
| TEST (system, rep_initialize_two) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::keypair key0; | ||||
| 	nano::keypair key1; | ||||
| 	system.ledger_initialization_set ({ key0, key1 }); | ||||
|  | @ -168,7 +168,7 @@ TEST (system, rep_initialize_two) | |||
| 
 | ||||
| TEST (system, rep_initialize_one_reserve) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::keypair key; | ||||
| 	system.ledger_initialization_set ({ key }, nano::Gxrb_ratio); | ||||
| 	auto node = system.add_node (); | ||||
|  | @ -178,7 +178,7 @@ TEST (system, rep_initialize_one_reserve) | |||
| 
 | ||||
| TEST (system, rep_initialize_two_reserve) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::keypair key0; | ||||
| 	nano::keypair key1; | ||||
| 	system.ledger_initialization_set ({ key0, key1 }, nano::Gxrb_ratio); | ||||
|  | @ -189,7 +189,7 @@ TEST (system, rep_initialize_two_reserve) | |||
| 
 | ||||
| TEST (system, rep_initialize_many) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::keypair key0; | ||||
| 	nano::keypair key1; | ||||
| 	system.ledger_initialization_set ({ key0, key1 }, nano::Gxrb_ratio); | ||||
|  | @ -203,10 +203,10 @@ TEST (system, rep_initialize_many) | |||
| 
 | ||||
| TEST (system, transport_basic) | ||||
| { | ||||
| 	nano::system system{ 1 }; | ||||
| 	nano::test::system system{ 1 }; | ||||
| 	auto & node0 = *system.nodes[0]; | ||||
| 	// Start nodes in separate systems so they don't automatically connect with each other.
 | ||||
| 	nano::system system1{ 1 }; | ||||
| 	nano::test::system system1{ 1 }; | ||||
| 	auto & node1 = *system1.nodes[0]; | ||||
| 	ASSERT_EQ (0, node1.stats.count (nano::stat::type::message, nano::stat::detail::keepalive, nano::stat::dir::in)); | ||||
| 	nano::transport::inproc::channel channel{ node0, node1 }; | ||||
|  |  | |||
|  | @ -271,7 +271,7 @@ TEST (telemetry, unknown_data) | |||
| 
 | ||||
| TEST (telemetry, no_peers) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 
 | ||||
| 	auto responses = system.nodes[0]->telemetry->get_metrics (); | ||||
| 	ASSERT_TRUE (responses.empty ()); | ||||
|  | @ -279,14 +279,14 @@ TEST (telemetry, no_peers) | |||
| 
 | ||||
| TEST (telemetry, basic) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_ongoing_telemetry_requests = true; | ||||
| 	node_flags.disable_initial_telemetry_requests = true; | ||||
| 	auto node_client = system.add_node (node_flags); | ||||
| 	auto node_server = system.add_node (node_flags); | ||||
| 
 | ||||
| 	wait_peer_connections (system); | ||||
| 	nano::test::wait_peer_connections (system); | ||||
| 
 | ||||
| 	// Request telemetry metrics
 | ||||
| 	nano::telemetry_data telemetry_data; | ||||
|  | @ -305,7 +305,7 @@ TEST (telemetry, basic) | |||
| 	} | ||||
| 
 | ||||
| 	// Check the metrics are correct
 | ||||
| 	nano::compare_default_telemetry_response_data (telemetry_data, node_server->network_params, node_server->config.bandwidth_limit, node_server->default_difficulty (nano::work_version::work_1), node_server->node_id); | ||||
| 	nano::test::compare_default_telemetry_response_data (telemetry_data, node_server->network_params, node_server->config.bandwidth_limit, node_server->default_difficulty (nano::work_version::work_1), node_server->node_id); | ||||
| 
 | ||||
| 	// Call again straight away. It should use the cache
 | ||||
| 	{ | ||||
|  | @ -334,7 +334,7 @@ TEST (telemetry, basic) | |||
| 
 | ||||
| TEST (telemetry, receive_from_non_listening_channel) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	auto node = system.add_node (); | ||||
| 	nano::telemetry_ack message{ nano::dev::network_params.network, nano::telemetry_data{} }; | ||||
| 	node->network.inbound (message, node->network.udp_channels.create (node->network.endpoint ())); | ||||
|  | @ -344,20 +344,20 @@ TEST (telemetry, receive_from_non_listening_channel) | |||
| 
 | ||||
| TEST (telemetry, over_udp) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_tcp_realtime = true; | ||||
| 	node_flags.disable_udp = false; | ||||
| 	auto node_client = system.add_node (node_flags); | ||||
| 	auto node_server = system.add_node (node_flags); | ||||
| 
 | ||||
| 	wait_peer_connections (system); | ||||
| 	nano::test::wait_peer_connections (system); | ||||
| 
 | ||||
| 	std::atomic<bool> done{ false }; | ||||
| 	auto channel = node_client->network.find_channel (node_server->network.endpoint ()); | ||||
| 	node_client->telemetry->get_metrics_single_peer_async (channel, [&done, &node_server] (nano::telemetry_data_response const & response_a) { | ||||
| 		ASSERT_FALSE (response_a.error); | ||||
| 		nano::compare_default_telemetry_response_data (response_a.telemetry_data, node_server->network_params, node_server->config.bandwidth_limit, node_server->default_difficulty (nano::work_version::work_1), node_server->node_id); | ||||
| 		nano::test::compare_default_telemetry_response_data (response_a.telemetry_data, node_server->network_params, node_server->config.bandwidth_limit, node_server->default_difficulty (nano::work_version::work_1), node_server->node_id); | ||||
| 		done = true; | ||||
| 	}); | ||||
| 
 | ||||
|  | @ -376,7 +376,7 @@ TEST (telemetry, over_udp) | |||
| 
 | ||||
| TEST (telemetry, invalid_channel) | ||||
| { | ||||
| 	nano::system system (2); | ||||
| 	nano::test::system system (2); | ||||
| 
 | ||||
| 	auto node_client = system.nodes.front (); | ||||
| 	auto node_server = system.nodes.back (); | ||||
|  | @ -392,12 +392,12 @@ TEST (telemetry, invalid_channel) | |||
| 
 | ||||
| TEST (telemetry, blocking_request) | ||||
| { | ||||
| 	nano::system system (2); | ||||
| 	nano::test::system system (2); | ||||
| 
 | ||||
| 	auto node_client = system.nodes.front (); | ||||
| 	auto node_server = system.nodes.back (); | ||||
| 
 | ||||
| 	wait_peer_connections (system); | ||||
| 	nano::test::wait_peer_connections (system); | ||||
| 
 | ||||
| 	// Request telemetry metrics
 | ||||
| 	std::atomic<bool> done{ false }; | ||||
|  | @ -422,7 +422,7 @@ TEST (telemetry, blocking_request) | |||
| 	// Now try single request metric
 | ||||
| 	auto telemetry_data_response = node_client->telemetry->get_metrics_single_peer (node_client->network.find_channel (node_server->network.endpoint ())); | ||||
| 	ASSERT_FALSE (telemetry_data_response.error); | ||||
| 	nano::compare_default_telemetry_response_data (telemetry_data_response.telemetry_data, node_server->network_params, node_server->config.bandwidth_limit, node_server->default_difficulty (nano::work_version::work_1), node_server->node_id); | ||||
| 	nano::test::compare_default_telemetry_response_data (telemetry_data_response.telemetry_data, node_server->network_params, node_server->config.bandwidth_limit, node_server->default_difficulty (nano::work_version::work_1), node_server->node_id); | ||||
| 
 | ||||
| 	done = true; | ||||
| 	promise.get_future ().wait (); | ||||
|  | @ -430,13 +430,13 @@ TEST (telemetry, blocking_request) | |||
| 
 | ||||
| TEST (telemetry, disconnects) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_initial_telemetry_requests = true; | ||||
| 	auto node_client = system.add_node (node_flags); | ||||
| 	auto node_server = system.add_node (node_flags); | ||||
| 
 | ||||
| 	wait_peer_connections (system); | ||||
| 	nano::test::wait_peer_connections (system); | ||||
| 
 | ||||
| 	// Try and request metrics from a node which is turned off but a channel is not closed yet
 | ||||
| 	auto channel = node_client->network.find_channel (node_server->network.endpoint ()); | ||||
|  | @ -455,14 +455,14 @@ TEST (telemetry, disconnects) | |||
| TEST (telemetry, dos_tcp) | ||||
| { | ||||
| 	// Confirm that telemetry_reqs are not processed
 | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_initial_telemetry_requests = true; | ||||
| 	node_flags.disable_ongoing_telemetry_requests = true; | ||||
| 	auto node_client = system.add_node (node_flags); | ||||
| 	auto node_server = system.add_node (node_flags); | ||||
| 
 | ||||
| 	wait_peer_connections (system); | ||||
| 	nano::test::wait_peer_connections (system); | ||||
| 
 | ||||
| 	nano::telemetry_req message{ nano::dev::network_params.network }; | ||||
| 	auto channel = node_client->network.tcp_channels.find_channel (nano::transport::map_endpoint_to_tcp (node_server->network.endpoint ())); | ||||
|  | @ -496,7 +496,7 @@ TEST (telemetry, dos_tcp) | |||
| TEST (telemetry, dos_udp) | ||||
| { | ||||
| 	// Confirm that telemetry_reqs are not processed
 | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_udp = false; | ||||
| 	node_flags.disable_tcp_realtime = true; | ||||
|  | @ -505,7 +505,7 @@ TEST (telemetry, dos_udp) | |||
| 	auto node_client = system.add_node (node_flags); | ||||
| 	auto node_server = system.add_node (node_flags); | ||||
| 
 | ||||
| 	wait_peer_connections (system); | ||||
| 	nano::test::wait_peer_connections (system); | ||||
| 
 | ||||
| 	nano::telemetry_req message{ nano::dev::network_params.network }; | ||||
| 	auto channel (node_client->network.udp_channels.create (node_server->network.endpoint ())); | ||||
|  | @ -539,14 +539,14 @@ TEST (telemetry, dos_udp) | |||
| 
 | ||||
| TEST (telemetry, disable_metrics) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_initial_telemetry_requests = true; | ||||
| 	auto node_client = system.add_node (node_flags); | ||||
| 	node_flags.disable_providing_telemetry_metrics = true; | ||||
| 	auto node_server = system.add_node (node_flags); | ||||
| 
 | ||||
| 	wait_peer_connections (system); | ||||
| 	nano::test::wait_peer_connections (system); | ||||
| 
 | ||||
| 	// Try and request metrics from a node which is turned off but a channel is not closed yet
 | ||||
| 	auto channel = node_client->network.find_channel (node_server->network.endpoint ()); | ||||
|  | @ -565,7 +565,7 @@ TEST (telemetry, disable_metrics) | |||
| 	auto channel1 = node_server->network.find_channel (node_client->network.endpoint ()); | ||||
| 	node_server->telemetry->get_metrics_single_peer_async (channel1, [&done, node_client] (nano::telemetry_data_response const & response_a) { | ||||
| 		ASSERT_FALSE (response_a.error); | ||||
| 		nano::compare_default_telemetry_response_data (response_a.telemetry_data, node_client->network_params, node_client->config.bandwidth_limit, node_client->default_difficulty (nano::work_version::work_1), node_client->node_id); | ||||
| 		nano::test::compare_default_telemetry_response_data (response_a.telemetry_data, node_client->network_params, node_client->config.bandwidth_limit, node_client->default_difficulty (nano::work_version::work_1), node_client->node_id); | ||||
| 		done = true; | ||||
| 	}); | ||||
| 
 | ||||
|  | @ -574,7 +574,7 @@ TEST (telemetry, disable_metrics) | |||
| 
 | ||||
| TEST (telemetry, max_possible_size) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_initial_telemetry_requests = true; | ||||
| 	node_flags.disable_ongoing_telemetry_requests = true; | ||||
|  | @ -585,7 +585,7 @@ TEST (telemetry, max_possible_size) | |||
| 	data.unknown_data.resize (nano::message_header::telemetry_size_mask.to_ulong () - nano::telemetry_data::latest_size); | ||||
| 
 | ||||
| 	nano::telemetry_ack message{ nano::dev::network_params.network, data }; | ||||
| 	wait_peer_connections (system); | ||||
| 	nano::test::wait_peer_connections (system); | ||||
| 
 | ||||
| 	auto channel = node_client->network.tcp_channels.find_channel (nano::transport::map_endpoint_to_tcp (node_server->network.endpoint ())); | ||||
| 	channel->send (message, [] (boost::system::error_code const & ec, size_t size_a) { | ||||
|  | @ -602,7 +602,7 @@ namespace nano | |||
| // Issue for investigating it: https://github.com/nanocurrency/nano-node/issues/3524
 | ||||
| TEST (telemetry, DISABLED_remove_peer_different_genesis) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto node0 (system.nodes[0]); | ||||
| 	ASSERT_EQ (0, node0->network.size ()); | ||||
| 	// Change genesis block to something else in this test (this is the reference telemetry processing uses).
 | ||||
|  | @ -633,7 +633,7 @@ TEST (telemetry, remove_peer_different_genesis_udp) | |||
| 	node_flags.disable_udp = false; | ||||
| 	node_flags.disable_tcp_realtime = true; | ||||
| 	node_flags.disable_ongoing_telemetry_requests = true; | ||||
| 	nano::system system (1, nano::transport::transport_type::udp, node_flags); | ||||
| 	nano::test::system system (1, nano::transport::transport_type::udp, node_flags); | ||||
| 	auto node0 (system.nodes[0]); | ||||
| 	ASSERT_EQ (0, node0->network.size ()); | ||||
| 	nano::network_params network_params{ nano::networks::nano_dev_network }; | ||||
|  | @ -674,7 +674,7 @@ TEST (telemetry, remove_peer_different_genesis_udp) | |||
| 
 | ||||
| TEST (telemetry, remove_peer_invalid_signature) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_udp = false; | ||||
| 	node_flags.disable_initial_telemetry_requests = true; | ||||
|  | @ -702,7 +702,7 @@ TEST (telemetry, remove_peer_invalid_signature) | |||
| 
 | ||||
| TEST (telemetry, maker_pruning) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_ongoing_telemetry_requests = true; | ||||
| 	node_flags.disable_initial_telemetry_requests = true; | ||||
|  | @ -712,7 +712,7 @@ TEST (telemetry, maker_pruning) | |||
| 	config.enable_voting = false; | ||||
| 	auto node_server = system.add_node (config, node_flags); | ||||
| 
 | ||||
| 	wait_peer_connections (system); | ||||
| 	nano::test::wait_peer_connections (system); | ||||
| 
 | ||||
| 	// Request telemetry metrics
 | ||||
| 	nano::telemetry_data telemetry_data; | ||||
|  |  | |||
|  | @ -55,7 +55,7 @@ TEST (unchecked_map, put_one) | |||
| 
 | ||||
| TEST (block_store, one_bootstrap) | ||||
| { | ||||
| 	nano::system system{}; | ||||
| 	nano::test::system system{}; | ||||
| 	nano::logger_mt logger{}; | ||||
| 	auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); | ||||
| 	nano::unchecked_map unchecked{ *store, false }; | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ using namespace std::chrono_literals; | |||
| 
 | ||||
| TEST (vote_processor, codes) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node (*system.nodes[0]); | ||||
| 	nano::keypair key; | ||||
| 	auto vote (std::make_shared<nano::vote> (key.pub, key.prv, nano::vote::timestamp_min * 1, 0, std::vector<nano::block_hash>{ nano::dev::genesis->hash () })); | ||||
|  | @ -45,7 +45,7 @@ TEST (vote_processor, codes) | |||
| 
 | ||||
| TEST (vote_processor, flush) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node (*system.nodes[0]); | ||||
| 	auto channel (std::make_shared<nano::transport::inproc::channel> (node, node)); | ||||
| 	for (unsigned i = 0; i < 2000; ++i) | ||||
|  | @ -59,7 +59,7 @@ TEST (vote_processor, flush) | |||
| 
 | ||||
| TEST (vote_processor, invalid_signature) | ||||
| { | ||||
| 	nano::system system{ 1 }; | ||||
| 	nano::test::system system{ 1 }; | ||||
| 	auto & node = *system.nodes[0]; | ||||
| 	nano::keypair key; | ||||
| 	auto vote = std::make_shared<nano::vote> (key.pub, key.prv, nano::vote::timestamp_min * 1, 0, std::vector<nano::block_hash>{ nano::dev::genesis->hash () }); | ||||
|  | @ -81,7 +81,7 @@ TEST (vote_processor, invalid_signature) | |||
| 
 | ||||
| TEST (vote_processor, no_capacity) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.vote_processor_capacity = 0; | ||||
| 	auto & node (*system.add_node (node_flags)); | ||||
|  | @ -93,7 +93,7 @@ TEST (vote_processor, no_capacity) | |||
| 
 | ||||
| TEST (vote_processor, overflow) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.vote_processor_capacity = 1; | ||||
| 	auto & node (*system.add_node (node_flags)); | ||||
|  | @ -124,7 +124,7 @@ namespace nano | |||
| { | ||||
| TEST (vote_processor, weights) | ||||
| { | ||||
| 	nano::system system (4); | ||||
| 	nano::test::system system (4); | ||||
| 	auto & node (*system.nodes[0]); | ||||
| 
 | ||||
| 	// Create representatives of different weight levels
 | ||||
|  | @ -177,14 +177,14 @@ TEST (vote_processor, weights) | |||
| // Nodes should not relay their own votes
 | ||||
| TEST (vote_processor, no_broadcast_local) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags flags; | ||||
| 	flags.disable_request_loop = true; | ||||
| 	nano::node_config config1, config2; | ||||
| 	config1.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto & node (*system.add_node (config1, flags)); | ||||
| 	config2.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	config2.peering_port = nano::get_available_port (); | ||||
| 	config2.peering_port = nano::test::get_available_port (); | ||||
| 	system.add_node (config2, flags); | ||||
| 	nano::block_builder builder; | ||||
| 	std::error_code ec; | ||||
|  | @ -230,14 +230,14 @@ TEST (vote_processor, no_broadcast_local) | |||
| // Done without a representative.
 | ||||
| TEST (vote_processor, local_broadcast_without_a_representative) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags flags; | ||||
| 	flags.disable_request_loop = true; | ||||
| 	nano::node_config config1, config2; | ||||
| 	config1.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto & node (*system.add_node (config1, flags)); | ||||
| 	config2.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	config2.peering_port = nano::get_available_port (); | ||||
| 	config2.peering_port = nano::test::get_available_port (); | ||||
| 	system.add_node (config2, flags); | ||||
| 	nano::block_builder builder; | ||||
| 	std::error_code ec; | ||||
|  | @ -278,14 +278,14 @@ TEST (vote_processor, local_broadcast_without_a_representative) | |||
| // Done with a principal representative.
 | ||||
| TEST (vote_processor, no_broadcast_local_with_a_principal_representative) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags flags; | ||||
| 	flags.disable_request_loop = true; | ||||
| 	nano::node_config config1, config2; | ||||
| 	config1.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto & node (*system.add_node (config1, flags)); | ||||
| 	config2.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	config2.peering_port = nano::get_available_port (); | ||||
| 	config2.peering_port = nano::test::get_available_port (); | ||||
| 	system.add_node (config2, flags); | ||||
| 	nano::block_builder builder; | ||||
| 	std::error_code ec; | ||||
|  | @ -330,7 +330,7 @@ TEST (vote_processor, no_broadcast_local_with_a_principal_representative) | |||
|  */ | ||||
| TEST (vote, timestamp_and_duration_masking) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::keypair key; | ||||
| 	auto hash = std::vector<nano::block_hash>{ nano::dev::genesis->hash () }; | ||||
| 	auto vote = std::make_shared<nano::vote> (key.pub, key.prv, 0x123f, 0xf, hash); | ||||
|  |  | |||
|  | @ -57,7 +57,7 @@ TEST (local_vote_history, basic) | |||
| 
 | ||||
| TEST (vote_generator, cache) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node (*system.nodes[0]); | ||||
| 	auto epoch1 = system.upgrade_genesis_epoch (node, nano::epoch::epoch_1); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
|  | @ -70,7 +70,7 @@ TEST (vote_generator, cache) | |||
| 
 | ||||
| TEST (vote_generator, multiple_representatives) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node (*system.nodes[0]); | ||||
| 	nano::keypair key1, key2, key3; | ||||
| 	auto & wallet (*system.wallet (0)); | ||||
|  | @ -105,7 +105,7 @@ TEST (vote_generator, multiple_representatives) | |||
| 
 | ||||
| TEST (vote_generator, session) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto node (system.nodes[0]); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
| 	nano::vote_generator_session generator_session (node->active.generator); | ||||
|  | @ -156,7 +156,7 @@ TEST (vote_spacing, vote_generator) | |||
| { | ||||
| 	nano::node_config config; | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_search_pending = true; | ||||
| 	auto & node = *system.add_node (config, node_flags); | ||||
|  | @ -199,7 +199,7 @@ TEST (vote_spacing, rapid) | |||
| { | ||||
| 	nano::node_config config; | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_search_pending = true; | ||||
| 	auto & node = *system.add_node (config, node_flags); | ||||
|  |  | |||
|  | @ -164,7 +164,7 @@ TEST (wallet, two_item_iteration) | |||
| 
 | ||||
| TEST (wallet, insufficient_spend_one) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	nano::keypair key1; | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
| 	auto block (system.wallet (0)->send_action (nano::dev::genesis_key.pub, key1.pub, 500)); | ||||
|  | @ -174,7 +174,7 @@ TEST (wallet, insufficient_spend_one) | |||
| 
 | ||||
| TEST (wallet, spend_all_one) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node1 (*system.nodes[0]); | ||||
| 	nano::block_hash latest1 (node1.latest (nano::dev::genesis_key.pub)); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
|  | @ -195,7 +195,7 @@ TEST (wallet, spend_all_one) | |||
| 
 | ||||
| TEST (wallet, send_async) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
| 	nano::keypair key2; | ||||
| 	std::thread thread ([&system] () { | ||||
|  | @ -209,7 +209,7 @@ TEST (wallet, send_async) | |||
| 
 | ||||
| TEST (wallet, spend) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node1 (*system.nodes[0]); | ||||
| 	nano::block_hash latest1 (node1.latest (nano::dev::genesis_key.pub)); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
|  | @ -232,7 +232,7 @@ TEST (wallet, spend) | |||
| 
 | ||||
| TEST (wallet, change) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
| 	nano::keypair key2; | ||||
| 	auto block1 (system.nodes[0]->rep_block (nano::dev::genesis_key.pub)); | ||||
|  | @ -245,7 +245,7 @@ TEST (wallet, change) | |||
| 
 | ||||
| TEST (wallet, partial_spend) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
| 	nano::keypair key2; | ||||
| 	ASSERT_NE (nullptr, system.wallet (0)->send_action (nano::dev::genesis_key.pub, key2.pub, 500)); | ||||
|  | @ -254,7 +254,7 @@ TEST (wallet, partial_spend) | |||
| 
 | ||||
| TEST (wallet, spend_no_previous) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	{ | ||||
| 		system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
| 		auto transaction (system.nodes[0]->store.tx_begin_read ()); | ||||
|  | @ -594,7 +594,7 @@ TEST (wallet_store, move) | |||
| 
 | ||||
| TEST (wallet_store, import) | ||||
| { | ||||
| 	nano::system system (2); | ||||
| 	nano::test::system system (2); | ||||
| 	auto wallet1 (system.wallet (0)); | ||||
| 	auto wallet2 (system.wallet (1)); | ||||
| 	nano::keypair key1; | ||||
|  | @ -609,7 +609,7 @@ TEST (wallet_store, import) | |||
| 
 | ||||
| TEST (wallet_store, fail_import_bad_password) | ||||
| { | ||||
| 	nano::system system (2); | ||||
| 	nano::test::system system (2); | ||||
| 	auto wallet1 (system.wallet (0)); | ||||
| 	auto wallet2 (system.wallet (1)); | ||||
| 	nano::keypair key1; | ||||
|  | @ -623,7 +623,7 @@ TEST (wallet_store, fail_import_bad_password) | |||
| 
 | ||||
| TEST (wallet_store, fail_import_corrupt) | ||||
| { | ||||
| 	nano::system system (2); | ||||
| 	nano::test::system system (2); | ||||
| 	auto wallet1 (system.wallet (1)); | ||||
| 	std::string json; | ||||
| 	auto error (wallet1->import (json, "1")); | ||||
|  | @ -633,7 +633,7 @@ TEST (wallet_store, fail_import_corrupt) | |||
| // Test work is precached when a key is inserted
 | ||||
| TEST (wallet, work) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto wallet (system.wallet (0)); | ||||
| 	wallet->insert_adhoc (nano::dev::genesis_key.prv); | ||||
| 	wallet->insert_adhoc (nano::dev::genesis_key.prv); | ||||
|  | @ -653,7 +653,7 @@ TEST (wallet, work) | |||
| 
 | ||||
| TEST (wallet, work_generate) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node1 (*system.nodes[0]); | ||||
| 	auto wallet (system.wallet (0)); | ||||
| 	nano::uint128_t amount1 (node1.balance (nano::dev::genesis_key.pub)); | ||||
|  | @ -681,7 +681,7 @@ TEST (wallet, work_generate) | |||
| 
 | ||||
| TEST (wallet, work_cache_delayed) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node1 (*system.nodes[0]); | ||||
| 	auto wallet (system.wallet (0)); | ||||
| 	uint64_t work1; | ||||
|  | @ -713,7 +713,7 @@ TEST (wallet, work_cache_delayed) | |||
| 
 | ||||
| TEST (wallet, insert_locked) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto wallet (system.wallet (0)); | ||||
| 	{ | ||||
| 		auto transaction (wallet->wallets.tx_begin_write ()); | ||||
|  | @ -804,7 +804,7 @@ TEST (wallet, reseed) | |||
| 
 | ||||
| TEST (wallet, insert_deterministic_locked) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto wallet (system.wallet (0)); | ||||
| 	auto transaction (wallet->wallets.tx_begin_write ()); | ||||
| 	wallet->store.rekey (transaction, "1"); | ||||
|  | @ -816,7 +816,7 @@ TEST (wallet, insert_deterministic_locked) | |||
| 
 | ||||
| TEST (wallet, no_work) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv, false); | ||||
| 	nano::keypair key2; | ||||
| 	auto block (system.wallet (0)->send_action (nano::dev::genesis_key.pub, key2.pub, std::numeric_limits<nano::uint128_t>::max (), false)); | ||||
|  | @ -831,7 +831,7 @@ TEST (wallet, no_work) | |||
| 
 | ||||
| TEST (wallet, send_race) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
| 	nano::keypair key2; | ||||
| 	for (auto i (1); i < 60; ++i) | ||||
|  | @ -843,7 +843,7 @@ TEST (wallet, send_race) | |||
| 
 | ||||
| TEST (wallet, password_race) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	nano::thread_runner runner (system.io_ctx, system.nodes[0]->config.io_threads); | ||||
| 	auto wallet = system.wallet (0); | ||||
| 	std::thread thread ([&wallet] () { | ||||
|  | @ -871,7 +871,7 @@ TEST (wallet, password_race) | |||
| 
 | ||||
| TEST (wallet, password_race_corrupt_seed) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	nano::thread_runner runner (system.io_ctx, system.nodes[0]->config.io_threads); | ||||
| 	auto wallet = system.wallet (0); | ||||
| 	nano::raw_key seed; | ||||
|  | @ -941,7 +941,7 @@ TEST (wallet, password_race_corrupt_seed) | |||
| 
 | ||||
| TEST (wallet, change_seed) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto wallet (system.wallet (0)); | ||||
| 	wallet->enter_initial_password (); | ||||
| 	nano::raw_key seed1; | ||||
|  | @ -967,7 +967,7 @@ TEST (wallet, change_seed) | |||
| 
 | ||||
| TEST (wallet, deterministic_restore) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto wallet (system.wallet (0)); | ||||
| 	wallet->enter_initial_password (); | ||||
| 	nano::raw_key seed1; | ||||
|  | @ -998,7 +998,7 @@ TEST (wallet, deterministic_restore) | |||
| 
 | ||||
| TEST (wallet, epoch_2_validation) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node (*system.nodes[0]); | ||||
| 	auto & wallet (*system.wallet (0)); | ||||
| 
 | ||||
|  | @ -1043,7 +1043,7 @@ TEST (wallet, epoch_2_receive_propagation) | |||
| 	auto const max_tries = 20; | ||||
| 	while (++tries < max_tries) | ||||
| 	{ | ||||
| 		nano::system system; | ||||
| 		nano::test::system system; | ||||
| 		nano::node_flags node_flags; | ||||
| 		node_flags.disable_request_loop = true; | ||||
| 		auto & node (*system.add_node (node_flags)); | ||||
|  | @ -1093,7 +1093,7 @@ TEST (wallet, epoch_2_receive_unopened) | |||
| 	auto const max_tries = 20; | ||||
| 	while (++tries < max_tries) | ||||
| 	{ | ||||
| 		nano::system system; | ||||
| 		nano::test::system system; | ||||
| 		nano::node_flags node_flags; | ||||
| 		node_flags.disable_request_loop = true; | ||||
| 		auto & node (*system.add_node (node_flags)); | ||||
|  | @ -1143,7 +1143,7 @@ TEST (wallet, epoch_2_receive_unopened) | |||
|  */ | ||||
| TEST (wallet, foreach_representative_deadlock) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node (*system.nodes[0]); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
| 	node.wallets.compute_reps (); | ||||
|  | @ -1162,8 +1162,8 @@ TEST (wallet, foreach_representative_deadlock) | |||
| 
 | ||||
| TEST (wallet, search_receivable) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.enable_voting = false; | ||||
| 	config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	nano::node_flags flags; | ||||
|  | @ -1214,12 +1214,12 @@ TEST (wallet, search_receivable) | |||
| 
 | ||||
| TEST (wallet, receive_pruned) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_request_loop = true; | ||||
| 	auto & node1 = *system.add_node (node_flags); | ||||
| 	node_flags.enable_pruning = true; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.enable_voting = false; // Remove after allowing pruned voting
 | ||||
| 	auto & node2 = *system.add_node (config, node_flags); | ||||
| 
 | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ using namespace std::chrono_literals; | |||
| 
 | ||||
| TEST (wallets, open_create) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	bool error (false); | ||||
| 	nano::wallets wallets (error, *system.nodes[0]); | ||||
| 	ASSERT_FALSE (error); | ||||
|  | @ -22,7 +22,7 @@ TEST (wallets, open_create) | |||
| 
 | ||||
| TEST (wallets, open_existing) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto id (nano::random_wallet_id ()); | ||||
| 	{ | ||||
| 		bool error (false); | ||||
|  | @ -52,7 +52,7 @@ TEST (wallets, open_existing) | |||
| 
 | ||||
| TEST (wallets, remove) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	nano::wallet_id one (1); | ||||
| 	{ | ||||
| 		bool error (false); | ||||
|  | @ -75,7 +75,7 @@ TEST (wallets, remove) | |||
| 
 | ||||
| TEST (wallets, reload) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node1 (*system.nodes[0]); | ||||
| 	nano::wallet_id one (1); | ||||
| 	bool error (false); | ||||
|  | @ -93,7 +93,7 @@ TEST (wallets, reload) | |||
| 
 | ||||
| TEST (wallets, vote_minimum) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node1 (*system.nodes[0]); | ||||
| 	nano::keypair key1; | ||||
| 	nano::keypair key2; | ||||
|  | @ -157,7 +157,7 @@ TEST (wallets, vote_minimum) | |||
| 
 | ||||
| TEST (wallets, exists) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node (*system.nodes[0]); | ||||
| 	nano::keypair key1; | ||||
| 	nano::keypair key2; | ||||
|  | @ -184,8 +184,8 @@ TEST (wallets, search_receivable) | |||
| { | ||||
| 	for (auto search_all : { false, true }) | ||||
| 	{ | ||||
| 		nano::system system; | ||||
| 		nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 		nano::test::system system; | ||||
| 		nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 		config.enable_voting = false; | ||||
| 		config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 		nano::node_flags flags; | ||||
|  |  | |||
|  | @ -20,10 +20,10 @@ using namespace std::chrono_literals; | |||
| // Tests clients subscribing multiple times or unsubscribing without a subscription
 | ||||
| TEST (websocket, subscription_edge) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.websocket_config.enabled = true; | ||||
| 	config.websocket_config.port = nano::get_available_port (); | ||||
| 	config.websocket_config.port = nano::test::get_available_port (); | ||||
| 	auto node1 (system.add_node (config)); | ||||
| 
 | ||||
| 	ASSERT_EQ (0, node1->websocket_server->subscriber_count (nano::websocket::topic::confirmation)); | ||||
|  | @ -51,10 +51,10 @@ TEST (websocket, subscription_edge) | |||
| // Subscribes to block confirmations, confirms a block and then awaits websocket notification
 | ||||
| TEST (websocket, confirmation) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.websocket_config.enabled = true; | ||||
| 	config.websocket_config.port = nano::get_available_port (); | ||||
| 	config.websocket_config.port = nano::test::get_available_port (); | ||||
| 	auto node1 (system.add_node (config)); | ||||
| 
 | ||||
| 	std::atomic<bool> ack_ready{ false }; | ||||
|  | @ -127,10 +127,10 @@ TEST (websocket, confirmation) | |||
| // Tests getting notification of a started election
 | ||||
| TEST (websocket, started_election) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.websocket_config.enabled = true; | ||||
| 	config.websocket_config.port = nano::get_available_port (); | ||||
| 	config.websocket_config.port = nano::test::get_available_port (); | ||||
| 	auto node1 = system.add_node (config); | ||||
| 
 | ||||
| 	std::atomic<bool> ack_ready{ false }; | ||||
|  | @ -175,10 +175,10 @@ TEST (websocket, started_election) | |||
| // Tests getting notification of an erased election
 | ||||
| TEST (websocket, stopped_election) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.websocket_config.enabled = true; | ||||
| 	config.websocket_config.port = nano::get_available_port (); | ||||
| 	config.websocket_config.port = nano::test::get_available_port (); | ||||
| 	auto node1 (system.add_node (config)); | ||||
| 
 | ||||
| 	std::atomic<bool> ack_ready{ false }; | ||||
|  | @ -226,10 +226,10 @@ TEST (websocket, stopped_election) | |||
| // Tests the filtering options of block confirmations
 | ||||
| TEST (websocket, confirmation_options) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.websocket_config.enabled = true; | ||||
| 	config.websocket_config.port = nano::get_available_port (); | ||||
| 	config.websocket_config.port = nano::test::get_available_port (); | ||||
| 	auto node1 (system.add_node (config)); | ||||
| 
 | ||||
| 	std::atomic<bool> ack_ready{ false }; | ||||
|  | @ -369,10 +369,10 @@ TEST (websocket, confirmation_options) | |||
| 
 | ||||
| TEST (websocket, confirmation_options_votes) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.websocket_config.enabled = true; | ||||
| 	config.websocket_config.port = nano::get_available_port (); | ||||
| 	config.websocket_config.port = nano::test::get_available_port (); | ||||
| 	auto node1 (system.add_node (config)); | ||||
| 
 | ||||
| 	std::atomic<bool> ack_ready{ false }; | ||||
|  | @ -456,10 +456,10 @@ TEST (websocket, confirmation_options_votes) | |||
| 
 | ||||
| TEST (websocket, confirmation_options_sideband) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.websocket_config.enabled = true; | ||||
| 	config.websocket_config.port = nano::get_available_port (); | ||||
| 	config.websocket_config.port = nano::test::get_available_port (); | ||||
| 	auto node1 (system.add_node (config)); | ||||
| 
 | ||||
| 	std::atomic<bool> ack_ready{ false }; | ||||
|  | @ -526,10 +526,10 @@ TEST (websocket, confirmation_options_sideband) | |||
| // Tests updating options of block confirmations
 | ||||
| TEST (websocket, confirmation_options_update) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.websocket_config.enabled = true; | ||||
| 	config.websocket_config.port = nano::get_available_port (); | ||||
| 	config.websocket_config.port = nano::test::get_available_port (); | ||||
| 	auto node1 (system.add_node (config)); | ||||
| 
 | ||||
| 	std::atomic<bool> added{ false }; | ||||
|  | @ -601,10 +601,10 @@ TEST (websocket, confirmation_options_update) | |||
| // Subscribes to votes, sends a block and awaits websocket notification of a vote arrival
 | ||||
| TEST (websocket, vote) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.websocket_config.enabled = true; | ||||
| 	config.websocket_config.port = nano::get_available_port (); | ||||
| 	config.websocket_config.port = nano::test::get_available_port (); | ||||
| 	auto node1 (system.add_node (config)); | ||||
| 
 | ||||
| 	std::atomic<bool> ack_ready{ false }; | ||||
|  | @ -651,10 +651,10 @@ TEST (websocket, vote) | |||
| // Tests vote subscription options - vote type
 | ||||
| TEST (websocket, vote_options_type) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.websocket_config.enabled = true; | ||||
| 	config.websocket_config.port = nano::get_available_port (); | ||||
| 	config.websocket_config.port = nano::test::get_available_port (); | ||||
| 	auto node1 (system.add_node (config)); | ||||
| 
 | ||||
| 	std::atomic<bool> ack_ready{ false }; | ||||
|  | @ -692,10 +692,10 @@ TEST (websocket, vote_options_type) | |||
| // Tests vote subscription options - list of representatives
 | ||||
| TEST (websocket, vote_options_representatives) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.websocket_config.enabled = true; | ||||
| 	config.websocket_config.port = nano::get_available_port (); | ||||
| 	config.websocket_config.port = nano::test::get_available_port (); | ||||
| 	auto node1 (system.add_node (config)); | ||||
| 
 | ||||
| 	std::atomic<bool> ack_ready{ false }; | ||||
|  | @ -767,10 +767,10 @@ TEST (websocket, vote_options_representatives) | |||
| // Test client subscribing to notifications for work generation
 | ||||
| TEST (websocket, work) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.websocket_config.enabled = true; | ||||
| 	config.websocket_config.port = nano::get_available_port (); | ||||
| 	config.websocket_config.port = nano::test::get_available_port (); | ||||
| 	auto node1 (system.add_node (config)); | ||||
| 
 | ||||
| 	ASSERT_EQ (0, node1->websocket_server->subscriber_count (nano::websocket::topic::work)); | ||||
|  | @ -837,10 +837,10 @@ TEST (websocket, work) | |||
| // Test client subscribing to notifications for bootstrap
 | ||||
| TEST (websocket, bootstrap) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.websocket_config.enabled = true; | ||||
| 	config.websocket_config.port = nano::get_available_port (); | ||||
| 	config.websocket_config.port = nano::test::get_available_port (); | ||||
| 	auto node1 (system.add_node (config)); | ||||
| 
 | ||||
| 	ASSERT_EQ (0, node1->websocket_server->subscriber_count (nano::websocket::topic::bootstrap)); | ||||
|  | @ -887,15 +887,15 @@ TEST (websocket, bootstrap) | |||
| 
 | ||||
| TEST (websocket, bootstrap_exited) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.websocket_config.enabled = true; | ||||
| 	config.websocket_config.port = nano::get_available_port (); | ||||
| 	config.websocket_config.port = nano::test::get_available_port (); | ||||
| 	auto node1 (system.add_node (config)); | ||||
| 
 | ||||
| 	// Start bootstrap, exit after subscription
 | ||||
| 	std::atomic<bool> bootstrap_started{ false }; | ||||
| 	nano::util::counted_completion subscribed_completion (1); | ||||
| 	nano::test::counted_completion subscribed_completion (1); | ||||
| 	std::thread bootstrap_thread ([node1, &system, &bootstrap_started, &subscribed_completion] () { | ||||
| 		std::shared_ptr<nano::bootstrap_attempt> attempt; | ||||
| 		while (attempt == nullptr) | ||||
|  | @ -952,10 +952,10 @@ TEST (websocket, bootstrap_exited) | |||
| // Tests sending keepalive
 | ||||
| TEST (websocket, ws_keepalive) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.websocket_config.enabled = true; | ||||
| 	config.websocket_config.port = nano::get_available_port (); | ||||
| 	config.websocket_config.port = nano::test::get_available_port (); | ||||
| 	auto node1 (system.add_node (config)); | ||||
| 
 | ||||
| 	auto task = ([&node1] () { | ||||
|  | @ -971,20 +971,20 @@ TEST (websocket, ws_keepalive) | |||
| // Tests sending telemetry
 | ||||
| TEST (websocket, telemetry) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.websocket_config.enabled = true; | ||||
| 	config.websocket_config.port = nano::get_available_port (); | ||||
| 	config.websocket_config.port = nano::test::get_available_port (); | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_initial_telemetry_requests = true; | ||||
| 	node_flags.disable_ongoing_telemetry_requests = true; | ||||
| 	auto node1 (system.add_node (config, node_flags)); | ||||
| 	config.peering_port = nano::get_available_port (); | ||||
| 	config.peering_port = nano::test::get_available_port (); | ||||
| 	config.websocket_config.enabled = true; | ||||
| 	config.websocket_config.port = nano::get_available_port (); | ||||
| 	config.websocket_config.port = nano::test::get_available_port (); | ||||
| 	auto node2 (system.add_node (config, node_flags)); | ||||
| 
 | ||||
| 	wait_peer_connections (system); | ||||
| 	nano::test::wait_peer_connections (system); | ||||
| 
 | ||||
| 	std::atomic<bool> done{ false }; | ||||
| 	auto task = ([config = node1->config, &node1, &done] () { | ||||
|  | @ -1019,7 +1019,7 @@ TEST (websocket, telemetry) | |||
| 	nano::jsonconfig telemetry_contents (contents); | ||||
| 	nano::telemetry_data telemetry_data; | ||||
| 	telemetry_data.deserialize_json (telemetry_contents, false); | ||||
| 	compare_default_telemetry_response_data (telemetry_data, node2->network_params, node2->config.bandwidth_limit, node2->default_difficulty (nano::work_version::work_1), node2->node_id); | ||||
| 	nano::test::compare_default_telemetry_response_data (telemetry_data, node2->network_params, node2->config.bandwidth_limit, node2->default_difficulty (nano::work_version::work_1), node2->node_id); | ||||
| 
 | ||||
| 	ASSERT_EQ (contents.get<std::string> ("address"), node2->network.endpoint ().address ().to_string ()); | ||||
| 	ASSERT_EQ (contents.get<uint16_t> ("port"), node2->network.endpoint ().port ()); | ||||
|  | @ -1030,10 +1030,10 @@ TEST (websocket, telemetry) | |||
| 
 | ||||
| TEST (websocket, new_unconfirmed_block) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config config (nano::test::get_available_port (), system.logging); | ||||
| 	config.websocket_config.enabled = true; | ||||
| 	config.websocket_config.port = nano::get_available_port (); | ||||
| 	config.websocket_config.port = nano::test::get_available_port (); | ||||
| 	auto node1 (system.add_node (config)); | ||||
| 
 | ||||
| 	std::atomic<bool> ack_ready{ false }; | ||||
|  |  | |||
|  | @ -13,7 +13,7 @@ void force_nano_dev_network (); | |||
| } | ||||
| namespace | ||||
| { | ||||
| std::shared_ptr<nano::system> system0; | ||||
| std::shared_ptr<nano::test::system> system0; | ||||
| std::shared_ptr<nano::node> node0; | ||||
| 
 | ||||
| class fuzz_visitor : public nano::message_visitor | ||||
|  | @ -63,7 +63,7 @@ void fuzz_message_parser (uint8_t const * Data, size_t Size) | |||
| 	{ | ||||
| 		nano::force_nano_dev_network (); | ||||
| 		initialized = true; | ||||
| 		system0 = std::make_shared<nano::system> (1); | ||||
| 		system0 = std::make_shared<nano::test::system> (1); | ||||
| 		node0 = system0->nodes[0]; | ||||
| 	} | ||||
| 
 | ||||
|  |  | |||
|  | @ -6,7 +6,10 @@ | |||
| QApplication * test_application = nullptr; | ||||
| namespace nano | ||||
| { | ||||
| void cleanup_dev_directories_on_exit (); | ||||
| namespace test | ||||
| { | ||||
| 	void cleanup_dev_directories_on_exit (); | ||||
| } | ||||
| void force_nano_dev_network (); | ||||
| } | ||||
| 
 | ||||
|  | @ -18,6 +21,6 @@ int main (int argc, char ** argv) | |||
| 	test_application = &application; | ||||
| 	testing::InitGoogleTest (&argc, argv); | ||||
| 	auto res = RUN_ALL_TESTS (); | ||||
| 	nano::cleanup_dev_directories_on_exit (); | ||||
| 	nano::test::cleanup_dev_directories_on_exit (); | ||||
| 	return res; | ||||
| } | ||||
|  |  | |||
|  | @ -17,7 +17,7 @@ extern QApplication * test_application; | |||
| TEST (wallet, construction) | ||||
| { | ||||
| 	nano_qt::eventloop_processor processor; | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto wallet_l (system.nodes[0]->wallets.create (nano::random_wallet_id ())); | ||||
| 	auto key (wallet_l->deterministic_insert ()); | ||||
| 	auto wallet (std::make_shared<nano_qt::wallet> (*test_application, processor, *system.nodes[0], wallet_l, key)); | ||||
|  | @ -34,7 +34,7 @@ TEST (wallet, construction) | |||
| TEST (wallet, DISABLED_status) | ||||
| { | ||||
| 	nano_qt::eventloop_processor processor; | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto wallet_l (system.nodes[0]->wallets.create (nano::random_wallet_id ())); | ||||
| 	nano::keypair key; | ||||
| 	wallet_l->insert_adhoc (key.prv); | ||||
|  | @ -66,7 +66,7 @@ TEST (wallet, DISABLED_status) | |||
| TEST (wallet, status_with_peer) | ||||
| { | ||||
| 	nano_qt::eventloop_processor processor; | ||||
| 	nano::system system (2); | ||||
| 	nano::test::system system (2); | ||||
| 	auto wallet_l = system.nodes[0]->wallets.create (nano::random_wallet_id ()); | ||||
| 	nano::keypair key; | ||||
| 	wallet_l->insert_adhoc (key.prv); | ||||
|  | @ -96,7 +96,7 @@ TEST (wallet, status_with_peer) | |||
| TEST (wallet, startup_balance) | ||||
| { | ||||
| 	nano_qt::eventloop_processor processor; | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto wallet_l (system.nodes[0]->wallets.create (nano::random_wallet_id ())); | ||||
| 	nano::keypair key; | ||||
| 	wallet_l->insert_adhoc (key.prv); | ||||
|  | @ -110,7 +110,7 @@ TEST (wallet, startup_balance) | |||
| TEST (wallet, select_account) | ||||
| { | ||||
| 	nano_qt::eventloop_processor processor; | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto wallet_l (system.nodes[0]->wallets.create (nano::random_wallet_id ())); | ||||
| 	nano::public_key key1 (wallet_l->deterministic_insert ()); | ||||
| 	nano::public_key key2 (wallet_l->deterministic_insert ()); | ||||
|  | @ -142,7 +142,7 @@ TEST (wallet, select_account) | |||
| TEST (wallet, main) | ||||
| { | ||||
| 	nano_qt::eventloop_processor processor; | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto wallet_l (system.nodes[0]->wallets.create (nano::random_wallet_id ())); | ||||
| 	nano::keypair key; | ||||
| 	wallet_l->insert_adhoc (key.prv); | ||||
|  | @ -173,7 +173,7 @@ TEST (wallet, main) | |||
| TEST (wallet, password_change) | ||||
| { | ||||
| 	nano_qt::eventloop_processor processor; | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	nano::account account; | ||||
| 	system.wallet (0)->insert_adhoc (nano::keypair ().prv); | ||||
| 	{ | ||||
|  | @ -209,7 +209,7 @@ TEST (wallet, password_change) | |||
| TEST (client, password_nochange) | ||||
| { | ||||
| 	nano_qt::eventloop_processor processor; | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	nano::account account; | ||||
| 	system.wallet (0)->insert_adhoc (nano::keypair ().prv); | ||||
| 	{ | ||||
|  | @ -253,7 +253,7 @@ TEST (client, password_nochange) | |||
| TEST (wallet, enter_password) | ||||
| { | ||||
| 	nano_qt::eventloop_processor processor; | ||||
| 	nano::system system (2); | ||||
| 	nano::test::system system (2); | ||||
| 	nano::account account; | ||||
| 	system.wallet (0)->insert_adhoc (nano::keypair ().prv); | ||||
| 	{ | ||||
|  | @ -290,7 +290,7 @@ TEST (wallet, enter_password) | |||
| TEST (wallet, send) | ||||
| { | ||||
| 	nano_qt::eventloop_processor processor; | ||||
| 	nano::system system (2); | ||||
| 	nano::test::system system (2); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
| 	nano::public_key key1 (system.wallet (1)->insert_adhoc (nano::keypair ().prv)); | ||||
| 	auto account (nano::dev::genesis_key.pub); | ||||
|  | @ -323,7 +323,7 @@ TEST (wallet, send) | |||
| TEST (wallet, send_locked) | ||||
| { | ||||
| 	nano_qt::eventloop_processor processor; | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
| 	nano::keypair key1; | ||||
| 	{ | ||||
|  | @ -351,7 +351,7 @@ TEST (wallet, send_locked) | |||
| TEST (wallet, DISABLED_process_block) | ||||
| { | ||||
| 	nano_qt::eventloop_processor processor; | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	nano::account account; | ||||
| 	nano::block_hash latest (system.nodes[0]->latest (nano::dev::genesis->account ())); | ||||
| 	system.wallet (0)->insert_adhoc (nano::keypair ().prv); | ||||
|  | @ -396,7 +396,7 @@ TEST (wallet, create_send) | |||
| { | ||||
| 	nano_qt::eventloop_processor processor; | ||||
| 	nano::keypair key; | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
| 	system.wallet (0)->insert_adhoc (key.prv); | ||||
| 	auto account (nano::dev::genesis_key.pub); | ||||
|  | @ -426,7 +426,7 @@ TEST (wallet, create_open_receive) | |||
| { | ||||
| 	nano_qt::eventloop_processor processor; | ||||
| 	nano::keypair key; | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
| 	system.wallet (0)->send_action (nano::dev::genesis_key.pub, key.pub, 100); | ||||
| 	nano::block_hash latest1 (system.nodes[0]->latest (nano::dev::genesis_key.pub)); | ||||
|  | @ -475,7 +475,7 @@ TEST (wallet, create_change) | |||
| { | ||||
| 	nano_qt::eventloop_processor processor; | ||||
| 	nano::keypair key; | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
| 	auto account (nano::dev::genesis_key.pub); | ||||
| 	auto wallet (std::make_shared<nano_qt::wallet> (*test_application, processor, *system.nodes[0], system.wallet (0), account)); | ||||
|  | @ -508,7 +508,7 @@ TEST (history, short_text) | |||
| 	} | ||||
| 	nano_qt::eventloop_processor processor; | ||||
| 	nano::keypair key; | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	system.wallet (0)->insert_adhoc (key.prv); | ||||
| 	nano::account account; | ||||
| 	{ | ||||
|  | @ -545,7 +545,7 @@ TEST (history, pruned_source) | |||
| 	} | ||||
| 	nano_qt::eventloop_processor processor; | ||||
| 	nano::keypair key; | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	system.wallet (0)->insert_adhoc (key.prv); | ||||
| 	nano::account account; | ||||
| 	{ | ||||
|  | @ -611,7 +611,7 @@ TEST (wallet, startup_work) | |||
| { | ||||
| 	nano_qt::eventloop_processor processor; | ||||
| 	nano::keypair key; | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	system.wallet (0)->insert_adhoc (key.prv); | ||||
| 	nano::account account; | ||||
| 	{ | ||||
|  | @ -643,7 +643,7 @@ TEST (wallet, block_viewer) | |||
| { | ||||
| 	nano_qt::eventloop_processor processor; | ||||
| 	nano::keypair key; | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	system.wallet (0)->insert_adhoc (key.prv); | ||||
| 	nano::account account; | ||||
| 	{ | ||||
|  | @ -667,7 +667,7 @@ TEST (wallet, block_viewer) | |||
| TEST (wallet, import) | ||||
| { | ||||
| 	nano_qt::eventloop_processor processor; | ||||
| 	nano::system system (2); | ||||
| 	nano::test::system system (2); | ||||
| 	std::string json; | ||||
| 	nano::keypair key1; | ||||
| 	nano::keypair key2; | ||||
|  | @ -701,7 +701,7 @@ TEST (wallet, import) | |||
| TEST (wallet, republish) | ||||
| { | ||||
| 	nano_qt::eventloop_processor processor; | ||||
| 	nano::system system (2); | ||||
| 	nano::test::system system (2); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
| 	nano::keypair key; | ||||
| 	nano::block_hash hash; | ||||
|  | @ -732,7 +732,7 @@ TEST (wallet, republish) | |||
| TEST (wallet, ignore_empty_adhoc) | ||||
| { | ||||
| 	nano_qt::eventloop_processor processor; | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	nano::keypair key1; | ||||
| 	system.wallet (0)->insert_adhoc (key1.prv); | ||||
| 	auto wallet (std::make_shared<nano_qt::wallet> (*test_application, processor, *system.nodes[0], system.wallet (0), key1.pub)); | ||||
|  | @ -759,7 +759,7 @@ TEST (wallet, ignore_empty_adhoc) | |||
| TEST (wallet, change_seed) | ||||
| { | ||||
| 	nano_qt::eventloop_processor processor; | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto key1 (system.wallet (0)->deterministic_insert ()); | ||||
| 	system.wallet (0)->deterministic_insert (); | ||||
| 	nano::raw_key seed3; | ||||
|  | @ -812,7 +812,7 @@ TEST (wallet, change_seed) | |||
| TEST (wallet, seed_work_generation) | ||||
| { | ||||
| 	nano_qt::eventloop_processor processor; | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto key1 (system.wallet (0)->deterministic_insert ()); | ||||
| 	auto wallet (std::make_shared<nano_qt::wallet> (*test_application, processor, *system.nodes[0], system.wallet (0), key1)); | ||||
| 	wallet->start (); | ||||
|  | @ -844,7 +844,7 @@ TEST (wallet, seed_work_generation) | |||
| TEST (wallet, backup_seed) | ||||
| { | ||||
| 	nano_qt::eventloop_processor processor; | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto key1 (system.wallet (0)->deterministic_insert ()); | ||||
| 	auto wallet (std::make_shared<nano_qt::wallet> (*test_application, processor, *system.nodes[0], system.wallet (0), key1)); | ||||
| 	wallet->start (); | ||||
|  | @ -862,7 +862,7 @@ TEST (wallet, backup_seed) | |||
| TEST (wallet, import_locked) | ||||
| { | ||||
| 	nano_qt::eventloop_processor processor; | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto key1 (system.wallet (0)->deterministic_insert ()); | ||||
| 	{ | ||||
| 		auto transaction (system.wallet (0)->wallets.tx_begin_write ()); | ||||
|  | @ -900,8 +900,8 @@ TEST (wallet, import_locked) | |||
| TEST (wallet, DISABLED_synchronizing) | ||||
| { | ||||
| 	nano_qt::eventloop_processor processor; | ||||
| 	nano::system system0 (1); | ||||
| 	nano::system system1 (1); | ||||
| 	nano::test::system system0 (1); | ||||
| 	nano::test::system system1 (1); | ||||
| 	auto key1 (system0.wallet (0)->deterministic_insert ()); | ||||
| 	auto wallet (std::make_shared<nano_qt::wallet> (*test_application, processor, *system0.nodes[0], system0.wallet (0), key1)); | ||||
| 	wallet->start (); | ||||
|  | @ -932,7 +932,7 @@ TEST (wallet, DISABLED_synchronizing) | |||
| TEST (wallet, epoch_2_validation) | ||||
| { | ||||
| 	nano_qt::eventloop_processor processor; | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node = system.nodes[0]; | ||||
| 
 | ||||
| 	// Upgrade the genesis account to epoch 2
 | ||||
|  |  | |||
|  | @ -4,7 +4,10 @@ | |||
| #include <gtest/gtest.h> | ||||
| namespace nano | ||||
| { | ||||
| void cleanup_dev_directories_on_exit (); | ||||
| namespace test | ||||
| { | ||||
| 	void cleanup_dev_directories_on_exit (); | ||||
| } | ||||
| void force_nano_dev_network (); | ||||
| } | ||||
| 
 | ||||
|  | @ -15,6 +18,6 @@ int main (int argc, char ** argv) | |||
| 	nano::node_singleton_memory_pool_purge_guard cleanup_guard; | ||||
| 	testing::InitGoogleTest (&argc, argv); | ||||
| 	auto res = RUN_ALL_TESTS (); | ||||
| 	nano::cleanup_dev_directories_on_exit (); | ||||
| 	nano::test::cleanup_dev_directories_on_exit (); | ||||
| 	return res; | ||||
| } | ||||
|  |  | |||
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							|  | @ -3,7 +3,10 @@ | |||
| #include <gtest/gtest.h> | ||||
| namespace nano | ||||
| { | ||||
| void cleanup_dev_directories_on_exit (); | ||||
| namespace test | ||||
| { | ||||
| 	void cleanup_dev_directories_on_exit (); | ||||
| } | ||||
| void force_nano_dev_network (); | ||||
| } | ||||
| 
 | ||||
|  | @ -13,6 +16,6 @@ int main (int argc, char ** argv) | |||
| 	nano::node_singleton_memory_pool_purge_guard memory_pool_cleanup_guard; | ||||
| 	testing::InitGoogleTest (&argc, argv); | ||||
| 	auto res = RUN_ALL_TESTS (); | ||||
| 	nano::cleanup_dev_directories_on_exit (); | ||||
| 	nano::test::cleanup_dev_directories_on_exit (); | ||||
| 	return res; | ||||
| } | ||||
|  |  | |||
|  | @ -36,8 +36,8 @@ size_t manually_count_pruned_blocks (nano::store & store) | |||
| 
 | ||||
| TEST (system, generate_mass_activity) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.enable_voting = false; // Prevent blocks cementing
 | ||||
| 	auto node = system.add_node (node_config); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
|  | @ -51,8 +51,8 @@ TEST (system, generate_mass_activity) | |||
| 
 | ||||
| TEST (system, generate_mass_activity_long) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.enable_voting = false; // Prevent blocks cementing
 | ||||
| 	auto node = system.add_node (node_config); | ||||
| 	nano::thread_runner runner (system.io_ctx, system.nodes[0]->config.io_threads); | ||||
|  | @ -77,8 +77,8 @@ TEST (system, receive_while_synchronizing) | |||
| { | ||||
| 	std::vector<boost::thread> threads; | ||||
| 	{ | ||||
| 		nano::system system; | ||||
| 		nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 		nano::test::system system; | ||||
| 		nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 		node_config.enable_voting = false; // Prevent blocks cementing
 | ||||
| 		auto node = system.add_node (node_config); | ||||
| 		nano::thread_runner runner (system.io_ctx, system.nodes[0]->config.io_threads); | ||||
|  | @ -86,14 +86,14 @@ TEST (system, receive_while_synchronizing) | |||
| 		uint32_t count (1000); | ||||
| 		system.generate_mass_activity (count, *system.nodes[0]); | ||||
| 		nano::keypair key; | ||||
| 		auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 		auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::test::get_available_port (), nano::unique_path (), system.logging, system.work)); | ||||
| 		ASSERT_FALSE (node1->init_error ()); | ||||
| 		auto wallet (node1->wallets.create (1)); | ||||
| 		wallet->insert_adhoc (nano::dev::genesis_key.prv); // For voting
 | ||||
| 		ASSERT_EQ (key.pub, wallet->insert_adhoc (key.prv)); | ||||
| 		node1->start (); | ||||
| 		system.nodes.push_back (node1); | ||||
| 		ASSERT_NE (nullptr, nano::establish_tcp (system, *node1, node->network.endpoint ())); | ||||
| 		ASSERT_NE (nullptr, nano::test::establish_tcp (system, *node1, node->network.endpoint ())); | ||||
| 		node1->workers.add_timed_task (std::chrono::steady_clock::now () + std::chrono::milliseconds (200), ([&system, &key] () { | ||||
| 			auto hash (system.wallet (0)->send_sync (nano::dev::genesis_key.pub, key.pub, system.nodes[0]->config.receive_minimum.number ())); | ||||
| 			auto transaction (system.nodes[0]->store.tx_begin_read ()); | ||||
|  | @ -186,7 +186,7 @@ TEST (wallet, multithreaded_send_async) | |||
| { | ||||
| 	std::vector<boost::thread> threads; | ||||
| 	{ | ||||
| 		nano::system system (1); | ||||
| 		nano::test::system system (1); | ||||
| 		nano::keypair key; | ||||
| 		auto wallet_l (system.wallet (0)); | ||||
| 		wallet_l->insert_adhoc (nano::dev::genesis_key.prv); | ||||
|  | @ -215,7 +215,7 @@ TEST (wallet, multithreaded_send_async) | |||
| 
 | ||||
| TEST (store, load) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	std::vector<boost::thread> threads; | ||||
| 	for (auto i (0); i < 100; ++i) | ||||
| 	{ | ||||
|  | @ -250,7 +250,7 @@ TEST (node, fork_storm) | |||
| 
 | ||||
| 	nano::node_flags flags; | ||||
| 	flags.disable_max_peers_per_ip = true; | ||||
| 	nano::system system (node_count, nano::transport::transport_type::tcp, flags); | ||||
| 	nano::test::system system (node_count, nano::transport::transport_type::tcp, flags); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
| 	auto previous (system.nodes[0]->latest (nano::dev::genesis_key.pub)); | ||||
| 	auto balance (system.nodes[0]->balance (nano::dev::genesis_key.pub)); | ||||
|  | @ -473,7 +473,7 @@ TEST (broadcast, sqrt_broadcast_simulate) | |||
| 
 | ||||
| TEST (peer_container, random_set) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto old (std::chrono::steady_clock::now ()); | ||||
| 	auto current (std::chrono::steady_clock::now ()); | ||||
| 	for (auto i (0); i < 10000; ++i) | ||||
|  | @ -491,7 +491,7 @@ TEST (peer_container, random_set) | |||
| // Can take up to 2 hours
 | ||||
| TEST (store, unchecked_load) | ||||
| { | ||||
| 	nano::system system{ 1 }; | ||||
| 	nano::test::system system{ 1 }; | ||||
| 	auto & node = *system.nodes[0]; | ||||
| 	nano::block_builder builder; | ||||
| 	std::shared_ptr<nano::block> block = builder | ||||
|  | @ -513,7 +513,7 @@ TEST (store, unchecked_load) | |||
| 
 | ||||
| TEST (store, vote_load) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node (*system.nodes[0]); | ||||
| 	for (auto i (0); i < 1000000; ++i) | ||||
| 	{ | ||||
|  | @ -577,7 +577,7 @@ TEST (store, pruned_load) | |||
| 
 | ||||
| TEST (wallets, rep_scan) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node (*system.nodes[0]); | ||||
| 	auto wallet (system.wallet (0)); | ||||
| 	{ | ||||
|  | @ -595,7 +595,7 @@ TEST (wallets, rep_scan) | |||
| 
 | ||||
| TEST (node, mass_vote_by_hash) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); | ||||
| 	nano::block_hash previous (nano::dev::genesis->hash ()); | ||||
| 	nano::keypair key; | ||||
|  | @ -626,8 +626,8 @@ namespace nano | |||
| { | ||||
| TEST (confirmation_height, many_accounts_single_confirmation) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.online_weight_minimum = 100; | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto node = system.add_node (node_config); | ||||
|  | @ -711,8 +711,8 @@ TEST (confirmation_height, many_accounts_single_confirmation) | |||
| 
 | ||||
| TEST (confirmation_height, many_accounts_many_confirmations) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.online_weight_minimum = 100; | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto node = system.add_node (node_config); | ||||
|  | @ -788,8 +788,8 @@ TEST (confirmation_height, many_accounts_many_confirmations) | |||
| 
 | ||||
| TEST (confirmation_height, long_chains) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto node = system.add_node (node_config); | ||||
| 	nano::keypair key1; | ||||
|  | @ -934,8 +934,8 @@ TEST (confirmation_height, long_chains) | |||
| 
 | ||||
| TEST (confirmation_height, dynamic_algorithm) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto node = system.add_node (node_config); | ||||
| 	nano::keypair key; | ||||
|  | @ -996,8 +996,8 @@ TEST (confirmation_height, dynamic_algorithm_no_transition_while_pending) | |||
| 	// Repeat in case of intermittent issues not replicating the issue talked about above.
 | ||||
| 	for (auto _ = 0; _ < 3; ++_) | ||||
| 	{ | ||||
| 		nano::system system; | ||||
| 		nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 		nano::test::system system; | ||||
| 		nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 		node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 		nano::node_flags node_flags; | ||||
| 		node_flags.force_use_write_database_queue = true; | ||||
|  | @ -1074,8 +1074,8 @@ TEST (confirmation_height, dynamic_algorithm_no_transition_while_pending) | |||
| 
 | ||||
| TEST (confirmation_height, many_accounts_send_receive_self) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.online_weight_minimum = 100; | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	node_config.active_elections_size = 400000; | ||||
|  | @ -1238,7 +1238,7 @@ TEST (confirmation_height, many_accounts_send_receive_self_no_elections) | |||
| 	std::vector<std::shared_ptr<nano::open_block>> open_blocks; | ||||
| 
 | ||||
| 	nano::block_builder builder; | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 
 | ||||
| 	{ | ||||
| 		auto transaction (store->tx_begin_write ()); | ||||
|  | @ -1368,7 +1368,7 @@ public: | |||
| class shared_data | ||||
| { | ||||
| public: | ||||
| 	nano::util::counted_completion write_completion{ 0 }; | ||||
| 	nano::test::counted_completion write_completion{ 0 }; | ||||
| 	std::atomic<bool> done{ false }; | ||||
| }; | ||||
| 
 | ||||
|  | @ -1395,13 +1395,13 @@ void callback_process (shared_data & shared_data_a, data & data, T & all_node_da | |||
| 
 | ||||
| TEST (telemetry, ongoing_requests) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_initial_telemetry_requests = true; | ||||
| 	auto node_client = system.add_node (node_flags); | ||||
| 	auto node_server = system.add_node (node_flags); | ||||
| 
 | ||||
| 	wait_peer_connections (system); | ||||
| 	nano::test::wait_peer_connections (system); | ||||
| 
 | ||||
| 	ASSERT_EQ (0, node_client->telemetry->telemetry_data_size ()); | ||||
| 	ASSERT_EQ (0, node_server->telemetry->telemetry_data_size ()); | ||||
|  | @ -1428,7 +1428,7 @@ namespace transport | |||
| { | ||||
| 	TEST (telemetry, simultaneous_requests) | ||||
| 	{ | ||||
| 		nano::system system; | ||||
| 		nano::test::system system; | ||||
| 		nano::node_flags node_flags; | ||||
| 		node_flags.disable_initial_telemetry_requests = true; | ||||
| 		auto const num_nodes = 4; | ||||
|  | @ -1437,7 +1437,7 @@ namespace transport | |||
| 			system.add_node (node_flags); | ||||
| 		} | ||||
| 
 | ||||
| 		wait_peer_connections (system); | ||||
| 		nano::test::wait_peer_connections (system); | ||||
| 
 | ||||
| 		std::vector<std::thread> threads; | ||||
| 		auto const num_threads = 4; | ||||
|  | @ -1494,13 +1494,13 @@ namespace transport | |||
| 
 | ||||
| TEST (telemetry, under_load) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_initial_telemetry_requests = true; | ||||
| 	auto node = system.add_node (node_config, node_flags); | ||||
| 	node_config.peering_port = nano::get_available_port (); | ||||
| 	node_config.peering_port = nano::test::get_available_port (); | ||||
| 	auto node1 = system.add_node (node_config, node_flags); | ||||
| 	nano::keypair key; | ||||
| 	nano::keypair key1; | ||||
|  | @ -1583,14 +1583,14 @@ TEST (telemetry, under_load) | |||
|  */ | ||||
| TEST (telemetry, cache_read_and_timeout) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_ongoing_telemetry_requests = true; | ||||
| 	node_flags.disable_initial_telemetry_requests = true; | ||||
| 	auto node_client = system.add_node (node_flags); | ||||
| 	auto node_server = system.add_node (node_flags); | ||||
| 
 | ||||
| 	wait_peer_connections (system); | ||||
| 	nano::test::wait_peer_connections (system); | ||||
| 
 | ||||
| 	// Request telemetry metrics
 | ||||
| 	nano::telemetry_data telemetry_data; | ||||
|  | @ -1648,7 +1648,7 @@ TEST (telemetry, cache_read_and_timeout) | |||
| 
 | ||||
| TEST (telemetry, many_nodes) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::test::system system; | ||||
| 	nano::node_flags node_flags; | ||||
| 	node_flags.disable_ongoing_telemetry_requests = true; | ||||
| 	node_flags.disable_initial_telemetry_requests = true; | ||||
|  | @ -1657,7 +1657,7 @@ TEST (telemetry, many_nodes) | |||
| 	auto const num_nodes = (is_sanitizer_build || nano::running_within_valgrind ()) ? 4 : 10; | ||||
| 	for (auto i = 0; i < num_nodes; ++i) | ||||
| 	{ | ||||
| 		nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 		nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 		// Make a metric completely different for each node so we can check afterwards that there are no duplicates
 | ||||
| 		node_config.bandwidth_limit = 100000 + i; | ||||
| 
 | ||||
|  | @ -1679,7 +1679,7 @@ TEST (telemetry, many_nodes) | |||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	wait_peer_connections (system); | ||||
| 	nano::test::wait_peer_connections (system); | ||||
| 
 | ||||
| 	// Give all nodes a non-default number of blocks
 | ||||
| 	nano::keypair key; | ||||
|  | @ -1843,8 +1843,8 @@ TEST (node, mass_epoch_upgrader) | |||
| 		std::vector<info> opened (total_accounts / 2); | ||||
| 		std::vector<info> unopened (total_accounts / 2); | ||||
| 
 | ||||
| 		nano::system system; | ||||
| 		nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 		nano::test::system system; | ||||
| 		nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 		node_config.work_threads = 4; | ||||
| 		//node_config.work_peers = { { "192.168.1.101", 7000 } };
 | ||||
| 		auto & node = *system.add_node (node_config); | ||||
|  | @ -1945,8 +1945,8 @@ TEST (node, mass_epoch_upgrader) | |||
| 
 | ||||
| TEST (node, mass_block_new) | ||||
| { | ||||
| 	nano::system system; | ||||
| 	nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 	nano::test::system system; | ||||
| 	nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 	auto & node = *system.add_node (node_config); | ||||
| 	node.network_params.network.request_interval_ms = 500; | ||||
|  | @ -2075,9 +2075,9 @@ TEST (node, wallet_create_block_confirm_conflicts) | |||
| { | ||||
| 	for (int i = 0; i < 5; ++i) | ||||
| 	{ | ||||
| 		nano::system system; | ||||
| 		nano::test::system system; | ||||
| 		nano::block_builder builder; | ||||
| 		nano::node_config node_config (nano::get_available_port (), system.logging); | ||||
| 		nano::node_config node_config (nano::test::get_available_port (), system.logging); | ||||
| 		node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||
| 		auto node = system.add_node (node_config); | ||||
| 		auto const num_blocks = 10000; | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ using namespace std::chrono_literals; | |||
| // so the producer always wins. Also exercises the flush operation, so it must never deadlock.
 | ||||
| TEST (vote_processor, producer_consumer) | ||||
| { | ||||
| 	nano::system system (1); | ||||
| 	nano::test::system system (1); | ||||
| 	auto & node (*system.nodes[0]); | ||||
| 	auto channel (std::make_shared<nano::transport::inproc::channel> (node, node)); | ||||
| 
 | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ | |||
| 
 | ||||
| using namespace std::chrono_literals; | ||||
| 
 | ||||
| std::shared_ptr<nano::transport::channel_tcp> nano::establish_tcp (nano::system & system, nano::node & node, nano::endpoint const & endpoint) | ||||
| std::shared_ptr<nano::transport::channel_tcp> nano::test::establish_tcp (nano::test::system & system, nano::node & node, nano::endpoint const & endpoint) | ||||
| { | ||||
| 	debug_assert (node.network.endpoint () != endpoint && "Establishing TCP to self is not allowed"); | ||||
| 
 | ||||
|  |  | |||
|  | @ -5,7 +5,6 @@ | |||
| namespace nano | ||||
| { | ||||
| class node; | ||||
| class system; | ||||
| 
 | ||||
| namespace transport | ||||
| { | ||||
|  | @ -13,6 +12,10 @@ namespace transport | |||
| 	class channel_tcp; | ||||
| } | ||||
| 
 | ||||
| /** Waits until a TCP connection is established and returns the TCP channel on success*/ | ||||
| std::shared_ptr<nano::transport::channel_tcp> establish_tcp (nano::system &, nano::node &, nano::endpoint const &); | ||||
| namespace test | ||||
| { | ||||
| 	class system; | ||||
| 	/** 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 &); | ||||
| } | ||||
| } | ||||
|  |  | |||
|  | @ -23,13 +23,13 @@ std::string nano::error_system_messages::message (int ev) const | |||
| 	return "Invalid error code"; | ||||
| } | ||||
| 
 | ||||
| std::shared_ptr<nano::node> nano::system::add_node (nano::node_flags node_flags_a, nano::transport::transport_type type_a) | ||||
| std::shared_ptr<nano::node> nano::test::system::add_node (nano::node_flags node_flags_a, nano::transport::transport_type type_a) | ||||
| { | ||||
| 	return add_node (nano::node_config (nano::get_available_port (), logging), node_flags_a, type_a); | ||||
| 	return add_node (nano::node_config (nano::test::get_available_port (), logging), node_flags_a, type_a); | ||||
| } | ||||
| 
 | ||||
| /** Returns the node added. */ | ||||
| std::shared_ptr<nano::node> nano::system::add_node (nano::node_config const & node_config_a, nano::node_flags node_flags_a, nano::transport::transport_type type_a) | ||||
| std::shared_ptr<nano::node> nano::test::system::add_node (nano::node_config const & node_config_a, nano::node_flags node_flags_a, nano::transport::transport_type type_a) | ||||
| { | ||||
| 	auto node (std::make_shared<nano::node> (io_ctx, nano::unique_path (), node_config_a, work, node_flags_a, node_sequence++)); | ||||
| 	for (auto i : initialization_blocks) | ||||
|  | @ -110,7 +110,7 @@ std::shared_ptr<nano::node> nano::system::add_node (nano::node_config const & no | |||
| 	return node; | ||||
| } | ||||
| 
 | ||||
| nano::system::system () | ||||
| nano::test::system::system () | ||||
| { | ||||
| 	auto scale_str = std::getenv ("DEADLINE_SCALE_FACTOR"); | ||||
| 	if (scale_str) | ||||
|  | @ -120,18 +120,18 @@ nano::system::system () | |||
| 	logging.init (nano::unique_path ()); | ||||
| } | ||||
| 
 | ||||
| nano::system::system (uint16_t count_a, nano::transport::transport_type type_a, nano::node_flags flags_a) : | ||||
| nano::test::system::system (uint16_t count_a, nano::transport::transport_type type_a, nano::node_flags flags_a) : | ||||
| 	system () | ||||
| { | ||||
| 	nodes.reserve (count_a); | ||||
| 	for (uint16_t i (0); i < count_a; ++i) | ||||
| 	{ | ||||
| 		nano::node_config config (nano::get_available_port (), logging); | ||||
| 		nano::node_config config (nano::test::get_available_port (), logging); | ||||
| 		add_node (config, flags_a, type_a); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| nano::system::~system () | ||||
| nano::test::system::~system () | ||||
| { | ||||
| 	for (auto & i : nodes) | ||||
| 	{ | ||||
|  | @ -152,7 +152,7 @@ nano::system::~system () | |||
| #endif | ||||
| } | ||||
| 
 | ||||
| void nano::system::ledger_initialization_set (std::vector<nano::keypair> const & reps, nano::amount const & reserve) | ||||
| void nano::test::system::ledger_initialization_set (std::vector<nano::keypair> const & reps, nano::amount const & reserve) | ||||
| { | ||||
| 	nano::block_hash previous = nano::dev::genesis->hash (); | ||||
| 	auto amount = (nano::dev::constants.genesis_amount - reserve.number ()) / reps.size (); | ||||
|  | @ -182,7 +182,7 @@ void nano::system::ledger_initialization_set (std::vector<nano::keypair> const & | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| std::shared_ptr<nano::wallet> nano::system::wallet (size_t index_a) | ||||
| std::shared_ptr<nano::wallet> nano::test::system::wallet (size_t index_a) | ||||
| { | ||||
| 	debug_assert (nodes.size () > index_a); | ||||
| 	auto size (nodes[index_a]->wallets.items.size ()); | ||||
|  | @ -191,7 +191,7 @@ std::shared_ptr<nano::wallet> nano::system::wallet (size_t index_a) | |||
| 	return nodes[index_a]->wallets.items.begin ()->second; | ||||
| } | ||||
| 
 | ||||
| nano::account nano::system::account (nano::transaction const & transaction_a, size_t index_a) | ||||
| nano::account nano::test::system::account (nano::transaction const & transaction_a, size_t index_a) | ||||
| { | ||||
| 	auto wallet_l (wallet (index_a)); | ||||
| 	auto keys (wallet_l->store.begin (transaction_a)); | ||||
|  | @ -201,7 +201,7 @@ nano::account nano::system::account (nano::transaction const & transaction_a, si | |||
| 	return nano::account (result); | ||||
| } | ||||
| 
 | ||||
| uint64_t nano::system::work_generate_limited (nano::block_hash const & root_a, uint64_t min_a, uint64_t max_a) | ||||
| uint64_t nano::test::system::work_generate_limited (nano::block_hash const & root_a, uint64_t min_a, uint64_t max_a) | ||||
| { | ||||
| 	debug_assert (min_a > 0); | ||||
| 	uint64_t result = 0; | ||||
|  | @ -215,7 +215,7 @@ uint64_t nano::system::work_generate_limited (nano::block_hash const & root_a, u | |||
| /** Initiate an epoch upgrade. Writes the epoch block into the ledger and leaves it to
 | ||||
|  *  node background processes (e.g. frontiers confirmation) to cement the block. | ||||
|  */ | ||||
| std::unique_ptr<nano::state_block> nano::upgrade_epoch (nano::work_pool & pool_a, nano::ledger & ledger_a, nano::epoch epoch_a) | ||||
| std::unique_ptr<nano::state_block> nano::test::upgrade_epoch (nano::work_pool & pool_a, nano::ledger & ledger_a, nano::epoch epoch_a) | ||||
| { | ||||
| 	auto transaction (ledger_a.store.tx_begin_write ()); | ||||
| 	auto dev_genesis_key = nano::dev::genesis_key; | ||||
|  | @ -244,7 +244,7 @@ std::unique_ptr<nano::state_block> nano::upgrade_epoch (nano::work_pool & pool_a | |||
| 	return !error ? std::move (epoch) : nullptr; | ||||
| } | ||||
| 
 | ||||
| void nano::blocks_confirm (nano::node & node_a, std::vector<std::shared_ptr<nano::block>> const & blocks_a, bool const forced_a) | ||||
| void nano::test::blocks_confirm (nano::node & node_a, std::vector<std::shared_ptr<nano::block>> const & blocks_a, bool const forced_a) | ||||
| { | ||||
| 	// Finish processing all blocks
 | ||||
| 	node_a.block_processor.flush (); | ||||
|  | @ -264,17 +264,17 @@ void nano::blocks_confirm (nano::node & node_a, std::vector<std::shared_ptr<nano | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| std::unique_ptr<nano::state_block> nano::system::upgrade_genesis_epoch (nano::node & node_a, nano::epoch const epoch_a) | ||||
| std::unique_ptr<nano::state_block> nano::test::system::upgrade_genesis_epoch (nano::node & node_a, nano::epoch const epoch_a) | ||||
| { | ||||
| 	return upgrade_epoch (work, node_a.ledger, epoch_a); | ||||
| } | ||||
| 
 | ||||
| void nano::system::deadline_set (std::chrono::duration<double, std::nano> const & delta_a) | ||||
| void nano::test::system::deadline_set (std::chrono::duration<double, std::nano> const & delta_a) | ||||
| { | ||||
| 	deadline = std::chrono::steady_clock::now () + delta_a * deadline_scaling_factor; | ||||
| } | ||||
| 
 | ||||
| std::error_code nano::system::poll (std::chrono::nanoseconds const & wait_time) | ||||
| std::error_code nano::test::system::poll (std::chrono::nanoseconds const & wait_time) | ||||
| { | ||||
| #if NANO_ASIO_HANDLER_TRACKING == 0 | ||||
| 	io_ctx.run_one_for (wait_time); | ||||
|  | @ -302,7 +302,7 @@ std::error_code nano::system::poll (std::chrono::nanoseconds const & wait_time) | |||
| 	return ec; | ||||
| } | ||||
| 
 | ||||
| std::error_code nano::system::poll_until_true (std::chrono::nanoseconds deadline_a, std::function<bool ()> predicate_a) | ||||
| std::error_code nano::test::system::poll_until_true (std::chrono::nanoseconds deadline_a, std::function<bool ()> predicate_a) | ||||
| { | ||||
| 	std::error_code ec; | ||||
| 	deadline_set (deadline_a); | ||||
|  | @ -318,7 +318,7 @@ std::error_code nano::system::poll_until_true (std::chrono::nanoseconds deadline | |||
|  * It can be used to sleep for a duration in unit tests whilst allowing the background io contexts to continue processing. | ||||
|  * @param delay milliseconds of delay | ||||
|  */ | ||||
| void nano::system::delay_ms (std::chrono::milliseconds const & delay) | ||||
| void nano::test::system::delay_ms (std::chrono::milliseconds const & delay) | ||||
| { | ||||
| 	auto now = std::chrono::steady_clock::now (); | ||||
| 	auto endtime = now + delay; | ||||
|  | @ -334,7 +334,7 @@ namespace | |||
| class traffic_generator : public std::enable_shared_from_this<traffic_generator> | ||||
| { | ||||
| public: | ||||
| 	traffic_generator (uint32_t count_a, uint32_t wait_a, std::shared_ptr<nano::node> const & node_a, nano::system & system_a) : | ||||
| 	traffic_generator (uint32_t count_a, uint32_t wait_a, std::shared_ptr<nano::node> const & node_a, nano::test::system & system_a) : | ||||
| 		count (count_a), | ||||
| 		wait (wait_a), | ||||
| 		node (node_a), | ||||
|  | @ -356,11 +356,11 @@ public: | |||
| 	uint32_t count; | ||||
| 	uint32_t wait; | ||||
| 	std::shared_ptr<nano::node> node; | ||||
| 	nano::system & system; | ||||
| 	nano::test::system & system; | ||||
| }; | ||||
| } | ||||
| 
 | ||||
| void nano::system::generate_usage_traffic (uint32_t count_a, uint32_t wait_a) | ||||
| void nano::test::system::generate_usage_traffic (uint32_t count_a, uint32_t wait_a) | ||||
| { | ||||
| 	for (size_t i (0), n (nodes.size ()); i != n; ++i) | ||||
| 	{ | ||||
|  | @ -368,7 +368,7 @@ void nano::system::generate_usage_traffic (uint32_t count_a, uint32_t wait_a) | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| void nano::system::generate_usage_traffic (uint32_t count_a, uint32_t wait_a, size_t index_a) | ||||
| void nano::test::system::generate_usage_traffic (uint32_t count_a, uint32_t wait_a, size_t index_a) | ||||
| { | ||||
| 	debug_assert (nodes.size () > index_a); | ||||
| 	debug_assert (count_a > 0); | ||||
|  | @ -376,7 +376,7 @@ void nano::system::generate_usage_traffic (uint32_t count_a, uint32_t wait_a, si | |||
| 	generate->run (); | ||||
| } | ||||
| 
 | ||||
| void nano::system::generate_rollback (nano::node & node_a, std::vector<nano::account> & accounts_a) | ||||
| void nano::test::system::generate_rollback (nano::node & node_a, std::vector<nano::account> & accounts_a) | ||||
| { | ||||
| 	auto transaction (node_a.store.tx_begin_write ()); | ||||
| 	debug_assert (std::numeric_limits<CryptoPP::word32>::max () > accounts_a.size ()); | ||||
|  | @ -403,7 +403,7 @@ void nano::system::generate_rollback (nano::node & node_a, std::vector<nano::acc | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| void nano::system::generate_receive (nano::node & node_a) | ||||
| void nano::test::system::generate_receive (nano::node & node_a) | ||||
| { | ||||
| 	std::shared_ptr<nano::block> send_block; | ||||
| 	{ | ||||
|  | @ -424,7 +424,7 @@ void nano::system::generate_receive (nano::node & node_a) | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| void nano::system::generate_activity (nano::node & node_a, std::vector<nano::account> & accounts_a) | ||||
| void nano::test::system::generate_activity (nano::node & node_a, std::vector<nano::account> & accounts_a) | ||||
| { | ||||
| 	auto what (random_pool::generate_byte ()); | ||||
| 	if (what < 0x1) | ||||
|  | @ -453,7 +453,7 @@ void nano::system::generate_activity (nano::node & node_a, std::vector<nano::acc | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| nano::account nano::system::get_random_account (std::vector<nano::account> & accounts_a) | ||||
| nano::account nano::test::system::get_random_account (std::vector<nano::account> & accounts_a) | ||||
| { | ||||
| 	debug_assert (std::numeric_limits<CryptoPP::word32>::max () > accounts_a.size ()); | ||||
| 	auto index (random_pool::generate_word32 (0, static_cast<CryptoPP::word32> (accounts_a.size () - 1))); | ||||
|  | @ -461,7 +461,7 @@ nano::account nano::system::get_random_account (std::vector<nano::account> & acc | |||
| 	return result; | ||||
| } | ||||
| 
 | ||||
| nano::uint128_t nano::system::get_random_amount (nano::transaction const & transaction_a, nano::node & node_a, nano::account const & account_a) | ||||
| nano::uint128_t nano::test::system::get_random_amount (nano::transaction const & transaction_a, nano::node & node_a, nano::account const & account_a) | ||||
| { | ||||
| 	nano::uint128_t balance (node_a.ledger.account_balance (transaction_a, account_a)); | ||||
| 	nano::uint128_union random_amount; | ||||
|  | @ -469,7 +469,7 @@ nano::uint128_t nano::system::get_random_amount (nano::transaction const & trans | |||
| 	return (((nano::uint256_t{ random_amount.number () } * balance) / nano::uint256_t{ std::numeric_limits<nano::uint128_t>::max () }).convert_to<nano::uint128_t> ()); | ||||
| } | ||||
| 
 | ||||
| void nano::system::generate_send_existing (nano::node & node_a, std::vector<nano::account> & accounts_a) | ||||
| void nano::test::system::generate_send_existing (nano::node & node_a, std::vector<nano::account> & accounts_a) | ||||
| { | ||||
| 	nano::uint128_t amount; | ||||
| 	nano::account destination; | ||||
|  | @ -496,7 +496,7 @@ void nano::system::generate_send_existing (nano::node & node_a, std::vector<nano | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| void nano::system::generate_change_known (nano::node & node_a, std::vector<nano::account> & accounts_a) | ||||
| void nano::test::system::generate_change_known (nano::node & node_a, std::vector<nano::account> & accounts_a) | ||||
| { | ||||
| 	nano::account source (get_random_account (accounts_a)); | ||||
| 	if (!node_a.latest (source).is_zero ()) | ||||
|  | @ -508,7 +508,7 @@ void nano::system::generate_change_known (nano::node & node_a, std::vector<nano: | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| void nano::system::generate_change_unknown (nano::node & node_a, std::vector<nano::account> & accounts_a) | ||||
| void nano::test::system::generate_change_unknown (nano::node & node_a, std::vector<nano::account> & accounts_a) | ||||
| { | ||||
| 	nano::account source (get_random_account (accounts_a)); | ||||
| 	if (!node_a.latest (source).is_zero ()) | ||||
|  | @ -521,7 +521,7 @@ void nano::system::generate_change_unknown (nano::node & node_a, std::vector<nan | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| void nano::system::generate_send_new (nano::node & node_a, std::vector<nano::account> & accounts_a) | ||||
| void nano::test::system::generate_send_new (nano::node & node_a, std::vector<nano::account> & accounts_a) | ||||
| { | ||||
| 	debug_assert (node_a.wallets.items.size () == 1); | ||||
| 	nano::uint128_t amount; | ||||
|  | @ -541,7 +541,7 @@ void nano::system::generate_send_new (nano::node & node_a, std::vector<nano::acc | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| void nano::system::generate_mass_activity (uint32_t count_a, nano::node & node_a) | ||||
| void nano::test::system::generate_mass_activity (uint32_t count_a, nano::node & node_a) | ||||
| { | ||||
| 	std::vector<nano::account> accounts; | ||||
| 	auto dev_genesis_key = nano::dev::genesis_key; | ||||
|  | @ -562,7 +562,7 @@ void nano::system::generate_mass_activity (uint32_t count_a, nano::node & node_a | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| void nano::system::stop () | ||||
| void nano::test::system::stop () | ||||
| { | ||||
| 	for (auto i : nodes) | ||||
| 	{ | ||||
|  | @ -571,7 +571,7 @@ void nano::system::stop () | |||
| 	work.stop (); | ||||
| } | ||||
| 
 | ||||
| uint16_t nano::get_available_port () | ||||
| uint16_t nano::test::get_available_port () | ||||
| { | ||||
| 	// Maximum possible sockets which may feasibly be used in 1 test
 | ||||
| 	constexpr auto max = 200; | ||||
|  | @ -595,7 +595,7 @@ uint16_t nano::get_available_port () | |||
| 	return available_port; | ||||
| } | ||||
| 
 | ||||
| void nano::cleanup_dev_directories_on_exit () | ||||
| void nano::test::cleanup_dev_directories_on_exit () | ||||
| { | ||||
| 	// Makes sure everything is cleaned up
 | ||||
| 	nano::logging::release_file_sink (); | ||||
|  |  | |||
|  | @ -13,53 +13,57 @@ enum class error_system | |||
| 	generic = 1, | ||||
| 	deadline_expired | ||||
| }; | ||||
| class system final | ||||
| 
 | ||||
| namespace test | ||||
| { | ||||
| public: | ||||
| 	system (); | ||||
| 	system (uint16_t, nano::transport::transport_type = nano::transport::transport_type::tcp, nano::node_flags = nano::node_flags ()); | ||||
| 	~system (); | ||||
| 	void ledger_initialization_set (std::vector<nano::keypair> const & reps, nano::amount const & reserve = 0); | ||||
| 	void generate_activity (nano::node &, std::vector<nano::account> &); | ||||
| 	void generate_mass_activity (uint32_t, nano::node &); | ||||
| 	void generate_usage_traffic (uint32_t, uint32_t, size_t); | ||||
| 	void generate_usage_traffic (uint32_t, uint32_t); | ||||
| 	nano::account get_random_account (std::vector<nano::account> &); | ||||
| 	nano::uint128_t get_random_amount (nano::transaction const &, nano::node &, nano::account const &); | ||||
| 	void generate_rollback (nano::node &, std::vector<nano::account> &); | ||||
| 	void generate_change_known (nano::node &, std::vector<nano::account> &); | ||||
| 	void generate_change_unknown (nano::node &, std::vector<nano::account> &); | ||||
| 	void generate_receive (nano::node &); | ||||
| 	void generate_send_new (nano::node &, std::vector<nano::account> &); | ||||
| 	void generate_send_existing (nano::node &, std::vector<nano::account> &); | ||||
| 	std::unique_ptr<nano::state_block> upgrade_genesis_epoch (nano::node &, nano::epoch const); | ||||
| 	std::shared_ptr<nano::wallet> wallet (size_t); | ||||
| 	nano::account account (nano::transaction const &, size_t); | ||||
| 	/** Generate work with difficulty between \p min_difficulty_a (inclusive) and \p max_difficulty_a (exclusive) */ | ||||
| 	uint64_t work_generate_limited (nano::block_hash const & root_a, uint64_t min_difficulty_a, uint64_t max_difficulty_a); | ||||
| 	/**
 | ||||
| 	class system final | ||||
| 	{ | ||||
| 	public: | ||||
| 		system (); | ||||
| 		system (uint16_t, nano::transport::transport_type = nano::transport::transport_type::tcp, nano::node_flags = nano::node_flags ()); | ||||
| 		~system (); | ||||
| 		void ledger_initialization_set (std::vector<nano::keypair> const & reps, nano::amount const & reserve = 0); | ||||
| 		void generate_activity (nano::node &, std::vector<nano::account> &); | ||||
| 		void generate_mass_activity (uint32_t, nano::node &); | ||||
| 		void generate_usage_traffic (uint32_t, uint32_t, size_t); | ||||
| 		void generate_usage_traffic (uint32_t, uint32_t); | ||||
| 		nano::account get_random_account (std::vector<nano::account> &); | ||||
| 		nano::uint128_t get_random_amount (nano::transaction const &, nano::node &, nano::account const &); | ||||
| 		void generate_rollback (nano::node &, std::vector<nano::account> &); | ||||
| 		void generate_change_known (nano::node &, std::vector<nano::account> &); | ||||
| 		void generate_change_unknown (nano::node &, std::vector<nano::account> &); | ||||
| 		void generate_receive (nano::node &); | ||||
| 		void generate_send_new (nano::node &, std::vector<nano::account> &); | ||||
| 		void generate_send_existing (nano::node &, std::vector<nano::account> &); | ||||
| 		std::unique_ptr<nano::state_block> upgrade_genesis_epoch (nano::node &, nano::epoch const); | ||||
| 		std::shared_ptr<nano::wallet> wallet (size_t); | ||||
| 		nano::account account (nano::transaction const &, size_t); | ||||
| 		/** Generate work with difficulty between \p min_difficulty_a (inclusive) and \p max_difficulty_a (exclusive) */ | ||||
| 		uint64_t work_generate_limited (nano::block_hash const & root_a, uint64_t min_difficulty_a, uint64_t max_difficulty_a); | ||||
| 		/**
 | ||||
| 	 * Polls, sleep if there's no work to be done (default 50ms), then check the deadline | ||||
| 	 * @returns 0 or nano::deadline_expired | ||||
| 	 */ | ||||
| 	std::error_code poll (std::chrono::nanoseconds const & sleep_time = std::chrono::milliseconds (50)); | ||||
| 	std::error_code poll_until_true (std::chrono::nanoseconds deadline, std::function<bool ()>); | ||||
| 	void delay_ms (std::chrono::milliseconds const & delay); | ||||
| 	void stop (); | ||||
| 	void deadline_set (std::chrono::duration<double, std::nano> const & delta); | ||||
| 	std::shared_ptr<nano::node> add_node (nano::node_flags = nano::node_flags (), nano::transport::transport_type = nano::transport::transport_type::tcp); | ||||
| 	std::shared_ptr<nano::node> add_node (nano::node_config const &, nano::node_flags = nano::node_flags (), nano::transport::transport_type = nano::transport::transport_type::tcp); | ||||
| 	boost::asio::io_context io_ctx; | ||||
| 	std::vector<std::shared_ptr<nano::node>> nodes; | ||||
| 	nano::logging logging; | ||||
| 	nano::work_pool work{ nano::dev::network_params.network, std::max (std::thread::hardware_concurrency (), 1u) }; | ||||
| 	std::chrono::time_point<std::chrono::steady_clock, std::chrono::duration<double>> deadline{ std::chrono::steady_clock::time_point::max () }; | ||||
| 	double deadline_scaling_factor{ 1.0 }; | ||||
| 	unsigned node_sequence{ 0 }; | ||||
| 	std::vector<std::shared_ptr<nano::block>> initialization_blocks; | ||||
| }; | ||||
| std::unique_ptr<nano::state_block> upgrade_epoch (nano::work_pool &, nano::ledger &, nano::epoch); | ||||
| void blocks_confirm (nano::node &, std::vector<std::shared_ptr<nano::block>> const &, bool const = false); | ||||
| uint16_t get_available_port (); | ||||
| void cleanup_dev_directories_on_exit (); | ||||
| 		 */ | ||||
| 		std::error_code poll (std::chrono::nanoseconds const & sleep_time = std::chrono::milliseconds (50)); | ||||
| 		std::error_code poll_until_true (std::chrono::nanoseconds deadline, std::function<bool ()>); | ||||
| 		void delay_ms (std::chrono::milliseconds const & delay); | ||||
| 		void stop (); | ||||
| 		void deadline_set (std::chrono::duration<double, std::nano> const & delta); | ||||
| 		std::shared_ptr<nano::node> add_node (nano::node_flags = nano::node_flags (), nano::transport::transport_type = nano::transport::transport_type::tcp); | ||||
| 		std::shared_ptr<nano::node> add_node (nano::node_config const &, nano::node_flags = nano::node_flags (), nano::transport::transport_type = nano::transport::transport_type::tcp); | ||||
| 		boost::asio::io_context io_ctx; | ||||
| 		std::vector<std::shared_ptr<nano::node>> nodes; | ||||
| 		nano::logging logging; | ||||
| 		nano::work_pool work{ nano::dev::network_params.network, std::max (std::thread::hardware_concurrency (), 1u) }; | ||||
| 		std::chrono::time_point<std::chrono::steady_clock, std::chrono::duration<double>> deadline{ std::chrono::steady_clock::time_point::max () }; | ||||
| 		double deadline_scaling_factor{ 1.0 }; | ||||
| 		unsigned node_sequence{ 0 }; | ||||
| 		std::vector<std::shared_ptr<nano::block>> initialization_blocks; | ||||
| 	}; | ||||
| 	std::unique_ptr<nano::state_block> upgrade_epoch (nano::work_pool &, nano::ledger &, nano::epoch); | ||||
| 	void blocks_confirm (nano::node &, std::vector<std::shared_ptr<nano::block>> const &, bool const = false); | ||||
| 	uint16_t get_available_port (); | ||||
| 	void cleanup_dev_directories_on_exit (); | ||||
| } | ||||
| } | ||||
| REGISTER_ERROR_CODES (nano, error_system); | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ | |||
| 
 | ||||
| #include <gtest/gtest.h> | ||||
| 
 | ||||
| void nano::compare_default_telemetry_response_data_excluding_signature (nano::telemetry_data const & telemetry_data_a, nano::network_params const & network_params_a, uint64_t bandwidth_limit_a, uint64_t active_difficulty_a) | ||||
| void nano::test::compare_default_telemetry_response_data_excluding_signature (nano::telemetry_data const & telemetry_data_a, nano::network_params const & network_params_a, uint64_t bandwidth_limit_a, uint64_t active_difficulty_a) | ||||
| { | ||||
| 	ASSERT_EQ (telemetry_data_a.block_count, 1); | ||||
| 	ASSERT_EQ (telemetry_data_a.cemented_count, 1); | ||||
|  | @ -24,7 +24,7 @@ void nano::compare_default_telemetry_response_data_excluding_signature (nano::te | |||
| 	ASSERT_EQ (telemetry_data_a.unknown_data, std::vector<uint8_t>{}); | ||||
| } | ||||
| 
 | ||||
| void nano::compare_default_telemetry_response_data (nano::telemetry_data const & telemetry_data_a, nano::network_params const & network_params_a, uint64_t bandwidth_limit_a, uint64_t active_difficulty_a, nano::keypair const & node_id_a) | ||||
| void nano::test::compare_default_telemetry_response_data (nano::telemetry_data const & telemetry_data_a, nano::network_params const & network_params_a, uint64_t bandwidth_limit_a, uint64_t active_difficulty_a, nano::keypair const & node_id_a) | ||||
| { | ||||
| 	ASSERT_FALSE (telemetry_data_a.validate_signature ()); | ||||
| 	nano::telemetry_data telemetry_data_l = telemetry_data_a; | ||||
|  | @ -32,6 +32,6 @@ void nano::compare_default_telemetry_response_data (nano::telemetry_data const & | |||
| 	telemetry_data_l.sign (node_id_a); | ||||
| 	// Signature should be different because uptime/timestamp will have changed.
 | ||||
| 	ASSERT_NE (telemetry_data_a.signature, telemetry_data_l.signature); | ||||
| 	compare_default_telemetry_response_data_excluding_signature (telemetry_data_a, network_params_a, bandwidth_limit_a, active_difficulty_a); | ||||
| 	nano::test::compare_default_telemetry_response_data_excluding_signature (telemetry_data_a, network_params_a, bandwidth_limit_a, active_difficulty_a); | ||||
| 	ASSERT_EQ (telemetry_data_a.node_id, node_id_a.pub); | ||||
| } | ||||
|  |  | |||
|  | @ -8,6 +8,9 @@ class keypair; | |||
| class network_params; | ||||
| class telemetry_data; | ||||
| 
 | ||||
| void compare_default_telemetry_response_data_excluding_signature (nano::telemetry_data const & telemetry_data_a, nano::network_params const & network_params_a, uint64_t bandwidth_limit_a, uint64_t active_difficulty_a); | ||||
| void compare_default_telemetry_response_data (nano::telemetry_data const & telemetry_data_a, nano::network_params const & network_params_a, uint64_t bandwidth_limit_a, uint64_t active_difficulty_a, nano::keypair const & node_id_a); | ||||
| namespace test | ||||
| { | ||||
| 	void compare_default_telemetry_response_data_excluding_signature (nano::telemetry_data const & telemetry_data_a, nano::network_params const & network_params_a, uint64_t bandwidth_limit_a, uint64_t active_difficulty_a); | ||||
| 	void compare_default_telemetry_response_data (nano::telemetry_data const & telemetry_data_a, nano::network_params const & network_params_a, uint64_t bandwidth_limit_a, uint64_t active_difficulty_a, nano::keypair const & node_id_a); | ||||
| } | ||||
| } | ||||
|  | @ -9,7 +9,7 @@ | |||
| 
 | ||||
| using namespace std::chrono_literals; | ||||
| 
 | ||||
| void nano::wait_peer_connections (nano::system & system_a) | ||||
| void nano::test::wait_peer_connections (nano::test::system & system_a) | ||||
| { | ||||
| 	auto wait_peer_count = [&system_a] (bool in_memory) { | ||||
| 		auto num_nodes = system_a.nodes.size (); | ||||
|  |  | |||
|  | @ -51,77 +51,78 @@ class public_key; | |||
| class block_hash; | ||||
| class telemetry_data; | ||||
| class network_params; | ||||
| class system; | ||||
| 
 | ||||
| extern nano::uint128_t const & genesis_amount; | ||||
| 
 | ||||
| class stringstream_mt_sink : public boost::iostreams::sink | ||||
| namespace test | ||||
| { | ||||
| public: | ||||
| 	stringstream_mt_sink () = default; | ||||
| 	stringstream_mt_sink (stringstream_mt_sink const & sink) | ||||
| 	class system; | ||||
| 
 | ||||
| 	class stringstream_mt_sink : public boost::iostreams::sink | ||||
| 	{ | ||||
| 		nano::lock_guard<nano::mutex> guard (mutex); | ||||
| 		ss << sink.ss.str (); | ||||
| 	} | ||||
| 	public: | ||||
| 		stringstream_mt_sink () = default; | ||||
| 		stringstream_mt_sink (stringstream_mt_sink const & sink) | ||||
| 		{ | ||||
| 			nano::lock_guard<nano::mutex> guard (mutex); | ||||
| 			ss << sink.ss.str (); | ||||
| 		} | ||||
| 
 | ||||
| 	std::streamsize write (char const * string_to_write, std::streamsize size) | ||||
| 		std::streamsize write (char const * string_to_write, std::streamsize size) | ||||
| 		{ | ||||
| 			nano::lock_guard<nano::mutex> guard (mutex); | ||||
| 			ss << std::string (string_to_write, size); | ||||
| 			return size; | ||||
| 		} | ||||
| 
 | ||||
| 		std::string str () | ||||
| 		{ | ||||
| 			nano::lock_guard<nano::mutex> guard (mutex); | ||||
| 			return ss.str (); | ||||
| 		} | ||||
| 
 | ||||
| 	private: | ||||
| 		mutable nano::mutex mutex; | ||||
| 		std::stringstream ss; | ||||
| 	}; | ||||
| 
 | ||||
| 	class boost_log_cerr_redirect | ||||
| 	{ | ||||
| 		nano::lock_guard<nano::mutex> guard (mutex); | ||||
| 		ss << std::string (string_to_write, size); | ||||
| 		return size; | ||||
| 	} | ||||
| 	public: | ||||
| 		boost_log_cerr_redirect (std::streambuf * new_buffer) : | ||||
| 			old (std::cerr.rdbuf (new_buffer)) | ||||
| 		{ | ||||
| 			console_sink = (boost::log::add_console_log (std::cerr, boost::log::keywords::format = "%Message%")); | ||||
| 		} | ||||
| 
 | ||||
| 	std::string str () | ||||
| 		~boost_log_cerr_redirect () | ||||
| 		{ | ||||
| 			std::cerr.rdbuf (old); | ||||
| 			boost::log::core::get ()->remove_sink (console_sink); | ||||
| 		} | ||||
| 
 | ||||
| 	private: | ||||
| 		std::streambuf * old; | ||||
| 		boost::shared_ptr<boost::log::sinks::synchronous_sink<boost::log::sinks::text_ostream_backend>> console_sink; | ||||
| 	}; | ||||
| 
 | ||||
| 	class cout_redirect | ||||
| 	{ | ||||
| 		nano::lock_guard<nano::mutex> guard (mutex); | ||||
| 		return ss.str (); | ||||
| 	} | ||||
| 	public: | ||||
| 		cout_redirect (std::streambuf * new_buffer) | ||||
| 		{ | ||||
| 			std::cout.rdbuf (new_buffer); | ||||
| 		} | ||||
| 
 | ||||
| private: | ||||
| 	mutable nano::mutex mutex; | ||||
| 	std::stringstream ss; | ||||
| }; | ||||
| 		~cout_redirect () | ||||
| 		{ | ||||
| 			std::cout.rdbuf (old); | ||||
| 		} | ||||
| 
 | ||||
| class boost_log_cerr_redirect | ||||
| { | ||||
| public: | ||||
| 	boost_log_cerr_redirect (std::streambuf * new_buffer) : | ||||
| 		old (std::cerr.rdbuf (new_buffer)) | ||||
| 	{ | ||||
| 		console_sink = (boost::log::add_console_log (std::cerr, boost::log::keywords::format = "%Message%")); | ||||
| 	} | ||||
| 	private: | ||||
| 		std::streambuf * old{ std::cout.rdbuf () }; | ||||
| 	}; | ||||
| 
 | ||||
| 	~boost_log_cerr_redirect () | ||||
| 	{ | ||||
| 		std::cerr.rdbuf (old); | ||||
| 		boost::log::core::get ()->remove_sink (console_sink); | ||||
| 	} | ||||
| 
 | ||||
| private: | ||||
| 	std::streambuf * old; | ||||
| 	boost::shared_ptr<boost::log::sinks::synchronous_sink<boost::log::sinks::text_ostream_backend>> console_sink; | ||||
| }; | ||||
| 
 | ||||
| class cout_redirect | ||||
| { | ||||
| public: | ||||
| 	cout_redirect (std::streambuf * new_buffer) | ||||
| 	{ | ||||
| 		std::cout.rdbuf (new_buffer); | ||||
| 	} | ||||
| 
 | ||||
| 	~cout_redirect () | ||||
| 	{ | ||||
| 		std::cout.rdbuf (old); | ||||
| 	} | ||||
| 
 | ||||
| private: | ||||
| 	std::streambuf * old{ std::cout.rdbuf () }; | ||||
| }; | ||||
| 
 | ||||
| namespace util | ||||
| { | ||||
| 	/**
 | ||||
| 	 * Helper to signal completion of async handlers in tests. | ||||
| 	 * Subclasses implement specific conditions for completion. | ||||
|  | @ -202,7 +203,7 @@ namespace util | |||
| 		std::atomic<unsigned> count{ 0 }; | ||||
| 		std::atomic<unsigned> required_count; | ||||
| 	}; | ||||
| } | ||||
| 
 | ||||
| void wait_peer_connections (nano::system &); | ||||
| 	void wait_peer_connections (nano::test::system &); | ||||
| } | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dimitrios Siganos
				Dimitrios Siganos