From: Andy Grundman Date: Mon, 17 Oct 2005 17:58:09 +0000 (+0000) Subject: Added a test script to auto-test the standalone server X-Git-Tag: 5.7099_04~1207 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=040850b3a4a5f2bff1bbce5231d9ee4848d32362 Added a test script to auto-test the standalone server --- diff --git a/t/optional/01http-server.ot b/t/optional/01http-server.ot new file mode 100644 index 0000000..3520be1 --- /dev/null +++ b/t/optional/01http-server.ot @@ -0,0 +1,37 @@ +#!perl + +use strict; +use warnings; + +use File::Copy::Recursive; +use File::Path; +use FindBin; + +# clean up +rmtree "$FindBin::Bin/../../t/var" if -d "$FindBin::Bin/../../t/var"; + +# create a TestApp and copy the test libs into it +mkdir "$FindBin::Bin/../../t/var"; +chdir "$FindBin::Bin/../../t/var"; +system "$FindBin::Bin/../../script/catalyst.pl TestApp"; +chdir "$FindBin::Bin/../.."; +File::Copy::Recursive::dircopy( 't/live/lib', 't/var/TestApp/lib' ); + +# spawn the standalone HTTP server +my $pid = open SERVER, + "$FindBin::Bin/../../t/var/TestApp/script/testapp_server.pl 2>&1 |" + or die "Unable to spawn standalone HTTP server: $!"; + +# wait for it to start +sleep 2; + +# run the testsuite against the HTTP server +$ENV{CATALYST_SERVER} = 'http://localhost:3000'; +system( 'prove -r -Ilib/ t/live/' ); + +# shut it down +kill 2, $pid; +close SERVER; + +# clean up +rmtree "$FindBin::Bin/../../t/var" if -d "$FindBin::Bin/../../t/var";