Skip to content

Commit 72ebd9a

Browse files
committed
bug tests: fix flaky mysql tests
commit_hash:814a354cdf3e95223f7d55a7c7fb3bbd33669b60
1 parent 62e53b0 commit 72ebd9a

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

mysql/tests/cluster.cpp

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,9 @@ UTEST(Cluster, MappedBatchInsert) {
212212
namespace {
213213
/// [uMySQL usage sample - Cluster ExecuteCommand]
214214
void PrepareExampleTable(const Cluster& cluster) {
215-
constexpr std::chrono::milliseconds kTimeout{1750};
216215
cluster.ExecuteCommand(ClusterHostType::kPrimary, "DROP TABLE IF EXISTS SampleTable");
217216
cluster.ExecuteCommand(
218-
CommandControl{kTimeout},
217+
CommandControl{utest::kMaxTestWaitTime},
219218
ClusterHostType::kPrimary,
220219
"CREATE TABLE SampleTable("
221220
"Id INT PRIMARY KEY AUTO_INCREMENT,"
@@ -254,7 +253,7 @@ UTEST(Cluster, Execute) {
254253

255254
PrepareExampleTable(*cluster);
256255

257-
PerformExecute(*cluster, std::chrono::milliseconds{1750}, "title", 1);
256+
PerformExecute(*cluster, utest::kMaxTestWaitTime, "title", 1);
258257
}
259258

260259
} // namespace execute_sample
@@ -290,11 +289,7 @@ UTEST(Cluster, ExecuteDecompose) {
290289

291290
PrepareExampleTable(*cluster);
292291

293-
PerformExecuteDecompose(
294-
*cluster,
295-
std::chrono::milliseconds{1750},
296-
SampleRow{"title", 2, std::chrono::system_clock::now()}
297-
);
292+
PerformExecuteDecompose(*cluster, utest::kMaxTestWaitTime, SampleRow{"title", 2, std::chrono::system_clock::now()});
298293
}
299294

300295
} // namespace execute_decompose_sample
@@ -339,7 +334,7 @@ UTEST(Cluster, ExecuteBulk) {
339334
rows.push_back(SampleRow{std::to_string(i), 1, std::chrono::system_clock::now()});
340335
}
341336

342-
PerformExecuteBulk(*cluster, std::chrono::milliseconds{1750}, rows);
337+
PerformExecuteBulk(*cluster, utest::kMaxTestWaitTime, rows);
343338
}
344339

345340
} // namespace execute_bulk_sample
@@ -402,7 +397,7 @@ UTEST(Cluster, ExecuteBulkMapped) {
402397
data.push_back({"name", std::to_string(i), 2});
403398
}
404399

405-
PerformExecuteBulkMapped(*cluster, std::chrono::milliseconds{1750}, data);
400+
PerformExecuteBulkMapped(*cluster, utest::kMaxTestWaitTime, data);
406401
}
407402

408403
} // namespace execute_bulk_mapped_sample
@@ -447,10 +442,10 @@ UTEST(Cluster, GetCursor) {
447442
for (std::size_t i = 1; i <= kRowsCount; ++i) {
448443
rows.push_back({std::to_string(i), static_cast<int>(i), std::chrono::system_clock::now()});
449444
}
450-
execute_bulk_sample::PerformExecuteBulk(*cluster, std::chrono::milliseconds{1750}, rows);
445+
execute_bulk_sample::PerformExecuteBulk(*cluster, utest::kMaxTestWaitTime, rows);
451446
}
452447

453-
PerformGetCursor(*cluster, std::chrono::milliseconds{1750});
448+
PerformGetCursor(*cluster, utest::kMaxTestWaitTime);
454449
}
455450

456451
} // namespace get_cursor_sample

0 commit comments

Comments
 (0)