Warn if no slaves are found.

This commit is contained in:
Daniel Nichter
2013-01-03 08:58:58 -07:00
parent d4d081d1e6
commit baded38d2c
2 changed files with 68 additions and 2 deletions

View File

@@ -361,10 +361,11 @@ $output = output(
stderr => 1,
);
# Before 2.2 the exit status was 0, but bug 1087804 changed this to 1.
is(
$exit_status,
0,
"No host in DSN, zero exit status"
1,
"No host in DSN, non-zero exit status"
);
is(
@@ -490,6 +491,55 @@ is(
"Bug 821675 (dot): 0 errors"
);
# #############################################################################
# Bug 1087804: pt-table-checksum doesn't warn if no slaves are found
# #############################################################################
$sb->load_file('master', "$sample/dsn-table.sql");
$master_dbh->do('TRUNCATE TABLE dsns.dsns');
$sb->wait_for_slaves;
my $slave1_dsn = $sb->dsn_for('slave1');
$output = output(
sub { $exit_status = pt_table_checksum::main(@args,
qw(-t sakila.country),
"--recursion-method", "dsn=$slave1_dsn,t=dsns.dsns")
},
stderr => 1,
);
like(
$output,
qr/no slaves were found/,
"Warns if no slaves are found"
);
is(
$exit_status,
1,
'...exit status 1'
);
$output = output(
sub { $exit_status = pt_table_checksum::main(@args,
qw(-t sakila.country),
"--recursion-method", "none")
},
stderr => 1,
);
unlike(
$output,
qr/no slaves were found/,
"No warning if no slaves and --recursion-method=none"
);
is(
$exit_status,
0,
'...exit status 0'
);
# #############################################################################
# Done.
# #############################################################################