Skip to content

Commit 3f624f5

Browse files
committed
chore(tests): Use local server for timeout test
1 parent b770e1b commit 3f624f5

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

tests/resources/app/handlers/api.cfc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,10 @@ component {
7878
);
7979
}
8080

81+
function sleep( event, rc, prc ) {
82+
param rc.delay = 0;
83+
sleep( rc.delay * 1000 );
84+
return event.renderData( type = "plain", statusCode = 200, data = "Slept for #rc.delay# seconds." );
85+
}
86+
8187
}

tests/specs/integration/IncompleteRequestsSpec.cfc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
component extends="tests.resources.ModuleIntegrationSpec" appMapping="/app" {
22

3+
variables.localEndpoint = "http://#CGI[ "server_name" ]#:#CGI[ "server_port" ]#/tests/resources/app/index.cfm/api";
4+
35
function run() {
46
describe( "incomplete requests", function() {
57
beforeEach( function() {
@@ -19,10 +21,7 @@ component extends="tests.resources.ModuleIntegrationSpec" appMapping="/app" {
1921
} );
2022

2123
it( "returns a 408 status code for any request that times out", function() {
22-
var res = hyper.setTimeout( 1 ).get( "https://httpbin.org/delay/5" );
23-
if ( res.getStatusCode() == 503 ) {
24-
skip( "Got a 503 from the server. Skipping test." );
25-
}
24+
var res = hyper.setTimeout( 1 ).get( "#localEndpoint#/sleep/delay/5" );
2625
expect( res.getStatusCode() ).toBe( 408 );
2726
expect( res.getStatusText() ).toBe( "Request Timeout" );
2827
} );

0 commit comments

Comments
 (0)