mirror of
https://github.com/percona/percona-toolkit.git
synced 2026-04-26 01:02:25 +08:00
Remove new-table options and enhance error msg if creating new table fails.
This commit is contained in:
@@ -29,7 +29,7 @@ if ( !$master_dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox master';
|
||||
}
|
||||
else {
|
||||
plan tests => 42;
|
||||
plan tests => 43;
|
||||
}
|
||||
|
||||
my $q = new Quoter();
|
||||
@@ -48,13 +48,9 @@ my $rows;
|
||||
$sb->load_file('master', "$sample/basic_no_fks.sql");
|
||||
PerconaTest::wait_for_table($slave_dbh, "pt_osc.t", "id=20");
|
||||
|
||||
# --new-table really ensures the tool exists before doing stuff because
|
||||
# setting up the new table is the first thing the tool does and this would
|
||||
# cause an error because mysql.user already exists. To prove this, add
|
||||
# --dry-run and the test will fail because the code doesn't exit early.
|
||||
$output = output(
|
||||
sub { $exit = pt_online_schema_change::main(@args, "$dsn,t=pt_osc.t",
|
||||
qw(--new-table mysql.user)) }
|
||||
'--alter', 'drop column id') }
|
||||
);
|
||||
|
||||
like(
|
||||
@@ -63,6 +59,13 @@ like(
|
||||
"Doesn't run without --execute (bug 933232)"
|
||||
);
|
||||
|
||||
my $ddl = $master_dbh->selectrow_arrayref("show create table pt_osc.t");
|
||||
like(
|
||||
$ddl->[1],
|
||||
qr/^\s+`id`/m,
|
||||
"Did not alter the table"
|
||||
);
|
||||
|
||||
is(
|
||||
$exit,
|
||||
0,
|
||||
|
||||
Reference in New Issue
Block a user