Failing test case.

This commit is contained in:
Daniel Nichter
2012-10-31 13:16:25 -06:00
parent 9b6f10480c
commit 0453d7dd82
4 changed files with 49 additions and 6 deletions

View File

@@ -1636,10 +1636,16 @@ sub _d {
# ###########################################################################
package pt_show_grants;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
use Data::Dumper;
$Data::Dumper::Quotekeys = 0;
$Data::Dumper::Indent = 1;
$Data::Dumper::Sortkeys = 1;
sub main {
@ARGV = @_; # set global ARGV for this package
@@ -1757,6 +1763,7 @@ sub main {
PTDEBUG && _d($EVAL_ERROR);
$exit_status = 1;
}
PTDEBUG && _d('Grants:', Dumper(\@grants));
next unless @grants;
if ( $o->get('separate') ) { # List each grant separately.
@@ -1894,7 +1901,7 @@ pt-show-grants - Canonicalize and print MySQL grants so you can effectively repl
=head1 SYNOPSIS
Usage: pt-show-grants [OPTION...] [DSN]
Usage: pt-show-grants [OPTIONS] [DSN]
pt-show-grants shows grants (user privileges) from a MySQL server.

View File

@@ -22,9 +22,6 @@ my $dbh = $sb->get_dbh_for('master');
if ( !$dbh ) {
plan skip_all => 'Cannot connect to sandbox master';
}
else {
plan tests => 11;
}
$sb->wipe_clean($dbh);
@@ -94,8 +91,28 @@ like(
'No output when all users skipped'
);
# #############################################################################
# pt-show-grant doesn't support column-level grants
# https://bugs.launchpad.net/percona-toolkit/+bug/866075
# #############################################################################
$sb->load_file('master', 't/pt-show-grants/samples/column-grants.sql');
diag(`/tmp/12345/use -u root -e "GRANT SELECT(DateCreated, PckPrice, PaymentStat, SANumber) ON test.t TO 'sally'\@'%'"`);
diag(`/tmp/12345/use -u root -e "GRANT SELECT(city_id), INSERT(city) ON sakila.city TO 'sally'\@'%'"`);
ok(
no_diff(
sub { pt_show_grants::main('-F', $cnf, qw(--only sally)) },
"t/pt-show-grants/samples/column-grants.txt",
stderr => 1,
),
"Column-level grants (bug 866075)"
);
diag(`/tmp/12345/use -u root -e "DROP USER 'sally'\@'%'"`);
# #############################################################################
# Done.
# #############################################################################
$sb->wipe_clean($dbh);
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
exit;
done_testing;

View File

@@ -0,0 +1,18 @@
drop database if exists test;
create database test;
use test;
CREATE TABLE t (
`SOrNum` mediumint(9) unsigned NOT NULL auto_increment,
`SPNum` mediumint(9) unsigned NOT NULL,
`DateCreated` timestamp NOT NULL default CURRENT_TIMESTAMP,
`DateRelease` timestamp NOT NULL default '0000-00-00 00:00:00',
`ActualReleasedDate` timestamp NULL default NULL,
`PckPrice` decimal(10,2) NOT NULL default '0.00',
`Status` varchar(20) NOT NULL,
`PaymentStat` varchar(20) NOT NULL default 'Unpaid',
`CusCode` int(9) unsigned NOT NULL,
`SANumber` mediumint(9) unsigned NOT NULL default '0',
`SpecialInstruction` varchar(500) default NULL,
PRIMARY KEY (`SOrNum`)
) ENGINE=InnoDB;

View File

@@ -0,0 +1 @@
--