@@ -622,49 +622,52 @@ test("getProxyBinaryPath - returns path from tool cache if available", async (t)
622622} ) ;
623623
624624test ( "getProxyBinaryPath - downloads proxy if not in cache" , async ( t ) => {
625+ const logger = new RecordingLogger ( ) ;
625626 const downloadUrl = "url-we-want" ;
626627 mockGetReleaseByTag ( [
627628 { name : startProxyExports . getProxyPackage ( ) , url : downloadUrl } ,
628629 ] ) ;
629630
630- await withRecordingLoggerAsync ( async ( logger ) => {
631- const toolcachePath = "/path/to/proxy/dir" ;
632- const find = sinon . stub ( toolcache , "find" ) . returns ( "" ) ;
633- const getApiDetails = sinon . stub ( apiClient , "getApiDetails" ) . returns ( {
634- auth : "" ,
635- url : "" ,
636- apiURL : "" ,
637- } ) ;
638- const getAuthorizationHeaderFor = sinon
639- . stub ( apiClient , "getAuthorizationHeaderFor" )
640- . returns ( undefined ) ;
641- const archivePath = "/path/to/archive" ;
642- const downloadTool = sinon
643- . stub ( toolcache , "downloadTool" )
644- . resolves ( archivePath ) ;
645- const extractedPath = "/path/to/extracted" ;
646- const extractTar = sinon
647- . stub ( toolcache , "extractTar" )
648- . resolves ( extractedPath ) ;
649- const cacheDir = sinon . stub ( toolcache , "cacheDir" ) . resolves ( toolcachePath ) ;
631+ const toolcachePath = "/path/to/proxy/dir" ;
632+ const find = sinon . stub ( toolcache , "find" ) . returns ( "" ) ;
633+ const getApiDetails = sinon . stub ( apiClient , "getApiDetails" ) . returns ( {
634+ auth : "" ,
635+ url : "" ,
636+ apiURL : "" ,
637+ } ) ;
638+ const getAuthorizationHeaderFor = sinon
639+ . stub ( apiClient , "getAuthorizationHeaderFor" )
640+ . returns ( undefined ) ;
641+ const archivePath = "/path/to/archive" ;
642+ const downloadTool = sinon
643+ . stub ( toolcache , "downloadTool" )
644+ . resolves ( archivePath ) ;
645+ const extractedPath = "/path/to/extracted" ;
646+ const extractTar = sinon
647+ . stub ( toolcache , "extractTar" )
648+ . resolves ( extractedPath ) ;
649+ const cacheDir = sinon . stub ( toolcache , "cacheDir" ) . resolves ( toolcachePath ) ;
650+
651+ const path = await startProxyExports . getProxyBinaryPath (
652+ logger ,
653+ createFeatures ( [ ] ) ,
654+ ) ;
650655
651- const path = await startProxyExports . getProxyBinaryPath (
652- logger ,
653- createFeatures ( [ ] ) ,
654- ) ;
656+ t . assert ( find . calledOnce ) ;
657+ t . assert ( getApiDetails . calledOnce ) ;
658+ t . assert ( getAuthorizationHeaderFor . calledOnce ) ;
659+ t . assert ( downloadTool . calledOnceWith ( downloadUrl ) ) ;
660+ t . assert ( extractTar . calledOnceWith ( archivePath ) ) ;
661+ t . assert ( cacheDir . calledOnceWith ( extractedPath ) ) ;
662+ t . assert ( path ) ;
663+ t . is (
664+ path ,
665+ filepath . join ( toolcachePath , startProxyExports . getProxyFilename ( ) ) ,
666+ ) ;
655667
656- t . assert ( find . calledOnce ) ;
657- t . assert ( getApiDetails . calledOnce ) ;
658- t . assert ( getAuthorizationHeaderFor . calledOnce ) ;
659- t . assert ( downloadTool . calledOnceWith ( downloadUrl ) ) ;
660- t . assert ( extractTar . calledOnceWith ( archivePath ) ) ;
661- t . assert ( cacheDir . calledOnceWith ( extractedPath ) ) ;
662- t . assert ( path ) ;
663- t . is (
664- path ,
665- filepath . join ( toolcachePath , startProxyExports . getProxyFilename ( ) ) ,
666- ) ;
667- } ) ;
668+ checkExpectedLogMessages ( t , logger . messages , [
669+ `Found '${ startProxyExports . getProxyPackage ( ) } ' in release '${ defaults . bundleVersion } ' at '${ downloadUrl } '` ,
670+ ] ) ;
668671} ) ;
669672
670673test ( "getProxyBinaryPath - downloads proxy based on features if not in cache" , async ( t ) => {
@@ -745,4 +748,8 @@ test("getProxyBinaryPath - downloads proxy based on features if not in cache", a
745748 filepath . join ( toolcachePath , startProxyExports . getProxyFilename ( ) ) ,
746749 ) ;
747750 } ) ;
751+
752+ checkExpectedLogMessages ( t , logger . messages , [
753+ `Found '${ startProxyExports . getProxyPackage ( ) } ' in release '${ expectedTag } ' at '${ downloadUrl } '` ,
754+ ] ) ;
748755} ) ;
0 commit comments