Remove new-table options and enhance error msg if creating new table fails.

This commit is contained in:
Daniel Nichter
2012-03-25 12:24:27 -06:00
parent 3589ec2c7c
commit 82aa518774
3 changed files with 75 additions and 108 deletions
+9 -6
View File
@@ -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,