Allow initial values to be zero for ReplicaLagLimiter::new(). Return 1/0/death from ReplicaLagLimiter::wait().

This commit is contained in:
Daniel Nichter
2011-09-20 11:28:00 -06:00
parent be9337a202
commit 412e9e4e18
3 changed files with 36 additions and 9 deletions

View File

@@ -38,7 +38,7 @@ if ( !$dbh ) {
plan skip_all => 'Cannot connect to sandbox master';
}
else {
plan tests => 20;
plan tests => 21;
}
my $q = new Quoter();
@@ -447,6 +447,27 @@ is_deeply(
"Change chunk size while nibbling"
) or print STDERR Dumper(\@rows);
# ############################################################################
# Nibble one row at a time.
# ############################################################################
$ni = make_nibble_iter(
sql_file => "a-z.sql",
db => 'test',
tbl => 't',
argv => [qw(--databases test --chunk-size 1)],
);
@rows = ();
while (my $row = $ni->next()) {
push @rows, @$row;
}
is_deeply(
\@rows,
[ ('a'..'z') ],
"Nibble by 1 row"
);
# #############################################################################
# Done.
# #############################################################################

View File

@@ -197,8 +197,8 @@ $rll = new ReplicaLagLimiter(
@lag = (5, 0, 0);
is(
$rll->wait(),
1,
"wait() returns 1 despite timeout if continue=yes"
0,
"wait() returns 0 if timeout and continue=yes"
);
# #############################################################################