Skip to content

Commit

Permalink
Fixed flaky tests
Browse files Browse the repository at this point in the history
The two tests previously tested assertions against the replica
after executing changes in the source without waiting for the
replication to converge.
  • Loading branch information
hpoettker committed Sep 11, 2024
1 parent 206404f commit 61c43b4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 1 addition & 7 deletions t/pt-table-sync/char_chunking.t
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,7 @@ $sb->create_dbs($master_dbh, ['test']);
$sb->load_file('master', "t/lib/samples/char-chunking/ascii.sql", "test");
$master_dbh->do('alter table test.ascii drop column `i`');

wait_until(
sub {
my $row;
eval {$row = $slave_dbh->selectall_arrayref("select * from test.ascii");};
return 1 if $row && @$row > 100;
},
);
$sb->wait_for_slaves();

$slave_dbh->do('delete from test.ascii where c like "Zesus%"');

Expand Down
4 changes: 4 additions & 0 deletions t/pt-table-sync/pt-1256.t
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ like(
"PT-1256 Set the correct charset"
);

$sb->wait_for_slaves();

SKIP: {
my $vp = VersionParser->new($master_dbh);
if ($vp->cmp('8.0') > -1 && $vp->cmp('8.0.14') < 0 && $vp->flavor() !~ m/maria/i) {
Expand All @@ -91,6 +93,8 @@ SKIP: {
$output = `$trunk/bin/pt-table-sync --execute --lock-and-rename h=127.1,P=12345,u=msandbox,p=msandbox,D=test,t=t1 t=t2 2>&1`;
$output = `/tmp/12345/use -e 'show create table test.t2'`;
like($output, qr/COMMENT='test1'/, '--lock-and-rename worked');

$sb->wait_for_slaves();

#4
$row = $slave1_dbh->selectrow_hashref("SELECT f2 FROM test.t2 WHERE id = 1");
Expand Down

0 comments on commit 61c43b4

Please sign in to comment.