PT-1448 Updated test for pt-show-grant MySQL 8 support

This commit is contained in:
Carlos Salguero
2018-03-30 20:08:04 -03:00
parent cec7e7d052
commit cc99db8ddd
2 changed files with 6 additions and 5 deletions

View File

@@ -1922,7 +1922,8 @@ sub main {
my $ignore_users = $o->get('ignore'); my $ignore_users = $o->get('ignore');
my $exit_status = 0; my $exit_status = 0;
if (my $roles = get_roles($dbh)) { my $roles = get_roles($dbh);
if ($roles && scalar @$roles > 0) {
print "-- Roles\n"; print "-- Roles\n";
my $count=0; my $count=0;
@@ -1940,7 +1941,7 @@ sub main {
USER: USER:
foreach my $u ( @$users ) { foreach my $u ( @$users ) {
my $user_host = "`$u->{User}`\@`$u->{Host}`"; my $user_host = "'$u->{User}'\@'$u->{Host}'";
if ( $ignore_users && $ignore_users->{$user_host} ) { if ( $ignore_users && $ignore_users->{$user_host} ) {
PTDEBUG && _d('Ignoring user', $user_host); PTDEBUG && _d('Ignoring user', $user_host);
next USER; next USER;
@@ -2115,7 +2116,6 @@ __EOQ
my $roles; my $roles;
eval { $roles = $dbh->selectall_arrayref($query, { Slice => {} }) }; eval { $roles = $dbh->selectall_arrayref($query, { Slice => {} }) };
if ($EVAL_ERROR) { if ($EVAL_ERROR) {
warn "Cannot list roles: $EVAL_ERROR";
PTDEBUG && _d("Cannot list roles: $EVAL_ERROR"); PTDEBUG && _d("Cannot list roles: $EVAL_ERROR");
} }
return $roles; return $roles;

View File

@@ -82,8 +82,9 @@ unlike(
'It has no timestamp', 'It has no timestamp',
); );
# 'mysql.infoschema'@'localhost' user only exists on MySQL 8.0+
$output = output( $output = output(
sub { pt_show_grants::main('-F', $cnf, '--ignore', 'baron,msandbox,root,root@localhost,user,mysql.session@localhost,mysql.sys@localhost,sys'); } sub { pt_show_grants::main('-F', $cnf, '--ignore', 'baron,msandbox,root,root@localhost,user,mysql.session@localhost,mysql.sys@localhost,sys,mysql.infoschema@localhost'); }
); );
unlike( unlike(
$output, $output,
@@ -94,7 +95,7 @@ like(
$output, $output,
qr/\d\d:\d\d:\d\d\n\z/, qr/\d\d:\d\d:\d\d\n\z/,
'No output when all users skipped' 'No output when all users skipped'
); ) or diag($output);
# ############################################################################# # #############################################################################
# pt-show-grant doesn't support column-level grants # pt-show-grant doesn't support column-level grants
# https://bugs.launchpad.net/percona-toolkit/+bug/866075 # https://bugs.launchpad.net/percona-toolkit/+bug/866075