mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 05:00:45 +00:00
Failing test case.
This commit is contained in:
@@ -1636,10 +1636,16 @@ sub _d {
|
|||||||
# ###########################################################################
|
# ###########################################################################
|
||||||
package pt_show_grants;
|
package pt_show_grants;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings FATAL => 'all';
|
||||||
use English qw(-no_match_vars);
|
use English qw(-no_match_vars);
|
||||||
|
|
||||||
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||||
|
|
||||||
|
use Data::Dumper;
|
||||||
|
$Data::Dumper::Quotekeys = 0;
|
||||||
|
$Data::Dumper::Indent = 1;
|
||||||
|
$Data::Dumper::Sortkeys = 1;
|
||||||
|
|
||||||
sub main {
|
sub main {
|
||||||
@ARGV = @_; # set global ARGV for this package
|
@ARGV = @_; # set global ARGV for this package
|
||||||
|
|
||||||
@@ -1757,6 +1763,7 @@ sub main {
|
|||||||
PTDEBUG && _d($EVAL_ERROR);
|
PTDEBUG && _d($EVAL_ERROR);
|
||||||
$exit_status = 1;
|
$exit_status = 1;
|
||||||
}
|
}
|
||||||
|
PTDEBUG && _d('Grants:', Dumper(\@grants));
|
||||||
next unless @grants;
|
next unless @grants;
|
||||||
|
|
||||||
if ( $o->get('separate') ) { # List each grant separately.
|
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
|
=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.
|
pt-show-grants shows grants (user privileges) from a MySQL server.
|
||||||
|
|
||||||
|
@@ -22,9 +22,6 @@ my $dbh = $sb->get_dbh_for('master');
|
|||||||
if ( !$dbh ) {
|
if ( !$dbh ) {
|
||||||
plan skip_all => 'Cannot connect to sandbox master';
|
plan skip_all => 'Cannot connect to sandbox master';
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
plan tests => 11;
|
|
||||||
}
|
|
||||||
|
|
||||||
$sb->wipe_clean($dbh);
|
$sb->wipe_clean($dbh);
|
||||||
|
|
||||||
@@ -94,8 +91,28 @@ like(
|
|||||||
'No output when all users skipped'
|
'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.
|
# Done.
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
|
$sb->wipe_clean($dbh);
|
||||||
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||||
exit;
|
done_testing;
|
||||||
|
18
t/pt-show-grants/samples/column-grants.sql
Normal file
18
t/pt-show-grants/samples/column-grants.sql
Normal 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;
|
1
t/pt-show-grants/samples/column-grants.txt
Normal file
1
t/pt-show-grants/samples/column-grants.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
--
|
Reference in New Issue
Block a user