7 use DBIx::Class::Optional::Dependencies ();
12 for my $type (qw/PG MYSQL/) {
15 skip "Skipping $type tests without DBICTEST_${type}_DSN", 1
16 unless $ENV{"DBICTEST_${type}_DSN"};
19 skip "skipping Pg tests without dependencies installed", 1
20 unless DBIx::Class::Optional::Dependencies->req_ok_for('test_rdbms_pg');
22 elsif ($type eq 'MYSQL') {
23 skip "skipping MySQL tests without dependencies installed", 1
24 unless DBIx::Class::Optional::Dependencies->req_ok_for('test_rdbms_mysql');
27 my $schema = DBICTest::Schema->connect (@ENV{map { "DBICTEST_${type}_${_}" } qw/DSN USER PASS/});
29 # emulate a singleton-factory, just cache the object *somewhere in a different package*
30 # to induce out-of-order destruction
31 $DBICTest::FakeSchemaFactory::schema = $schema;
33 # so we can see the retry exceptions (if any)
34 $ENV{DBIC_DBIRETRY_DEBUG} = 1;
36 ok (!$schema->storage->connected, "$type: start disconnected");
39 $schema->txn_do (sub {
41 ok ($schema->storage->connected, "$type: transaction starts connected");
45 skip "Fork failed: $!", 1 if (! defined $pid);
48 note "Parent $$ sleeping...";
50 note "Parent $$ woken up after child $pid exit";
53 note "Child $$ terminating";
57 ok ($schema->storage->connected, "$type: parent still connected (in txn_do)");
62 ok ($schema->storage->connected, "$type: parent still connected (outside of txn_do)");
64 undef $DBICTest::FakeSchemaFactory::schema;