@@ -7,6 +7,7 @@ import * as sinon from "sinon";
77
88import * as actionsUtil from "./actions-util" ;
99import * as apiClient from "./api-client" ;
10+ import { ResolveDatabaseOutput } from "./codeql" ;
1011import * as gitUtils from "./git-utils" ;
1112import { getRunnerLogger } from "./logging" ;
1213import {
@@ -95,6 +96,7 @@ interface DownloadOverlayBaseDatabaseTestCase {
9596 hasBaseDatabaseOidsFile : boolean ;
9697 tryGetFolderBytesSucceeds : boolean ;
9798 codeQLVersion : string ;
99+ resolveDatabaseOutput : ResolveDatabaseOutput ;
98100}
99101
100102const defaultDownloadTestCase : DownloadOverlayBaseDatabaseTestCase = {
@@ -105,6 +107,7 @@ const defaultDownloadTestCase: DownloadOverlayBaseDatabaseTestCase = {
105107 hasBaseDatabaseOidsFile : true ,
106108 tryGetFolderBytesSucceeds : true ,
107109 codeQLVersion : "2.20.5" ,
110+ resolveDatabaseOutput : { overlayBaseSpecifier : "20250626:XXX" } ,
108111} ;
109112
110113const testDownloadOverlayBaseDatabaseFromCache = test . macro ( {
@@ -163,9 +166,16 @@ const testDownloadOverlayBaseDatabaseFromCache = test.macro({
163166 . resolves ( testCase . tryGetFolderBytesSucceeds ? 1024 * 1024 : undefined ) ;
164167 stubs . push ( tryGetFolderBytesStub ) ;
165168
169+ const codeql = mockCodeQLVersion ( testCase . codeQLVersion ) ;
170+
171+ const resolveDatabaseStub = sinon
172+ . stub ( codeql , "resolveDatabase" )
173+ . resolves ( testCase . resolveDatabaseOutput ) ;
174+ stubs . push ( resolveDatabaseStub ) ;
175+
166176 try {
167177 const result = await downloadOverlayBaseDatabaseFromCache (
168- mockCodeQLVersion ( testCase . codeQLVersion ) ,
178+ codeql ,
169179 config ,
170180 logger ,
171181 ) ;
@@ -255,6 +265,15 @@ test(
255265 false ,
256266) ;
257267
268+ test (
269+ testDownloadOverlayBaseDatabaseFromCache ,
270+ "returns undefined when downloaded database doesn't have an overlayBaseSpecifier" ,
271+ {
272+ resolveDatabaseOutput : { } ,
273+ } ,
274+ false ,
275+ ) ;
276+
258277test (
259278 testDownloadOverlayBaseDatabaseFromCache ,
260279 "returns undefined when filesystem error occurs" ,
0 commit comments