From 6cc7f6f719e72c2b11a792970847bbc81199ce9d Mon Sep 17 00:00:00 2001
From: Daniel <d.hornung@indiscale.com>
Date: Tue, 26 Sep 2023 10:42:08 +0200
Subject: [PATCH] FIX: Longer timeout if necessary.

---
 test/test_async.cpp | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/test/test_async.cpp b/test/test_async.cpp
index c804986..334896f 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);
 
-- 
GitLab