diff --git a/lib/entry-points.js b/lib/entry-points.js index 904592609..18a338702 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -149918,7 +149918,7 @@ function runnerHasSufficientDiskSpace(diskUsage, logger, minimumDiskSpaceMb) { return false; } logger.debug( - `Disk space available for CodeQL analysis is ${diskSpaceMb} MB, which is above the minimum of ${minimumDiskSpaceMb} MB.` + `Disk space available for CodeQL analysis is ${diskSpaceMb} MB, which is at or above the minimum of ${minimumDiskSpaceMb} MB.` ); return true; } diff --git a/src/config-utils.test.ts b/src/config-utils.test.ts index f4a664c79..bedf219ef 100644 --- a/src/config-utils.test.ts +++ b/src/config-utils.test.ts @@ -1333,26 +1333,57 @@ checkOverlayEnablementMacro.serial( }, ); -checkOverlayEnablementMacro.serial( - "Overlay-base database on default branch if runner disk space is above the limit lowered by a feature flag", - { - languages: [BuiltInLanguage.javascript], - features: [ - Feature.OverlayAnalysis, - Feature.OverlayAnalysisCodeScanningJavascript, - Feature.OverlayAnalysisMinDisk10Gb, - ], - isDefaultBranch: true, - diskUsage: { - numAvailableBytes: 11_000_000_000, - numTotalBytes: 100_000_000_000, +// Check that each feature flag lowers the limit to the threshold that its name +// declares. Both sides of the boundary are needed to pin the threshold down: a +// mapping to a lower value would still pass the case at the limit, and one to a +// higher value would still fail the case below it. +for (const [feature, thresholdGb] of [ + [Feature.OverlayAnalysisMinDisk8Gb, 8], + [Feature.OverlayAnalysisMinDisk9Gb, 9], + [Feature.OverlayAnalysisMinDisk10Gb, 10], + [Feature.OverlayAnalysisMinDisk11Gb, 11], + [Feature.OverlayAnalysisMinDisk12Gb, 12], + [Feature.OverlayAnalysisMinDisk13Gb, 13], +] as Array<[Feature, number]>) { + const features = [ + Feature.OverlayAnalysis, + Feature.OverlayAnalysisCodeScanningJavascript, + feature, + ]; + + checkOverlayEnablementMacro.serial( + `Overlay-base database on default branch if ${feature} is enabled and runner disk space is at its limit`, + { + languages: [BuiltInLanguage.javascript], + features, + isDefaultBranch: true, + diskUsage: { + numAvailableBytes: thresholdGb * 1_000_000_000, + numTotalBytes: 100_000_000_000, + }, }, - }, - { - overlayDatabaseMode: OverlayDatabaseMode.OverlayBase, - useOverlayDatabaseCaching: true, - }, -); + { + overlayDatabaseMode: OverlayDatabaseMode.OverlayBase, + useOverlayDatabaseCaching: true, + }, + ); + + checkOverlayEnablementMacro.serial( + `No overlay-base database on default branch if ${feature} is enabled and runner disk space is below its limit`, + { + languages: [BuiltInLanguage.javascript], + features, + isDefaultBranch: true, + diskUsage: { + numAvailableBytes: thresholdGb * 1_000_000_000 - 1_000_000, + numTotalBytes: 100_000_000_000, + }, + }, + { + disabledReason: OverlayDisabledReason.InsufficientDiskSpace, + }, + ); +} checkOverlayEnablementMacro.serial( "Overlay-base database on default branch if runner disk space is exactly at the lowest limit enabled by a feature flag", diff --git a/src/config-utils.ts b/src/config-utils.ts index dac83aa2c..a0880d14a 100644 --- a/src/config-utils.ts +++ b/src/config-utils.ts @@ -630,8 +630,8 @@ function runnerHasSufficientDiskSpace( } logger.debug( - `Disk space available for CodeQL analysis is ${diskSpaceMb} MB, which is above the minimum ` + - `of ${minimumDiskSpaceMb} MB.`, + `Disk space available for CodeQL analysis is ${diskSpaceMb} MB, which is at or above the ` + + `minimum of ${minimumDiskSpaceMb} MB.`, ); return true; }