1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
8 # so we can see the retry exceptions (if any)
9 BEGIN { $ENV{DBIC_STORAGE_RETRY_DEBUG} = 1 }
11 use DBIx::Class::Optional::Dependencies ();
16 for my $type (qw/PG MYSQL SQLite/) {
20 DBIx::Class::Optional::Dependencies->skip_without( 'test_rdbms_' . lc $type );
22 my @dsn = $type eq 'SQLite'
23 ? ( DBICTest->_database(sqlite_use_file => 1) )
24 : ( @ENV{map { "DBICTEST_${type}_${_}" } qw/DSN USER PASS/} )
27 my $schema = DBICTest::Schema->connect (@dsn);
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 ok (!$schema->storage->connected, "$type: start disconnected");
35 $schema->txn_do (sub {
37 ok ($schema->storage->connected, "$type: transaction starts connected");
41 skip "Fork failed: $!", 1 if (! defined $pid);
44 note "Parent $$ sleeping...";
46 note "Parent $$ woken up after child $pid exit";
49 note "Child $$ terminating";
50 undef $DBICTest::FakeSchemaFactory::schema;
54 ok ($schema->storage->connected, "$type: parent still connected (in txn_do)");
58 ok ($schema->storage->connected, "$type: parent still connected (outside of txn_do)");
60 undef $DBICTest::FakeSchemaFactory::schema;