# set a *DBI* disconnect callback, to make sure the physical SQLite
# file is still there (i.e. the test does not attempt to delete
# an open database, which fails on Win32)
- if (my $guard_cb = __mk_disconnect_guard($db_file)) {
+ if (! $storage->{master} and my $guard_cb = __mk_disconnect_guard($db_file)) {
$dbh->{Callbacks} = {
connect => sub { $guard_cb->('connect') },
disconnect => sub { $guard_cb->('disconnect') },
my $schema;
+ if (
+ $ENV{DBICTEST_VIA_REPLICATED} &&=
+ ( !$args{storage_type} && !defined $args{sqlite_use_file} )
+ ) {
+ $args{storage_type} = ['::DBI::Replicated', { balancer_type => '::Random' }];
+ $args{sqlite_use_file} = 1;
+ }
+
+ my @dsn = $self->_database(%args);
+
if ($args{compose_connection}) {
$need_global_cleanup = 1;
$schema = DBICTest::Schema->compose_connection(
- 'DBICTest', $self->_database(%args)
+ 'DBICTest', @dsn
);
} else {
$schema = DBICTest::Schema->compose_namespace('DBICTest');
}
if ( !$args{no_connect} ) {
- $schema = $schema->connect($self->_database(%args));
+ $schema->connection(@dsn);
+
+ $schema->storage->connect_replicants(\@dsn)
+ if $ENV{DBICTEST_VIA_REPLICATED};
}
if ( !$args{no_deploy} ) {