Test fixes for remote servers
Andy Grundman [Sun, 26 Mar 2006 16:41:58 +0000 (16:41 +0000)]
t/live_engine_request_uploads.t
t/live_loop.t
t/live_recursion.t

index bc43716..d0eeb7d 100644 (file)
@@ -155,11 +155,19 @@ use HTTP::Request::Common;
           [ 'file' => ["$FindBin::Bin/catalyst_130pix.gif"], ]
     );
 
-    # Sending wrong Content-Length here and see if subequent requests fail
-    $request->header('Content-Length' => $request->header('Content-Length') + 1);
+    # LWP will auto-correct Content-Length when using a remote server
+    SKIP:
+    {
+        if ( $ENV{CATALYST_SERVER} ) {
+            skip 'Using remote server', 2;
+        }
 
-    ok( my $response = request($request), 'Request' );
-    ok( !$response->is_success, 'Response Error' );
+        # Sending wrong Content-Length here and see if subequent requests fail
+        $request->header('Content-Length' => $request->header('Content-Length') + 1);
+
+        ok( my $response = request($request), 'Request' );
+        ok( !$response->is_success, 'Response Error' );
+    }
 
     $request = POST(
         'http://localhost/dump/request',
@@ -169,7 +177,7 @@ use HTTP::Request::Common;
             'file2' => ["$FindBin::Bin/catalyst_130pix.gif"], ]
     );
 
-    ok( $response = request($request), 'Request' );
+    ok( my $response = request($request), 'Request' );
     ok( $response->is_success, 'Response Successful 2xx' );
     is( $response->content_type, 'text/plain', 'Response Content-Type' );
     like( $response->content, qr/file1 => bless/, 'Upload with name file1');
index 23f2ad2..34fea5f 100644 (file)
@@ -9,6 +9,15 @@ use lib "$FindBin::Bin/lib";
 use Test::More tests => 3;
 use Catalyst::Test 'TestApp';
 
-ok( my $response = request('http://localhost/loop_test'), 'Request' );
-ok( $response->is_success, 'Response Successful 2xx' );
-ok( $response->header('X-Class-Forward-Test-Method'), 'Loop OK' );
+SKIP:
+{
+    # Net::HTTP::Methods crashes when talking to a remote server because this
+    # test causes a very long header line to be sent
+    if ( $ENV{CATALYST_SERVER} ) {
+        skip 'Using remote server', 3;
+    }
+
+    ok( my $response = request('http://localhost/loop_test'), 'Request' );
+    ok( $response->is_success, 'Response Successful 2xx' );
+    ok( $response->header('X-Class-Forward-Test-Method'), 'Loop OK' );
+}
index 2c766fd..6e55877 100644 (file)
@@ -11,6 +11,15 @@ use Catalyst::Test 'TestApp';
 
 local $^W = 0;
 
-ok( my $response = request('http://localhost/recursion_test'), 'Request' );
-ok( !$response->is_success, 'Response Not Successful' );
-is( $response->header('X-Catalyst-Error'), 'Deep recursion detected calling "/recursion_test"', 'Deep Recursion Detected' );
+SKIP:
+{
+    # Net::HTTP::Methods crashes when talking to a remote server because this
+    # test causes a very long header line to be sent
+    if ( $ENV{CATALYST_SERVER} ) {
+        skip 'Using remote server', 3;
+    }
+
+    ok( my $response = request('http://localhost/recursion_test'), 'Request' );
+    ok( !$response->is_success, 'Response Not Successful' );
+    is( $response->header('X-Catalyst-Error'), 'Deep recursion detected calling "/recursion_test"', 'Deep Recursion Detected' );
+}