Skip to content

Commit

Permalink
Merge pull request #2411 from bitshares/fix-cli-test-listen-port
Browse files Browse the repository at this point in the history
Find 2 different ports in cli_test for rpc and p2p
  • Loading branch information
abitmore authored Apr 21, 2021
2 parents 8db4ae9 + 1bbf05a commit d352eca
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/cli/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,14 @@ std::shared_ptr<graphene::app::application> start_application(fc::temp_directory
auto sharable_cfg = std::make_shared<boost::program_options::variables_map>();
auto& cfg = *sharable_cfg;
server_port_number = fc::network::get_available_port();
auto p2p_port = server_port_number;
for( size_t i = 0; i < 10 && p2p_port == server_port_number; ++i )
{
p2p_port = fc::network::get_available_port();
}
BOOST_REQUIRE( p2p_port != server_port_number );
fc::set_option( cfg, "rpc-endpoint", string("127.0.0.1:") + std::to_string(server_port_number) );
fc::set_option( cfg, "p2p-endpoint", string("0.0.0.0:") + std::to_string(p2p_port) );
fc::set_option( cfg, "genesis-json", create_genesis_file(app_dir) );
fc::set_option( cfg, "seed-nodes", string("[]") );
fc::set_option( cfg, "custom-operations-start-block", uint32_t(1) );
Expand Down

0 comments on commit d352eca

Please sign in to comment.