Add some feedback to the test; shorten spinup delay.
[catagits/Catalyst-Engine-STOMP.git] / t / Catalyst-Engine-Stomp.t
index 9bd5dea..0739f29 100644 (file)
@@ -1,4 +1,4 @@
-use Test::More tests => 12;
+use Test::More;
 
 # Tests which expect a STOMP server like ActiveMQ to exist on
 # localhost:61613, which is what you get if you just get the ActiveMQ
@@ -8,15 +8,29 @@ use Net::Stomp;
 use YAML::XS qw/ Dump Load /;
 use Data::Dumper;
 
+my $stomp;
+eval {
+    $stomp = Net::Stomp->new( { hostname => 'localhost', port => 61613 } );
+};
+if ($@) {
+    plan 'skip_all' => 'No ActiveMQ server listening on 61613: ' . $@;
+    exit;
+}
+else {
+    plan tests => 12;
+}
+
 # First fire off the server
+$SIG{CHLD} = 'IGNORE';
 unless (fork()) {
-       system("$^X -Ilib -Itestapp/lib testapp/script/testapp_stomp.pl --oneshot");
+       system("CATALYST_DEBUG=0 $^X -Ilib -Itestapp/lib testapp/script/testapp_stomp.pl --oneshot");
        exit 0;
 }
+print STDERR "server started, waiting for spinup...";
+sleep 10;
 
 # Now be a client to that server
-
-my $stomp = Net::Stomp->new( { hostname => 'localhost', port => 61613 } );
+print STDERR "testing\n";
 ok($stomp, 'Net::Stomp object');
 
 my $frame = $stomp->connect();