From: Aaron Trevena Date: Tue, 4 Mar 2008 20:18:45 +0000 (+0000) Subject: works but shouldn't X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e4dc89b33b2390f8baaf4f553074794d257c43d7;p=dbsrgits%2FDBIx-Class-Historic.git works but shouldn't --- diff --git a/t/93storage_replication.t b/t/93storage_replication.t new file mode 100644 index 0000000..f903ad4 --- /dev/null +++ b/t/93storage_replication.t @@ -0,0 +1,46 @@ +use strict; +use warnings; +use lib qw(t/lib); + +use File::Copy; + +use DBICTest; + +use Test::More; +plan tests => 1; + +my $schema = DBICTest->init_schema(); + +$schema->storage_type( '::DBI::Replication' ); + + +my $db_file1 = "t/var/DBIxClass.db"; +my $db_file2 = "t/var/DBIxClass_slave1.db"; +my $db_file3 = "t/var/DBIxClass_slave2.db"; +my $dsn1 = $ENV{"DBICTEST_DSN"} || "dbi:SQLite:${db_file1}"; +my $dsn2 = $ENV{"DBICTEST_DSN2"} || "dbi:SQLite:${db_file2}"; +my $dsn3 = $ENV{"DBICTEST_DSN3"} || "dbi:SQLite:${db_file3}"; + +$schema->connect( [ + [ $dsn1, '', '', { AutoCommit => 1 } ], + [ $dsn2, '', '', { priority => 10 } ], + [ $dsn3, '', '', { priority => 10 } ] + ] + ); + +$schema->populate('Artist', [ + [ qw/artistid name/ ], + [ 4, 'Ozric Tentacles'] + ]); + +# try and read (should fail) +my $new_artist = $schema->resultset('Artist')->find(4); + +warn "artist : $new_artist\n"; + +# try and read (should succede after faked synchronisation) +copy($db_file1, $db_file2); + +unlink $db_file2; + +ok(1,"These aren't the tests you're looking for");