Fix for 1016131: ptc should skip tables when all its columns are excluded

This commit is contained in:
Brian Fraser
2012-08-02 11:29:57 -03:00
parent cc3826f665
commit 94a5d85212
4 changed files with 85 additions and 10 deletions

View File

@@ -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;