From: Peter Rabbitson Date: Mon, 27 Dec 2010 03:55:01 +0000 (+0100) Subject: Extra test for Replicated debug (forgotten in 8592e2d1) X-Git-Tag: v0.08125~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9450f31229b89e8dea3736d754ac08d3d617c3ee;p=dbsrgits%2FDBIx-Class.git Extra test for Replicated debug (forgotten in 8592e2d1) --- diff --git a/t/storage/replicated.t b/t/storage/replicated.t index 56d141a..3f813aa 100644 --- a/t/storage/replicated.t +++ b/t/storage/replicated.t @@ -603,7 +603,7 @@ $replicated->schema->storage->replicants->{$replicant_names[1]}->active(0); "got last query from a master: $debug{dsn}"; like $fallback_warning, qr/falling back to master/ - => 'emits falling back to master warning'; + => 'emits falling back to master debug'; $replicated->schema->storage->debugfh($oldfh); } @@ -620,11 +620,23 @@ $replicated->schema->storage->pool->validate_replicants; $replicated->schema->storage->debugobj->silence(0); -ok $replicated->schema->resultset('Artist')->find(2) - => 'Returned to replicates'; +{ + ## catch the fallback to master warning + open my $debugfh, '>', \my $return_warning; + my $oldfh = $replicated->schema->storage->debugfh; + $replicated->schema->storage->debugfh($debugfh); + + ok $replicated->schema->resultset('Artist')->find(2) + => 'Return to replicants'; + + is $debug{storage_type}, 'REPLICANT', + "got last query from a replicant: $debug{dsn}"; -is $debug{storage_type}, 'REPLICANT', - "got last query from a replicant: $debug{dsn}"; + like $return_warning, qr/Moved back to slave/ + => 'emits returning to slave debug'; + + $replicated->schema->storage->debugfh($oldfh); +} ## Getting slave status tests