@@ -2314,6 +2314,7 @@ test("downloadPacks-with-registries", async (t) => {
23142314
23152315 const codeQL = setCodeQL ( {
23162316 packDownload : packDownloadStub ,
2317+ getVersion : ( ) => Promise . resolve ( "2.10.5" ) ,
23172318 } ) ;
23182319
23192320 // packs are supplied for go, java, and python
@@ -2348,3 +2349,50 @@ test("downloadPacks-with-registries", async (t) => {
23482349 t . deepEqual ( process . env . CODEQL_REGISTRIES_AUTH , "not-a-registries-auth" ) ;
23492350 } ) ;
23502351} ) ;
2352+
2353+ test ( "downloadPacks-with-registries fails on 2.10.4" , async ( t ) => {
2354+ // same thing, but this time include a registries block and
2355+ // associated env vars
2356+ return await util . withTmpDir ( async ( tmpDir ) => {
2357+ process . env . GITHUB_TOKEN = "not-a-token" ;
2358+ process . env . CODEQL_REGISTRIES_AUTH = "not-a-registries-auth" ;
2359+ const logger = getRunnerLogger ( true ) ;
2360+
2361+ const registries = [
2362+ {
2363+ url : "http://ghcr.io" ,
2364+ packages : [ "codeql/*" , "dsp-testing/*" ] ,
2365+ token : "not-a-token" ,
2366+ } ,
2367+ {
2368+ url : "https://containers.GHEHOSTNAME1/v2/" ,
2369+ packages : "semmle/*" ,
2370+ token : "still-not-a-token" ,
2371+ } ,
2372+ ] ;
2373+
2374+ const codeQL = setCodeQL ( {
2375+ getVersion : ( ) => Promise . resolve ( "2.10.4" ) ,
2376+ } ) ;
2377+ await t . throwsAsync (
2378+ async ( ) =>
2379+ // packs are supplied for go, java, and python
2380+ // analyzed languages are java, javascript, and python
2381+ {
2382+ /* packs are supplied for go, java, and python*/
2383+ /* analyzed languages are java, javascript, and python*/
2384+ return await configUtils . downloadPacks (
2385+ codeQL ,
2386+ [ Language . javascript , Language . java , Language . python ] ,
2387+ { } ,
2388+ registries ,
2389+ sampleApiDetails ,
2390+ tmpDir ,
2391+ logger
2392+ ) ;
2393+ } ,
2394+ { instanceOf : Error } ,
2395+ "'registries' input is not supported on CodeQL versions less than 2.10.5."
2396+ ) ;
2397+ } ) ;
2398+ } ) ;
0 commit comments