added a test application to get the new scripts working
[catagits/Catalyst-Runtime.git] / t / start_fcgi.t
CommitLineData
cc999ce2 1use Test::More tests => 1;
2use strict;
3use warnings;
4
5BEGIN { $ENV{CATALYST_ENGINE} ||= 'FastCGI' }
6use File::Temp qw/ tempdir tmpnam /;
7use FindBin qw/$Bin/;
8use File::Spec;
9use lib "$Bin/TestApp/lib";
10use TestApp;
11use Test::WWW::Mechanize;
12
13my $dir = tempdir(); # CLEANUP => 1 );
14my $devnull = File::Spec->devnull;
15
16my $server_path = File::Spec->catfile('script', 'testapp_fastcgi.pl');
17my $port = int(rand(10000)) + 40000; # get random port between 40000-50000
18
19my $childpid = fork();
20die "fork() error, cannot continue" unless defined($childpid);
21
22if ($childpid == 0) {
23 system("$^X $server_path -p $port > $devnull 2>&1");
24 exit; # just for sure; we should never got here
25}
26
27sleep 10; #wait for catalyst application to start
28my $mech = Test::WWW::Mechanize->new;
29$mech->get_ok( "http://localhost:" . $port );
30
31kill 'KILL', $childpid;
32
33