Skip to content

Commit 7afd6e4

Browse files
[+] wait before reading
1 parent 468e70e commit 7afd6e4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

ydb/core/tx/datashard/datashard_ut_change_exchange.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,6 +1206,7 @@ Y_UNIT_TEST_SUITE(Cdc) {
12061206
{
12071207
TTestYdsEnv env(tableDesc, streamDesc);
12081208

1209+
DBGTRACE_LOG("exec SQL");
12091210
for (const auto& query : queries) {
12101211
ExecSQL(env.GetServer(), env.GetEdgeActor(), query);
12111212
}
@@ -1246,6 +1247,8 @@ Y_UNIT_TEST_SUITE(Cdc) {
12461247

12471248
// get records
12481249
{
1250+
WaitForDataRecords(client, shardIt);
1251+
12491252
auto res = client.GetRecords(shardIt).ExtractValueSync();
12501253
UNIT_ASSERT_C(res.IsSuccess(), res.GetIssues().ToString());
12511254
UNIT_ASSERT_VALUES_EQUAL(res.GetResult().records().size(), records.size());
@@ -1267,6 +1270,19 @@ Y_UNIT_TEST_SUITE(Cdc) {
12671270
}
12681271
}
12691272

1273+
static void WaitForDataRecords(TDataStreamsClient& client, const TString& shardIt) {
1274+
int n = 0;
1275+
for (; n < 100; ++n) {
1276+
auto res = client.GetRecords(shardIt).ExtractValueSync();
1277+
UNIT_ASSERT_C(res.IsSuccess(), res.GetIssues().ToString());
1278+
if (res.GetResult().records().size()) {
1279+
break;
1280+
}
1281+
Sleep(TDuration::MilliSeconds(100));
1282+
}
1283+
UNIT_ASSERT_VALUES_UNEQUAL(n, 100);
1284+
}
1285+
12701286
static void Write(const TShardedTableOptions& tableDesc, const TCdcStream& streamDesc) {
12711287
TTestYdsEnv env(tableDesc, streamDesc);
12721288

0 commit comments

Comments
 (0)