mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-21 11:30:24 +00:00
Fix more test output broken by percona_test.load_data. Tweak ptc/t/privs.t so it passes on my box. Fix new start/stop scripts: don't check ibdata1 because SKIP_INNODB may be used. Make PerconaTest::output() cleaner.
This commit is contained in:
@@ -110,18 +110,18 @@ ok(
|
||||
$row = $master_dbh->selectrow_arrayref("select count(*) from percona.checksums");
|
||||
is(
|
||||
$row->[0],
|
||||
( $sandbox_version gt "5.1" ? 89
|
||||
: $sandbox_version gt "5.0" ? 88
|
||||
: 84),
|
||||
( $sandbox_version gt "5.1" ? 90
|
||||
: $sandbox_version gt "5.0" ? 89
|
||||
: 85),
|
||||
'Expected checksums on master'
|
||||
);
|
||||
|
||||
$row = $slave1_dbh->selectrow_arrayref("select count(*) from percona.checksums");
|
||||
is(
|
||||
$row->[0],
|
||||
( $sandbox_version gt "5.1" ? 89
|
||||
: $sandbox_version gt "5.0" ? 88
|
||||
: 84),
|
||||
( $sandbox_version gt "5.1" ? 90
|
||||
: $sandbox_version gt "5.0" ? 89
|
||||
: 85),
|
||||
'Expected checksums on slave'
|
||||
);
|
||||
|
||||
|
@@ -56,47 +56,45 @@ my $sample = "t/pt-table-checksum/samples/";
|
||||
# https://bugs.launchpad.net/percona-toolkit/+bug/950294
|
||||
# ############################################################################
|
||||
|
||||
$sb->wipe_clean($master_dbh);
|
||||
$master_dbh->do("DROP DATABASE IF EXISTS percona");
|
||||
diag(`/tmp/12345/use -u root < $trunk/t/lib/samples/ro-checksum-user.sql 2>/dev/null`);
|
||||
PerconaTest::wait_for_table($slave1_dbh, "mysql.tables_priv", "user='ro_checksum_user'");
|
||||
PerconaTest::wait_for_table($slave2_dbh, "mysql.user", "user='ro_checksum_user'");
|
||||
|
||||
($output, $exit_status) = full_output(
|
||||
sub { pt_table_checksum::main(@args,
|
||||
$output = output(
|
||||
sub { $exit_status = pt_table_checksum::main(@args,
|
||||
"$master_dsn,u=ro_checksum_user,p=msandbox",
|
||||
qw(--recursion-method none)
|
||||
) },
|
||||
stderr => 1,
|
||||
);
|
||||
|
||||
ok(
|
||||
$exit_status,
|
||||
"Dies with an error status if it can't create the db/table"
|
||||
like(
|
||||
$output,
|
||||
qr/\Qdatabase percona does not exist and it cannot be created automatically/,
|
||||
"Error if percona db doesn't exist and user can't create it",
|
||||
);
|
||||
|
||||
like($output,
|
||||
qr/\Q--replicate database percona does not exist and it cannot be created automatically/,
|
||||
"fails if the percona db doesn't exist and the user can't create it",
|
||||
);
|
||||
|
||||
($output, $exit_status) = full_output(
|
||||
$output = output(
|
||||
sub { pt_table_checksum::main(@args,
|
||||
"$master_dsn,u=ro_checksum_user,p=msandbox",
|
||||
qw(--recursion-method none --no-create-replicate-table)
|
||||
) },
|
||||
stderr => 1,
|
||||
);
|
||||
|
||||
like($output,
|
||||
qr/\Q--replicate database percona does not exist and --no-create-replicate-table was/,
|
||||
"fails if the percona db doesn't exist and --no-create-replicate-table",
|
||||
like(
|
||||
$output,
|
||||
qr/\Qdatabase percona does not exist and --no-create-replicate-table was/,
|
||||
"Error if percona db doesn't exist and --no-create-replicate-table",
|
||||
);
|
||||
|
||||
diag(`/tmp/12345/use -u root -e "drop user 'ro_checksum_user'\@'%'"`);
|
||||
wait_until(
|
||||
sub {
|
||||
my $rows=$slave2_dbh->selectall_arrayref("SELECT user FROM mysql.user");
|
||||
return !grep { ($_->[0] || '') ne 'ro_checksum_user' } @$rows;
|
||||
return !grep { ($_->[0] || '') eq 'ro_checksum_user' } @$rows;
|
||||
}
|
||||
);
|
||||
$sb->wipe_clean($master_dbh);
|
||||
|
||||
# ############################################################################
|
||||
# --recursion-method=none to avoid SHOW SLAVE HOSTS
|
||||
@@ -143,7 +141,7 @@ like(
|
||||
|
||||
like($output,
|
||||
qr/\QThe database exists on the master, but replication will break/,
|
||||
"dies if the db exists on the master but it can't CREATE DATABASE and --no-create-replicate-table was not specified",
|
||||
"Error if db exists on the master, can't CREATE DATABASE, and --no-create-replicate-table was not specified",
|
||||
);
|
||||
|
||||
diag(qx{/tmp/12345/use -u root -e 'DROP TABLE `percona`.`checksums`'});
|
||||
@@ -157,7 +155,7 @@ diag(qx{/tmp/12345/use -u root -e 'DROP TABLE `percona`.`checksums`'});
|
||||
|
||||
like($output,
|
||||
qr/\Q--replicate table `percona`.`checksums` does not exist and --no/,
|
||||
"fails if the checksums db doesn't exist and --no-create-replicate-table"
|
||||
"Error if checksums db doesn't exist and --no-create-replicate-table"
|
||||
);
|
||||
|
||||
diag(`/tmp/12345/use -u root -e "drop user 'ro_checksum_user'\@'%'"`);
|
||||
@@ -171,7 +169,7 @@ wait_until(
|
||||
# #############################################################################
|
||||
# Bug 916168: bug in pt-table-checksum privileges check
|
||||
# #############################################################################
|
||||
`/tmp/12345/use -u root < $trunk/t/pt-table-checksum/samples/privs-bug-916168.sql`;
|
||||
diag(`/tmp/12345/use -u root < $trunk/t/pt-table-checksum/samples/privs-bug-916168.sql`);
|
||||
|
||||
$output = output(
|
||||
sub { $exit_status = pt_table_checksum::main(@args,
|
||||
@@ -197,5 +195,5 @@ wait_until(
|
||||
# #############################################################################
|
||||
$sb->wipe_clean($master_dbh);
|
||||
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||
|
||||
done_testing;
|
||||
exit;
|
||||
|
@@ -17,6 +17,7 @@ ERRORS DIFFS ROWS SKIPPED TABLE
|
||||
0 0 0 0 mysql.time_zone_transition_type
|
||||
0 0 2 0 mysql.user
|
||||
0 0 33 0 percona_test.checksums
|
||||
0 0 1 0 percona_test.load_data
|
||||
0 0 1 0 percona_test.sentinel
|
||||
0 0 200 0 sakila.actor
|
||||
0 0 603 0 sakila.address
|
||||
|
@@ -21,6 +21,7 @@ ERRORS DIFFS ROWS SKIPPED TABLE
|
||||
0 0 0 0 mysql.time_zone_transition_type
|
||||
0 0 2 0 mysql.user
|
||||
0 0 39 0 percona_test.checksums
|
||||
0 0 1 0 percona_test.load_data
|
||||
0 0 1 0 percona_test.sentinel
|
||||
0 0 200 0 sakila.actor
|
||||
0 0 603 0 sakila.address
|
||||
|
@@ -22,6 +22,7 @@ ERRORS DIFFS ROWS SKIPPED TABLE
|
||||
0 0 0 0 mysql.time_zone_transition_type
|
||||
0 0 2 0 mysql.user
|
||||
0 0 40 0 percona_test.checksums
|
||||
0 0 1 0 percona_test.load_data
|
||||
0 0 1 0 percona_test.sentinel
|
||||
0 0 200 0 sakila.actor
|
||||
0 0 603 0 sakila.address
|
||||
|
@@ -17,6 +17,7 @@ ERRORS DIFFS ROWS CHUNKS SKIPPED TABLE
|
||||
0 0 0 1 0 mysql.time_zone_transition_type
|
||||
0 0 2 1 0 mysql.user
|
||||
0 0 33 1 0 percona_test.checksums
|
||||
0 0 1 1 0 percona_test.load_data
|
||||
0 0 1 1 0 percona_test.sentinel
|
||||
0 0 200 1 0 sakila.actor
|
||||
0 0 603 1 0 sakila.address
|
||||
|
@@ -21,6 +21,7 @@ ERRORS DIFFS ROWS CHUNKS SKIPPED TABLE
|
||||
0 0 0 1 0 mysql.time_zone_transition_type
|
||||
0 0 2 1 0 mysql.user
|
||||
0 0 39 1 0 percona_test.checksums
|
||||
0 0 1 1 0 percona_test.load_data
|
||||
0 0 1 1 0 percona_test.sentinel
|
||||
0 0 200 1 0 sakila.actor
|
||||
0 0 603 1 0 sakila.address
|
||||
|
@@ -22,6 +22,7 @@ ERRORS DIFFS ROWS CHUNKS SKIPPED TABLE
|
||||
0 0 0 1 0 mysql.time_zone_transition_type
|
||||
0 0 2 1 0 mysql.user
|
||||
0 0 40 1 0 percona_test.checksums
|
||||
0 0 1 1 0 percona_test.load_data
|
||||
0 0 1 1 0 percona_test.sentinel
|
||||
0 0 200 1 0 sakila.actor
|
||||
0 0 603 1 0 sakila.address
|
||||
|
Reference in New Issue
Block a user