Skip to content

Commit

Permalink
Improve two-node-network test case
Browse files Browse the repository at this point in the history
Wait longer for the second node to start up
  • Loading branch information
abitmore committed May 8, 2020
1 parent 1b0950d commit 9e48083
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions tests/app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,11 @@ BOOST_AUTO_TEST_CASE( two_node_network )
BOOST_TEST_MESSAGE( "Starting app1 and waiting 500 ms" );
app1.startup();
#ifdef NDEBUG
#define LISTEN_WAIT_TIME (fc::milliseconds(30000))
#define NODE_STARTUP_WAIT_TIME (fc::milliseconds(30000))
#else
#define LISTEN_WAIT_TIME (fc::milliseconds(120000))
#define NODE_STARTUP_WAIT_TIME (fc::milliseconds(120000))
#endif
fc::wait_for( LISTEN_WAIT_TIME, [&app1] () {
fc::wait_for( NODE_STARTUP_WAIT_TIME, [&app1] () {
const auto status = app1.p2p_node()->network_get_info();
return status["listening_on"].as<fc::ip::endpoint>( 5 ).port() == 3939;
});
Expand All @@ -273,12 +273,7 @@ BOOST_AUTO_TEST_CASE( two_node_network )
BOOST_TEST_MESSAGE( "Starting app2 and waiting for connection" );
app2.startup();

#ifdef NDEBUG
#define CONNECT_WAIT_TIME (fc::milliseconds(10000))
#else
#define CONNECT_WAIT_TIME (fc::milliseconds(30000))
#endif
fc::wait_for( CONNECT_WAIT_TIME, [&app1] () { return app1.p2p_node()->get_connection_count() > 0; } );
fc::wait_for( NODE_STARTUP_WAIT_TIME, [&app1] () { return app1.p2p_node()->get_connection_count() > 0; } );

BOOST_REQUIRE_EQUAL(app1.p2p_node()->get_connection_count(), 1u);
BOOST_CHECK_EQUAL(std::string(app1.p2p_node()->get_connected_peers().front().host.get_address()), "127.0.0.1");
Expand Down

0 comments on commit 9e48083

Please sign in to comment.