Back in
8b60b9211a I made a number of mistakes implementing the escape
checks: an envvar being set does not mean we are in fact running under
replication (e.g. the user requested explicitly use_file => 0 )
Fix that and also make sure we still run when use_file => 1 (and fix a
forgotten test failing this way)
# Skip the heavy-duty leak tracing when just doing an install
# or when having Moose crap all over everything
+# FIXME - remove when Replicated gets off Moose
if ( !$ENV{DBICTEST_VIA_REPLICATED} and !DBICTest::RunMode->is_plain ) {
# redefine the bless override so that we can catch each and every object created
sqlite_use_file => 1,
);
+ my $storage = $schema->storage;
+ $storage = $storage->master
+ if $storage->isa('DBIx::Class::Storage::DBI::Replicated');
+
my $admin = DBIx::Class::Admin->new(
schema_class=> "DBICTest::Schema",
- connect_info => $schema->storage->connect_info(),
+ connect_info => $storage->connect_info(),
quiet => 1,
_confirm=>1,
);
my $storage = $schema->storage;
- if ($ENV{DBICTEST_VIA_REPLICATED}) {
+ if( $storage->isa('DBIx::Class::Storage::DBI::Replicated') ) {
$storage = $storage->master;
}
else {
my $schema;
if (
- $ENV{DBICTEST_VIA_REPLICATED} &&=
- ( !$args{storage_type} && !defined $args{sqlite_use_file} )
+ $ENV{DBICTEST_VIA_REPLICATED} &&= (
+ !$args{storage_type}
+ &&
+ ( ! defined $args{sqlite_use_file} or $args{sqlite_use_file} )
+ )
) {
$args{storage_type} = ['::DBI::Replicated', { balancer_type => '::Random' }];
$args{sqlite_use_file} = 1;
ref($storage),
'DBIx::Class::Storage::DBI::SQLite',
'Storage reblessed correctly into DBIx::Class::Storage::DBI::SQLite'
-) unless $ENV{DBICTEST_VIA_REPLICATED};
+) unless $storage->isa('DBIx::Class::Storage::DBI::Replicated');
throws_ok {
$schema->storage->throw_exception('test_exception_42');
};
}
-
# testing various invocations of connect_info ([ ... ])
my $coderef = sub { 42 };
my $schema = DBICTest->init_schema();
my $storage = $schema->storage;
-
$storage = $storage->master
- if $ENV{DBICTEST_VIA_REPLICATED};
-
+ if $storage->isa('DBIx::Class::Storage::DBI::Replicated');
# test (re)connection
for my $disconnect (0, 1) {
);
my $storage = $s->storage;
- $storage = $storage->master if $ENV{DBICTEST_VIA_REPLICATED};
+ $storage = $storage->master
+ if $storage->isa('DBIx::Class::Storage::DBI::Replicated');
ok( ! $storage->connected, 'Starting unconnected' );
my $s = DBICTest->init_schema( no_deploy => 1, @$conn_args );
my $storage = $s->storage;
- $storage = $storage->master if $ENV{DBICTEST_VIA_REPLICATED};
+ $storage = $storage->master
+ if $storage->isa('DBIx::Class::Storage::DBI::Replicated');
my $desc = "broken on_disconnect action @{[ explain $conn_args ]}";