fixed 5.7 tests for pt-query-digest and pt-show-grants and tweaked SqlMode for global

This commit is contained in:
frank-cizmich
2016-01-10 20:35:20 -03:00
parent b71d8fec09
commit 96aff694b1
242 changed files with 1757 additions and 14 deletions

View File

@@ -13,6 +13,8 @@ use Test::More;
use PerconaTest;
use Sandbox;
use SqlModes;
require "$trunk/bin/pt-show-grants";
my $dp = new DSNParser(opts=>$dsn_opts);
@@ -35,9 +37,14 @@ my $cnf = '/tmp/12345/my.sandbox.cnf';
# Issue 551: mk-show-grants does not support listing all grants for a single
# user (over multiple hosts)
# #############################################################################
# to make creating users easier we remove NO_AUTO_CREATE_USER mode
my $modes = new SqlModes($dbh, global=>1);
$modes->del('NO_AUTO_CREATE_USER');
diag(`/tmp/12345/use -u root -e "GRANT USAGE ON *.* TO 'bob'\@'%'"`);
diag(`/tmp/12345/use -u root -e "GRANT USAGE ON *.* TO 'bob'\@'localhost'"`);
diag(`/tmp/12345/use -u root -e "GRANT USAGE ON *.* TO 'bob'\@'192.168.1.1'"`);
$modes->restore_original_modes;
$output = output(
sub { pt_show_grants::main('-F', $cnf, qw(--only bob --no-header)); }

View File

@@ -13,6 +13,7 @@ use Test::More;
use PerconaTest;
use Sandbox;
use SqlModes;
require "$trunk/bin/pt-show-grants";
my $dp = new DSNParser(opts=>$dsn_opts);
@@ -90,15 +91,17 @@ like(
qr/\d\d:\d\d:\d\d\n\z/,
'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');
# momentarily disable NO_AUTO_CREATE_USER
my $modes = new SqlModes($dbh, global=>1);
$modes->del('NO_AUTO_CREATE_USER');
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'\@'%'"`);
$modes->restore_original_modes();
ok(
no_diff(
sub { pt_show_grants::main('-F', $cnf, qw(--only sally --no-header)) },
@@ -141,6 +144,7 @@ ok(
diag(`/tmp/12345/use -u root -e "DROP USER 'sally'\@'%'"`);
DONE:
# #############################################################################
# Done.
# #############################################################################

View File

@@ -13,6 +13,7 @@ use Test::More;
use PerconaTest;
use Sandbox;
use SqlModes;
require "$trunk/bin/pt-show-grants";
my $dp = new DSNParser(opts=>$dsn_opts);
@@ -34,7 +35,13 @@ my $cnf = '/tmp/12345/my.sandbox.cnf';
# #############################################################################
# Issue 445: mk-show-grants --revoke crashes
# #############################################################################
# allow auto create user for a moment
my $modes = new SqlModes($dbh, global=>1);
$modes->del('NO_AUTO_CREATE_USER');
diag(`/tmp/12345/use -u root -e "GRANT USAGE ON *.* TO ''\@''"`);
$modes->restore_original_modes();
$output = `/tmp/12345/use -e "SELECT user FROM mysql.user WHERE user = ''"`;
like(
$output,

View File

@@ -6,7 +6,7 @@ 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',
`DateRelease` timestamp NOT NULL default CURRENT_TIMESTAMP,
`ActualReleasedDate` timestamp NULL default NULL,
`PckPrice` decimal(10,2) NOT NULL default '0.00',
`Status` varchar(20) NOT NULL,