diff --git a/test/test_async.cpp b/test/test_async.cpp index c8049865abfb74b662c9f2e63619da80fcc7376b..334896f2e2b2acaad55c45c8b73e43ba798f84d4 100644 --- a/test/test_async.cpp +++ b/test/test_async.cpp @@ -53,11 +53,15 @@ TEST(test_async, retrieve_non_existing) { auto status = transaction->GetStatus(); EXPECT_EQ(status.GetCode(), StatusCode::EXECUTING); - // wait some time - std::this_thread::sleep_for(1000ms); + // 1000ms are not always sufficient, when there is very high pipeline load. + auto count = 1000; + do { + // wait some time + std::this_thread::sleep_for(10ms); - // DONT call WaitForIt -> the transaction finishes in the back-ground - status = transaction->GetStatus(); + // DONT call WaitForIt -> the transaction finishes in the background + status = transaction->GetStatus(); + } while (--count > 0 && status.GetCode() == StatusCode::EXECUTING); EXPECT_EQ(status.GetCode(), TransactionStatus::TRANSACTION_ERROR().GetCode()); ASSERT_EQ(status.GetCode(), StatusCode::GENERIC_TRANSACTION_ERROR);