X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F93storage_replication.t;h=1cd2d906f16e2ad30d019acd3bd9d0a565d9a271;hb=c23f3cf145aea91ebb0881ac31e1b2593c84232a;hp=ef2092a63f38601f62d15510eaf0c82525c81e2a;hpb=d59cf2f2c53d1c57d62fd3313f22d4a2cbaf5ceb;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/t/93storage_replication.t b/t/93storage_replication.t index ef2092a..1cd2d90 100644 --- a/t/93storage_replication.t +++ b/t/93storage_replication.t @@ -11,9 +11,7 @@ use IO::Handle; BEGIN { eval "use DBIx::Class::Storage::DBI::Replicated; use Test::Moose"; - plan $@ - ? ( skip_all => "Deps not installed: $@" ) - : ( tests => 126 ); + plan skip_all => "Deps not installed: $@" if $@; } use_ok 'DBIx::Class::Storage::DBI::Replicated::Pool'; @@ -253,6 +251,7 @@ my $replicated_class = DBICTest->has_custom_dsn ? my $replicated; for my $method (qw/by_connect_info by_storage_type/) { + undef $replicated; ok $replicated = $replicated_class->new($method) => "Created a replication object $method"; @@ -765,6 +764,20 @@ is $debug{storage_type}, 'REPLICANT', "got last query from a replicant: $debug{d is $debug{storage_type}, 'MASTER', "got last query from a master: $debug{dsn}"; + ok $artist->discard_changes({force_pool=>'master'}) + => 'properly called discard_changes against master (manual attrs)'; + + is $debug{storage_type}, 'MASTER', "got last query from a master: $debug{dsn}"; + + ok $artist->discard_changes() + => 'properly called discard_changes against master (default attrs)'; + + is $debug{storage_type}, 'MASTER', "got last query from a master: $debug{dsn}"; + + ok $artist->discard_changes({force_pool=>$replicant_names[0]}) + => 'properly able to override the default attributes'; + + is $debug{storage_type}, 'REPLICANT', "got last query from a replicant: $debug{dsn}" } ## Test some edge cases, like trying to do a transaction inside a transaction, etc @@ -835,4 +848,6 @@ is $debug{storage_type}, 'REPLICANT', "got last query from a replicant: $debug{d ## Delete the old database files $replicated->cleanup; +done_testing; + # vim: sw=4 sts=4 :