Skip to content
Snippets Groups Projects

fix async timeout

Merged Daniel Hornung requested to merge f-fix-async-timeout into dev
2 files
+ 14
6
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 12
6
@@ -53,13 +53,19 @@ 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;
auto code = transaction->GetStatus().GetCode();
do {
// wait some time
std::this_thread::sleep_for(10ms);
// DONT call WaitForIt -> the transaction finishes in the back-ground
status = transaction->GetStatus();
EXPECT_EQ(status.GetCode(), TransactionStatus::TRANSACTION_ERROR().GetCode());
ASSERT_EQ(status.GetCode(), StatusCode::GENERIC_TRANSACTION_ERROR);
// DONT call WaitForIt -> the transaction finishes in the background
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();
Loading