From 58d6ff559328bdfd86ddc0a38572e060da8de695 Mon Sep 17 00:00:00 2001 From: Sergey Kroshnin Date: Wed, 23 Jan 2019 21:07:40 +0300 Subject: [PATCH] Fix rare time_bound & time_cutoff tests failures (#1592) --- nano/core_test/network.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nano/core_test/network.cpp b/nano/core_test/network.cpp index d0a618e0..937857cb 100644 --- a/nano/core_test/network.cpp +++ b/nano/core_test/network.cpp @@ -980,16 +980,16 @@ TEST (frontier_req, time_bound) auto connection (std::make_shared (nullptr, system.nodes[0])); std::unique_ptr req (new nano::frontier_req); req->start.clear (); - req->age = 0; + req->age = 1; req->count = std::numeric_limitscount)>::max (); connection->requests.push (std::unique_ptr{}); auto request (std::make_shared (connection, std::move (req))); ASSERT_EQ (nano::test_genesis_key.pub, request->current); - // Wait for next second when age of account will be > 0 seconds - std::this_thread::sleep_for (std::chrono::milliseconds (1001)); + // Wait 2 seconds until age of account will be > 1 seconds + std::this_thread::sleep_for (std::chrono::milliseconds (2100)); std::unique_ptr req2 (new nano::frontier_req); req2->start.clear (); - req2->age = 0; + req2->age = 1; req2->count = std::numeric_limitscount)>::max (); auto connection2 (std::make_shared (nullptr, system.nodes[0])); connection2->requests.push (std::unique_ptr{}); @@ -1010,8 +1010,8 @@ TEST (frontier_req, time_cutoff) ASSERT_EQ (nano::test_genesis_key.pub, request->current); nano::genesis genesis; ASSERT_EQ (genesis.hash (), request->frontier); - // Wait 4 seconds when age of account will be > 3 seconds - std::this_thread::sleep_for (std::chrono::milliseconds (4001)); + // Wait 4 seconds until age of account will be > 3 seconds + std::this_thread::sleep_for (std::chrono::milliseconds (4100)); std::unique_ptr req2 (new nano::frontier_req); req2->start.clear (); req2->age = 3;