mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-25 21:54:48 +00:00
Fix for 1016131: ptc should skip tables when all its columns are excluded
This commit is contained in:
@@ -26,9 +26,6 @@ my $dbh = $sb->get_dbh_for('master');
|
||||
if ( !$dbh ) {
|
||||
plan skip_all => "Cannot connect to sandbox master";
|
||||
}
|
||||
else {
|
||||
plan tests => 29;
|
||||
}
|
||||
|
||||
$sb->create_dbs($dbh, ['test']);
|
||||
|
||||
@@ -421,9 +418,53 @@ is(
|
||||
'Ignores specified columns'
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
# crash with --columns if none match / --ignore-columns if everything is ignored
|
||||
# https://bugs.launchpad.net/percona-toolkit/+bug/1016131
|
||||
# #############################################################################
|
||||
# Re-using the $tbl from the previous test!
|
||||
local @ARGV = ('--ignore-columns', 'a,b,c');
|
||||
$o->get_opts();
|
||||
local $EVAL_ERROR;
|
||||
eval {
|
||||
$c->make_row_checksum(
|
||||
tbl => $tbl,
|
||||
func => 'CRC32',
|
||||
);
|
||||
};
|
||||
|
||||
like(
|
||||
$EVAL_ERROR,
|
||||
qr/all columns are excluded by --columns or --ignore-columns/,
|
||||
"Dies if all columns are ignored by --ignore-columns"
|
||||
);
|
||||
|
||||
|
||||
$tbl = {
|
||||
db => 'mysql',
|
||||
tbl => 'user',
|
||||
tbl_struct => $tp->parse($tp->get_create_table($dbh, 'mysql', 'user')),
|
||||
};
|
||||
local @ARGV = qw(--columns some_column_that_doesnt_exist);
|
||||
$o->get_opts();
|
||||
local $EVAL_ERROR;
|
||||
eval {
|
||||
$c->make_row_checksum(
|
||||
tbl => $tbl,
|
||||
func => 'SHA1',
|
||||
);
|
||||
};
|
||||
|
||||
like(
|
||||
$EVAL_ERROR,
|
||||
qr/all columns are excluded by --columns or --ignore-columns/,
|
||||
'Dies if all columns are ignored by --columns'
|
||||
);
|
||||
|
||||
# ############################################################################
|
||||
# Done.
|
||||
# ############################################################################
|
||||
$sb->wipe_clean($dbh);
|
||||
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||
exit;
|
||||
|
||||
done_testing;
|
||||
|
Reference in New Issue
Block a user