@@ -360,7 +360,7 @@ heartbeat.monitors:
360360 let requests : Array < any > = [ ] ;
361361 let proxyServer : Straightforward ;
362362 let tlsServer ;
363- let proxyPort : number ;
363+ let proxyUrl : string ;
364364
365365 beforeAll ( async ( ) => {
366366 proxyServer = new Straightforward ( ) ;
@@ -372,7 +372,8 @@ heartbeat.monitors:
372372 tlsServer = await createKibanaTestServer ( '8.6.0' , true , ( req : any ) =>
373373 requests . push ( req )
374374 ) ;
375- ( { port : proxyPort } = proxyServer . server . address ( ) as AddressInfo ) ;
375+ const server = proxyServer . server . address ( ) as AddressInfo ;
376+ proxyUrl = `http://localhost:${ server . port } ` ;
376377 } ) ;
377378
378379 afterAll ( async ( ) => {
@@ -398,7 +399,7 @@ heartbeat.monitors:
398399 ) ;
399400 const output = await runPush ( [ ...DEFAULT_ARGS , '--tags' , 'chunk' ] , {
400401 CHUNK_SIZE : '1' ,
401- HTTP_PROXY : `http://localhost: ${ proxyPort } ` ,
402+ HTTP_PROXY : proxyUrl ,
402403 } ) ;
403404 await rm ( testJourney , { force : true } ) ;
404405 expect ( output ) . toContain ( 'Added(2)' ) ;
@@ -421,7 +422,7 @@ heartbeat.monitors:
421422 ) ;
422423 const output = await runPush ( [ ...DEFAULT_ARGS , '--tags' , 'chunk' ] , {
423424 CHUNK_SIZE : '1' ,
424- HTTP_PROXY : `http://localhost: ${ proxyPort } ` ,
425+ HTTP_PROXY : proxyUrl ,
425426 NO_PROXY : '*' ,
426427 } ) ;
427428 await rm ( testJourney , { force : true } ) ;
@@ -451,7 +452,7 @@ heartbeat.monitors:
451452 ) ;
452453 const output = await runPush ( [ ...DEFAULT_ARGS , '--tags' , 'chunk' ] , {
453454 CHUNK_SIZE : '1' ,
454- HTTPS_PROXY : `http://localhost: ${ proxyPort } ` ,
455+ HTTPS_PROXY : proxyUrl ,
455456 NODE_TLS_REJECT_UNAUTHORIZED : '0' ,
456457 } ) ;
457458 await rm ( testJourney , { force : true } ) ;
@@ -465,7 +466,7 @@ heartbeat.monitors:
465466 await fakeProjectSetup (
466467 {
467468 project : { id : 'test-project' , space : 'dummy' , url : server . PREFIX } ,
468- proxy : { uri : `http://localhost: ${ proxyPort } ` } ,
469+ proxy : { uri : proxyUrl } ,
469470 } ,
470471 { locations : [ 'test-loc' ] , schedule : 3 }
471472 ) ;
@@ -477,13 +478,7 @@ heartbeat.monitors:
477478 journey('b', () => monitor.use({ tags: ['chunk'] }));`
478479 ) ;
479480 const output = await runPush (
480- [
481- ...DEFAULT_ARGS ,
482- '--tags' ,
483- 'chunk' ,
484- '--proxy-uri' ,
485- `http://localhost:${ proxyPort } ` ,
486- ] ,
481+ [ ...DEFAULT_ARGS , '--tags' , 'chunk' , '--proxy-uri' , proxyUrl ] ,
487482 {
488483 CHUNK_SIZE : '1' ,
489484 }
@@ -499,7 +494,7 @@ heartbeat.monitors:
499494 await fakeProjectSetup (
500495 {
501496 project : { id : 'test-project' , space : 'dummy' , url : server . PREFIX } ,
502- proxy : { uri : `http://localhost: ${ proxyPort } ` } ,
497+ proxy : { uri : proxyUrl } ,
503498 } ,
504499 { locations : [ 'test-loc' ] , schedule : 3 }
505500 ) ;
0 commit comments