works but shouldn't
[dbsrgits/DBIx-Class.git] / t / 93storage_replication.t
CommitLineData
e4dc89b3 1use strict;
2use warnings;
3use lib qw(t/lib);
4
5use File::Copy;
6
7use DBICTest;
8
9use Test::More;
10plan tests => 1;
11
12my $schema = DBICTest->init_schema();
13
14$schema->storage_type( '::DBI::Replication' );
15
16
17my $db_file1 = "t/var/DBIxClass.db";
18my $db_file2 = "t/var/DBIxClass_slave1.db";
19my $db_file3 = "t/var/DBIxClass_slave2.db";
20my $dsn1 = $ENV{"DBICTEST_DSN"} || "dbi:SQLite:${db_file1}";
21my $dsn2 = $ENV{"DBICTEST_DSN2"} || "dbi:SQLite:${db_file2}";
22my $dsn3 = $ENV{"DBICTEST_DSN3"} || "dbi:SQLite:${db_file3}";
23
24$schema->connect( [
25 [ $dsn1, '', '', { AutoCommit => 1 } ],
26 [ $dsn2, '', '', { priority => 10 } ],
27 [ $dsn3, '', '', { priority => 10 } ]
28 ]
29 );
30
31$schema->populate('Artist', [
32 [ qw/artistid name/ ],
33 [ 4, 'Ozric Tentacles']
34 ]);
35
36# try and read (should fail)
37my $new_artist = $schema->resultset('Artist')->find(4);
38
39warn "artist : $new_artist\n";
40
41# try and read (should succede after faked synchronisation)
42copy($db_file1, $db_file2);
43
44unlink $db_file2;
45
46ok(1,"These aren't the tests you're looking for");