@@ -28,7 +28,7 @@ const {
2828integrationContext ( 'endpoint timeouts' , function ( ) {
2929 describe ( 'slow backend' , ( ) => {
3030 it ( 'backend response status code is 0 when sleeping longer than configured 500ms' , async ( ) => {
31- const res = await httpGet ( gatewayUrl ( 'bubbles' , `/?sleep=${ 1000 * 60 * 60 * 24 } ` ) , {
31+ const res = await httpGet ( gatewayUrl ( 'bubbles' , `/?sleep=${ 60 * 60 * 24 } ` ) , {
3232 headers : { 'X-Route' : 'endpoint=Slow.Backend' }
3333 } )
3434 const { gateway : { endpoints } } = JSON . parse ( res . body )
@@ -49,4 +49,28 @@ integrationContext('endpoint timeouts', function () {
4949 )
5050 } )
5151 } )
52+
53+ describe ( 'other slow backend' , ( ) => {
54+ it ( 'backend response status code is 0 when sleeping longer than globally configured 2s' , async ( ) => {
55+ const res = await httpGet ( gatewayUrl ( 'bubbles' , `/?sleep=${ 60 * 60 * 24 } ` ) , {
56+ headers : { 'X-Route' : 'endpoint=OtherSlow.Backend' }
57+ } )
58+ const { gateway : { endpoints } } = JSON . parse ( res . body )
59+ assert . equal (
60+ endpoints [ 'OtherSlow.Backend' ] . responseCode ,
61+ 0
62+ )
63+ } )
64+
65+ it ( 'backend response status code is OK when fast enough' , async ( ) => {
66+ const res = await httpGet ( gatewayUrl ( 'bubbles' , '/?sleep=1' ) , {
67+ headers : { 'X-Route' : 'endpoint=OtherSlow.Backend' }
68+ } )
69+ const { gateway : { endpoints } } = JSON . parse ( res . body )
70+ assert . equal (
71+ endpoints [ 'OtherSlow.Backend' ] . responseCode ,
72+ httpcode . OK
73+ )
74+ } )
75+ } )
5276} )
0 commit comments