Skip to content

Commit

Permalink
retry scheme query in tests (#5403)
Browse files Browse the repository at this point in the history
  • Loading branch information
nshestakov authored Jun 14, 2024
1 parent 309333d commit fbfd87d
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions ydb/core/testlib/test_pq_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,18 @@ class TFlatMsgBusPQClient : public NFlatTests::TFlatMsgBusClient {
public:
void RunYqlSchemeQuery(TString query, bool expectSuccess = true) {
auto tableClient = NYdb::NTable::TTableClient(*Driver);
auto result = tableClient.RetryOperationSync([&](NYdb::NTable::TSession session) {
return session.ExecuteSchemeQuery(query).GetValueSync();
});

NYdb::TStatus result(NYdb::EStatus::SUCCESS, NYql::TIssues());
for (size_t i = 0; i < 10; ++i) {
result = tableClient.RetryOperationSync([&](NYdb::NTable::TSession session) {
return session.ExecuteSchemeQuery(query).GetValueSync();
});
if (!expectSuccess || result.IsSuccess()) {
break;
}
Sleep(TDuration::Seconds(1));
}

if (expectSuccess) {
UNIT_ASSERT_C(result.IsSuccess(), result.GetIssues().ToString());
} else {
Expand Down

0 comments on commit fbfd87d

Please sign in to comment.