Test user privs for bug 916168.

This commit is contained in:
Daniel Nichter
2012-07-20 17:58:44 -06:00
parent 7d9d4037ac
commit 54733dad5f
2 changed files with 47 additions and 2 deletions

View File

@@ -42,7 +42,7 @@ elsif ( !@{$master_dbh->selectall_arrayref("show databases like 'sakila'")} ) {
plan skip_all => 'sakila database is not loaded';
}
else {
plan tests => 3;
plan tests => 4;
}
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
@@ -94,7 +94,31 @@ 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;
}
);
# #############################################################################
# Bug 916168: bug in pt-table-checksum privileges check
# #############################################################################
`/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,
"$master_dsn,u=test_user,p=foo", qw(-t sakila.country)) },
);
is(
PerconaTest::count_checksum_results($output, 'rows'),
109,
"test_user privs work (bug 916168)"
);
diag(`/tmp/12345/use -u root -e "drop user 'test_user'\@'%'"`);
wait_until(
sub {
my $rows=$slave2_dbh->selectall_arrayref("SELECT user FROM mysql.user");
return !grep { ($_->[0] || '') eq 'test_user' } @$rows;
}
);

View File

@@ -0,0 +1,21 @@
grant select, replication slave, replication client, super, process on *.* to 'test_user'@'%' identified by 'foo';
grant all on percona.* to 'test_user'@'%';
create database if not exists percona;
use percona;
drop table if exists checksums;
CREATE TABLE `checksums` (
`db` char(64) NOT NULL,
`tbl` char(64) NOT NULL,
`chunk` int(11) NOT NULL,
`chunk_time` float DEFAULT NULL,
`chunk_index` varchar(200) DEFAULT NULL,
`lower_boundary` text,
`upper_boundary` text,
`this_crc` char(40) NOT NULL,
`this_cnt` int(11) NOT NULL,
`master_crc` char(40) DEFAULT NULL,
`master_cnt` int(11) DEFAULT NULL,
`ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`db`,`tbl`,`chunk`),
KEY `ts_db_tbl` (`ts`,`db`,`tbl`)
) ENGINE=InnoDB;