@@ -8,10 +8,11 @@ const async = require('async');
88const Redis = require ( 'ioredis' ) ;
99
1010const conf = require ( '../../config.json' ) ;
11+ const { config } = require ( '../../../../lib/Config' ) ;
1112
1213const redis = new Redis ( {
13- host : conf . localCache . host ,
14- port : conf . localCache . port ,
14+ host : config . localCache . host ,
15+ port : config . localCache . port ,
1516 // disable offline queue
1617 enableOfflineQueue : false ,
1718} ) ;
@@ -23,7 +24,7 @@ const transport = transportStr === 'http' ? http : https;
2324const options = {
2425 host : conf . ipAddress ,
2526 path : '/live' ,
26- port : 8002 ,
27+ port : config . metricsPort || 8002 ,
2728} ;
2829
2930function checkResult ( expectedStatus , res ) {
@@ -55,7 +56,7 @@ function makeDummyS3Request(cb) {
5556 const getOptions = deepCopy ( options ) ;
5657 getOptions . path = '/foo/bar' ;
5758 getOptions . method = 'GET' ;
58- getOptions . port = 8000 ;
59+ getOptions . port = config . port || 8000 ;
5960 getOptions . agent = makeAgent ( ) ;
6061 const req = transport . request ( getOptions ) ;
6162 req . end ( ( ) => cb ( ) ) ;
@@ -106,6 +107,30 @@ describe('Healthcheck routes', () => {
106107 } ) ;
107108} ) ;
108109
110+ if ( config . healthChecks . enableInternalRoute ) {
111+ describe ( 'Healthcheck s3 port internal routes' , ( ) => {
112+ it ( 'should return 200 OK on GET request' , done => {
113+ const getOptions = deepCopy ( options ) ;
114+ getOptions . method = 'GET' ;
115+ getOptions . path = '/_/healthcheck' ;
116+ getOptions . port = config . port || 8000 ;
117+ getOptions . agent = makeAgent ( ) ;
118+ const req = transport . request ( getOptions , makeChecker ( 200 , done ) ) ;
119+ req . end ( ) ;
120+ } ) ;
121+
122+ it ( 'should return 200 on deep GET request' , done => {
123+ const deepOptions = deepCopy ( options ) ;
124+ deepOptions . method = 'GET' ;
125+ deepOptions . path = '/_/healthcheck/deep' ;
126+ deepOptions . port = config . port || 8000 ;
127+ deepOptions . agent = makeAgent ( ) ;
128+ const req = transport . request ( deepOptions , makeChecker ( 200 , done ) ) ;
129+ req . end ( ) ;
130+ } ) ;
131+ } ) ;
132+ }
133+
109134describe ( 'Healthcheck stats' , ( ) => {
110135 const totalReqs = 5 ;
111136 beforeEach ( done => {
0 commit comments