Clarify $rs->update/delete documentation
[dbsrgits/DBIx-Class.git] / t / 50fork.t
index d42c0f4..df6957c 100644 (file)
@@ -18,7 +18,7 @@ if($num_children !~ /^[0-9]+$/ || $num_children < 10) {
    $num_children = 10;
 }
 
-plan tests => $num_children + 5;
+plan tests => $num_children + 6;
 
 use lib qw(t/lib);
 
@@ -34,7 +34,7 @@ eval {
     {
         local $SIG{__WARN__} = sub {};
         eval { $dbh->do("DROP TABLE cd") };
-        $dbh->do("CREATE TABLE cd (cdid serial PRIMARY KEY, artist INTEGER NOT NULL UNIQUE, title VARCHAR(255) NOT NULL UNIQUE, year VARCHAR(255));");
+        $dbh->do("CREATE TABLE cd (cdid serial PRIMARY KEY, artist INTEGER NOT NULL UNIQUE, title VARCHAR(100) NOT NULL UNIQUE, year VARCHAR(100) NOT NULL, genreid INTEGER, single_track INTEGER);");
     }
 
     $schema->resultset('CD')->create({ title => 'vacation in antarctica', artist => 123, year => 1901 });
@@ -45,6 +45,23 @@ eval {
 };
 ok(!$@) or diag "Creation eval failed: $@";
 
+{
+    my $pid = fork;
+    if(!defined $pid) {
+        die "fork failed: $!";
+    }
+
+    if (!$pid) {
+        exit $schema->storage->connected ? 1 : 0;
+    }
+
+    if (waitpid($pid, 0) == $pid) {
+        my $ex = $? >> 8;
+        ok($ex == 0, "storage->connected() returns false in child");
+        exit $ex if $ex; # skip remaining tests
+    }
+}
+
 my @pids;
 while(@pids < $num_children) {