Changed all the pt-osc tests to use full_output, since output uses eval {}

This commit is contained in:
Brian Fraser fraserb@gmail.com
2012-06-07 17:46:19 -03:00
parent e025b66bd2
commit ba2ddf682b
5 changed files with 15 additions and 21 deletions

View File

@@ -170,8 +170,8 @@ diag('Binlog position before altering table: ', $rows->{file}, '/', $rows->{posi
start_query_table(qw(pt_osc t id));
# While that's ^ happening, alter the table.
$output = output(
sub { $exit = pt_online_schema_change::main(
($output, $exit) = full_output(
sub { pt_online_schema_change::main(
"$master_dsn,D=pt_osc,t=t",
qw(--lock-wait-timeout 5),
qw(--print --execute --chunk-size 100 --alter ENGINE=InnoDB)) },
@@ -188,7 +188,7 @@ is(
$rows->{t}->{engine},
'InnoDB',
"New table ENGINE=InnoDB"
) or warn Dumper($rows);
) or BAIL_OUT("Something went terribly wrong");
is(
scalar keys %$rows,

View File

@@ -51,8 +51,8 @@ my $rows;
$sb->load_file('master', "$sample/basic_no_fks.sql");
$output = output(
sub { $exit = pt_online_schema_change::main(@args, "$dsn,D=pt_osc,t=t",
($output, $exit) = full_output(
sub { pt_online_schema_change::main(@args, "$dsn,D=pt_osc,t=t",
'--alter', 'drop column id') }
);
@@ -139,11 +139,8 @@ sub test_alter_table {
unshift @$orig_tbls, [$new_tbl];
}
# TODO: output() is capturing if this call dies, so if a test
# causes it to die, the tests just stop without saying why, i.e.
# without re-throwing the error.
$output = output(
sub { $exit = pt_online_schema_change::main(
($output, $exit) = full_output(
sub { pt_online_schema_change::main(
@args,
'--print',
"$dsn,D=$db,t=$tbl",
@@ -575,8 +572,8 @@ sub test_table {
my $org_rows = $master_dbh->selectall_arrayref('select * from osc.t order by id');
$output = output(
sub { $exit = pt_online_schema_change::main(@args,
($output, $exit) = full_output(
sub { pt_online_schema_change::main(@args,
"$dsn,D=osc,t=t", qw(--execute --alter ENGINE=InnoDB)) },
stderr => 1,
);

View File

@@ -46,8 +46,8 @@ my $sample = "t/pt-online-schema-change/samples/";
# ############################################################################
$sb->load_file('master', "$sample/pk-bug-994002.sql");
$output = output(
sub { $exit_status = pt_online_schema_change::main(@args,
($output, $exit_status) = full_output(
sub { pt_online_schema_change::main(@args,
"$master_dsn,D=test,t=t",
"--alter", "add column (foo int)",
qw(--chunk-size 2 --dry-run --print)) },
@@ -71,7 +71,7 @@ unlike(
# ############################################################################
$sb->load_file('master', "$sample/bug-1002448.sql");
$output = output(
($output, $exit_status) = full_output(
sub { pt_online_schema_change::main(@args,
"$master_dsn,D=test1002448,t=table_name",
"--alter", "add column (foo int)",

View File

@@ -56,7 +56,7 @@ PerconaTest::wait_for_table($slave1_dbh, "mysql.tables_priv", "user='osc_user'")
$sb->load_file('master', "$sample/basic_no_fks.sql");
$output = output(
($output, $exit_status) = full_output(
sub { $exit_status = pt_online_schema_change::main(@args,
"$master_dsn,u=osc_user,D=pt_osc,t=t", '--alter', 'drop column id',
qw(--execute),

View File

@@ -31,14 +31,11 @@ else {
my $master_dsn = 'h=127.1,P=12348,u=msandbox,p=msandbox';
my @args = (qw(--lock-wait-timeout 3), '--max-load', '');
my $output;
my $retval;
$output = output(
sub { $retval = pt_online_schema_change::main(@args,
my ($output, $retval) = full_output(
sub { pt_online_schema_change::main(@args,
"$master_dsn,D=mysql,t=user", "--alter", "add column (foo int)",
qw(--dry-run)) },
stderr => 1,
);
like(