From 96856cde89517e5b00905dfd28f6cd0b619df2f3 Mon Sep 17 00:00:00 2001
From: Daniel <d.hornung@indiscale.com>
Date: Tue, 26 Sep 2023 11:16:03 +0200
Subject: [PATCH] MAINT: Changelog and simplified code a bit.

---
 CHANGELOG.md        |  2 ++
 test/test_async.cpp | 10 ++++++----
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 449e425..fcdf016 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,4 +19,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ### Fixed
 
+* Fixed failing async test.
+
 ### Security
diff --git a/test/test_async.cpp b/test/test_async.cpp
index 334896f..bf437f6 100644
--- a/test/test_async.cpp
+++ b/test/test_async.cpp
@@ -55,15 +55,17 @@ TEST(test_async, retrieve_non_existing) {
 
   // 1000ms are not always sufficient, when there is very high pipeline load.
   auto count = 1000;
+  auto code = transaction->GetStatus().GetCode();
   do {
     // wait some time
     std::this_thread::sleep_for(10ms);
 
     // 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);
+    code = transaction->GetStatus().GetCode();
+  } while (--count > 0 && code == StatusCode::EXECUTING);
+  ASSERT_GT(count, 0) << "ERROR: Timeout while waiting for transaction.";
+  EXPECT_EQ(code, TransactionStatus::TRANSACTION_ERROR().GetCode());
+  ASSERT_EQ(code, StatusCode::GENERIC_TRANSACTION_ERROR);
 
   const auto &result_set = transaction->GetResultSet();
 
-- 
GitLab