@@ -596,7 +596,7 @@ test.serial(
596596 undefined , // rawLanguages
597597 undefined , // otherLanguagePacksReason
598598 false , // useOverlayAwareDefaultCliVersion
599- createFeatures ( [ Feature . CleanupToolcacheBundles ] ) ,
599+ createFeatures ( [ ] ) ,
600600 getRunnerLogger ( true ) ,
601601 ) ;
602602
@@ -1375,10 +1375,7 @@ for (const bundle of ["per-language", "combined", "fallback"] as const) {
13751375 } ;
13761376 } ) ;
13771377 const addDiagnostic = sinon . stub ( diagnostics , "addNoLanguageDiagnostic" ) ;
1378- const features = createFeatures ( [
1379- Feature . PerLanguageBundles ,
1380- Feature . CleanupToolcacheBundles ,
1381- ] ) ;
1378+ const features = createFeatures ( [ Feature . PerLanguageBundles ] ) ;
13821379
13831380 await withTmpDir ( async ( tmpDir ) => {
13841381 setupActionsVars ( tmpDir , tmpDir ) ;
@@ -1826,11 +1823,15 @@ function createToolcacheEntry(
18261823 */
18271824async function runDownloadCodeQL (
18281825 toolcacheRoot : string ,
1829- features : Feature [ ] ,
18301826 bundleVersion : string | undefined ,
1831- env = getTestEnv ( {
1832- [ ActionsEnvVars . RUNNER_TOOL_CACHE ] : toolcacheRoot ,
1833- } ) ,
1827+ {
1828+ env = getTestEnv ( {
1829+ [ ActionsEnvVars . RUNNER_ENVIRONMENT ] : "github-hosted" ,
1830+ [ ActionsEnvVars . RUNNER_TOOL_CACHE ] : toolcacheRoot ,
1831+ } ) ,
1832+ } : {
1833+ env ?: Env ;
1834+ } = { } ,
18341835) : Promise < {
18351836 codeqlFolder : string ;
18361837 cleanupDiagnostic : toolsDownload . ToolcacheCleanupResult | undefined ;
@@ -1841,7 +1842,6 @@ async function runDownloadCodeQL(
18411842 const { codeqlFolder } = await setupCodeql . downloadCodeQLBundle (
18421843 initAllState ( {
18431844 env,
1844- features : createFeatures ( features ) ,
18451845 } ) ,
18461846 {
18471847 bundle : {
@@ -1879,11 +1879,9 @@ async function runDownloadCodeQL(
18791879async function testToolcacheCleanup (
18801880 t : ExecutionContext < unknown > ,
18811881 {
1882- features,
18831882 runnerEnvironment,
18841883 setUp,
18851884 } : {
1886- features : Feature [ ] ;
18871885 runnerEnvironment : string | undefined ;
18881886 setUp ?: ( env : Env ) => void ;
18891887 } ,
@@ -1895,12 +1893,8 @@ async function testToolcacheCleanup(
18951893) {
18961894 await withTmpDir ( async ( tmpDir ) => {
18971895 setupActionsVars ( tmpDir , tmpDir ) ;
1898- if ( runnerEnvironment === undefined ) {
1899- delete process . env [ ActionsEnvVars . RUNNER_ENVIRONMENT ] ;
1900- } else {
1901- process . env [ ActionsEnvVars . RUNNER_ENVIRONMENT ] = runnerEnvironment ;
1902- }
19031896 const env = getTestEnv ( {
1897+ [ ActionsEnvVars . RUNNER_ENVIRONMENT ] : runnerEnvironment ,
19041898 [ ActionsEnvVars . RUNNER_TOOL_CACHE ] : tmpDir ,
19051899 } ) ;
19061900 setUp ?.( env ) ;
@@ -1920,9 +1914,8 @@ async function testToolcacheCleanup(
19201914
19211915 const { cleanupDiagnostic } = await runDownloadCodeQL (
19221916 tmpDir ,
1923- features ,
19241917 CLEANUP_BUNDLE_VERSION ,
1925- env ,
1918+ { env } ,
19261919 ) ;
19271920
19281921 t . true (
@@ -1934,28 +1927,12 @@ async function testToolcacheCleanup(
19341927 } ) ;
19351928}
19361929
1937- test . serial (
1938- "downloadCodeQLBundle does not clean up the toolcache when the feature flag is disabled" ,
1939- async ( t ) => {
1940- await testToolcacheCleanup (
1941- t ,
1942- { features : [ ] , runnerEnvironment : "github-hosted" } ,
1943- ( { cleanupDiagnostic, destinationDirectory, staleDirectory } ) => {
1944- t . true ( fs . existsSync ( staleDirectory ) ) ;
1945- t . true ( fs . existsSync ( destinationDirectory ) ) ;
1946- t . is ( cleanupDiagnostic , undefined ) ;
1947- } ,
1948- ) ;
1949- } ,
1950- ) ;
1951-
19521930test . serial (
19531931 "downloadCodeQLBundle does not clean up the toolcache when the runner is not GitHub-hosted" ,
19541932 async ( t ) => {
19551933 await testToolcacheCleanup (
19561934 t ,
19571935 {
1958- features : [ Feature . CleanupToolcacheBundles ] ,
19591936 runnerEnvironment : "self-hosted" ,
19601937 } ,
19611938 ( { cleanupDiagnostic, destinationDirectory, staleDirectory } ) => {
@@ -1975,7 +1952,6 @@ test.serial(
19751952 await testToolcacheCleanup (
19761953 t ,
19771954 {
1978- features : [ Feature . CleanupToolcacheBundles ] ,
19791955 runnerEnvironment : undefined ,
19801956 } ,
19811957 ( { cleanupDiagnostic, destinationDirectory, staleDirectory } ) => {
@@ -1988,12 +1964,11 @@ test.serial(
19881964) ;
19891965
19901966test . serial (
1991- "downloadCodeQLBundle deletes other CodeQL bundles from the toolcache when enabled on a GitHub-hosted runner" ,
1967+ "downloadCodeQLBundle deletes other CodeQL bundles from the toolcache on a GitHub-hosted runner" ,
19921968 async ( t ) => {
19931969 await testToolcacheCleanup (
19941970 t ,
19951971 {
1996- features : [ Feature . CleanupToolcacheBundles ] ,
19971972 runnerEnvironment : "github-hosted" ,
19981973 } ,
19991974 ( { cleanupDiagnostic, destinationDirectory, staleDirectory } ) => {
@@ -2027,7 +2002,6 @@ test.serial(
20272002
20282003 const { cleanupDiagnostic } = await runDownloadCodeQL (
20292004 tmpDir ,
2030- [ Feature . CleanupToolcacheBundles ] ,
20312005 CLEANUP_BUNDLE_VERSION ,
20322006 ) ;
20332007
@@ -2057,7 +2031,6 @@ test.serial(
20572031
20582032 const { cleanupDiagnostic } = await runDownloadCodeQL (
20592033 tmpDir ,
2060- [ Feature . CleanupToolcacheBundles ] ,
20612034 CLEANUP_BUNDLE_VERSION ,
20622035 ) ;
20632036
@@ -2189,7 +2162,6 @@ test.serial(
21892162
21902163 const { cleanupDiagnostic } = await runDownloadCodeQL (
21912164 toolcacheRoot ,
2192- [ Feature . CleanupToolcacheBundles ] ,
21932165 CLEANUP_BUNDLE_VERSION ,
21942166 ) ;
21952167
@@ -2212,7 +2184,6 @@ test.serial(
22122184 await testToolcacheCleanup (
22132185 t ,
22142186 {
2215- features : [ Feature . CleanupToolcacheBundles ] ,
22162187 runnerEnvironment : "github-hosted" ,
22172188 setUp : ( env ) => {
22182189 env . set ( EnvVar . HAS_SET_UP_CODEQL , "true" ) ;
@@ -2242,9 +2213,13 @@ test.serial(
22422213 ) ;
22432214 const { codeqlFolder, cleanupDiagnostic } = await runDownloadCodeQL (
22442215 tmpDir ,
2245- [ Feature . CleanupToolcacheBundles ] ,
22462216 CLEANUP_BUNDLE_VERSION ,
2247- getTestEnv ( { [ EnvVar . HAS_SET_UP_CODEQL ] : "true" } ) ,
2217+ {
2218+ env : getTestEnv ( {
2219+ [ ActionsEnvVars . RUNNER_ENVIRONMENT ] : "github-hosted" ,
2220+ [ EnvVar . HAS_SET_UP_CODEQL ] : "true" ,
2221+ } ) ,
2222+ } ,
22482223 ) ;
22492224
22502225 t . true ( fs . existsSync ( staleDirectory ) ) ;
@@ -2312,7 +2287,7 @@ test.serial(
23122287 undefined , // rawLanguages
23132288 undefined , // otherLanguagePacksReason
23142289 false , // useOverlayAwareDefaultCliVersion
2315- createFeatures ( [ Feature . CleanupToolcacheBundles ] ) ,
2290+ createFeatures ( [ ] ) ,
23162291 getRunnerLogger ( true ) ,
23172292 ) ,
23182293 { is : error } ,
@@ -2347,7 +2322,6 @@ test.serial(
23472322
23482323 const { codeqlFolder, cleanupDiagnostic } = await runDownloadCodeQL (
23492324 tmpDir ,
2350- [ Feature . CleanupToolcacheBundles ] ,
23512325 undefined , // bundleVersion
23522326 ) ;
23532327
@@ -2381,7 +2355,6 @@ test.serial(
23812355
23822356 const { cleanupDiagnostic } = await runDownloadCodeQL (
23832357 tmpDir ,
2384- [ Feature . CleanupToolcacheBundles ] ,
23852358 CLEANUP_BUNDLE_VERSION ,
23862359 ) ;
23872360
@@ -2417,7 +2390,6 @@ test.serial(
24172390
24182391 const { cleanupDiagnostic } = await runDownloadCodeQL (
24192392 tmpDir ,
2420- [ Feature . CleanupToolcacheBundles ] ,
24212393 CLEANUP_BUNDLE_VERSION ,
24222394 ) ;
24232395
@@ -2467,7 +2439,6 @@ test.serial(
24672439
24682440 const { cleanupDiagnostic } = await runDownloadCodeQL (
24692441 toolcacheRoot ,
2470- [ Feature . CleanupToolcacheBundles ] ,
24712442 CLEANUP_BUNDLE_VERSION ,
24722443 ) ;
24732444
0 commit comments