works but shouldn't
[dbsrgits/DBIx-Class.git] / t / 93storage_replication.t
1 use strict;
2 use warnings;
3 use lib qw(t/lib);
4
5 use File::Copy;
6
7 use DBICTest;
8
9 use Test::More;
10 plan tests => 1;
11
12 my $schema = DBICTest->init_schema();
13
14 $schema->storage_type( '::DBI::Replication' );
15
16
17 my $db_file1 = "t/var/DBIxClass.db";
18 my $db_file2 = "t/var/DBIxClass_slave1.db";
19 my $db_file3 = "t/var/DBIxClass_slave2.db";
20 my $dsn1 = $ENV{"DBICTEST_DSN"} || "dbi:SQLite:${db_file1}";
21 my $dsn2 = $ENV{"DBICTEST_DSN2"} || "dbi:SQLite:${db_file2}";
22 my $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)
37 my $new_artist = $schema->resultset('Artist')->find(4);
38
39 warn "artist : $new_artist\n";
40
41 # try and read (should succede after faked synchronisation)
42 copy($db_file1, $db_file2);
43
44 unlink $db_file2;
45
46 ok(1,"These aren't the tests you're looking for");