Fix and make tests more reliable.

This commit is contained in:
Daniel Nichter
2011-07-14 11:05:05 -06:00
parent db76b3ca30
commit 7526f97224
8 changed files with 40 additions and 32 deletions

View File

@@ -52,18 +52,20 @@ $master_dbh->do('create table t (i int, unique index (i))');
$master_dbh->do('insert into t values (1),(2)');
$slave_dbh->do('insert into t values (3)');
PerconaTest::wait_for_table($slave_dbh, 'test.t', 'i=1');
is_deeply(
$master_dbh->selectall_arrayref('select * from test.t'),
$master_dbh->selectall_arrayref('select * from test.t order by i'),
[[1],[2]],
'Data on master before sync'
);
use Data::Dumper;
my $rows = $slave_dbh->selectall_arrayref('select * from test.t order by i');
is_deeply(
$slave_dbh->selectall_arrayref('select * from test.t'),
$rows,
[[1],[2],[3]],
'Data on slave before sync'
);
) or print Dumper($rows);
$master_dbh->do('SET GLOBAL binlog_format="ROW"');
$master_dbh->disconnect();

View File

@@ -51,12 +51,12 @@ output(
my $binlog = $master_dbh->selectrow_arrayref('show master logs');
$output = `$mysqlbinlog /tmp/12345/data/$binlog->[0] | grep maatkit`;
$output = `$mysqlbinlog /tmp/12345/data/$binlog->[0] | grep 'percona-toolkit'`;
$output =~ s/pid:\d+/pid:0/ if $output;
$output =~ s/host:\S+?\*/host:-*/ if $output;
is(
$output,
"DELETE FROM `onlythisdb`.`t` WHERE `i`='5' LIMIT 1 /*maatkit src_db:onlythisdb src_tbl:t src_dsn:P=12345,h=127.0.0.1,p=...,u=msandbox dst_db:onlythisdb dst_tbl:t dst_dsn:P=12346,h=127.0.0.1,p=...,u=msandbox lock:1 transaction:0 changing_src:1 replicate:0 bidirectional:0 pid:0 user:$ENV{USER} host:-*/
"DELETE FROM `onlythisdb`.`t` WHERE `i`='5' LIMIT 1 /*percona-toolkit src_db:onlythisdb src_tbl:t src_dsn:P=12345,h=127.0.0.1,p=...,u=msandbox dst_db:onlythisdb dst_tbl:t dst_dsn:P=12346,h=127.0.0.1,p=...,u=msandbox lock:1 transaction:0 changing_src:1 replicate:0 bidirectional:0 pid:0 user:$ENV{USER} host:-*/
",
"Trace message appended to change SQL"
);