remove cache size limit
This commit is contained in:
committed by
Salman Muin Kayser Chishti
parent
33a9b6c09c
commit
308e05bc50
-33
@@ -59,39 +59,6 @@ test('save with missing input should fail', async () => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('save with large cache outputs should fail using', async () => {
|
|
||||||
const paths = 'node_modules'
|
|
||||||
const key = 'Linux-node-bb828da54c148048dd17899ba9fda624811cfb43'
|
|
||||||
const cachePaths = [path.resolve(paths)]
|
|
||||||
|
|
||||||
const createTarMock = jest.spyOn(tar, 'createTar')
|
|
||||||
const logWarningMock = jest.spyOn(core, 'warning')
|
|
||||||
|
|
||||||
const cacheSize = 11 * 1024 * 1024 * 1024 //~11GB, over the 10GB limit
|
|
||||||
jest
|
|
||||||
.spyOn(cacheUtils, 'getArchiveFileSizeInBytes')
|
|
||||||
.mockReturnValueOnce(cacheSize)
|
|
||||||
const compression = CompressionMethod.Gzip
|
|
||||||
const getCompressionMock = jest
|
|
||||||
.spyOn(cacheUtils, 'getCompressionMethod')
|
|
||||||
.mockReturnValueOnce(Promise.resolve(compression))
|
|
||||||
|
|
||||||
const cacheId = await saveCache([paths], key)
|
|
||||||
expect(cacheId).toBe(-1)
|
|
||||||
expect(logWarningMock).toHaveBeenCalledWith(
|
|
||||||
'Failed to save: Cache size of ~11264 MB (11811160064 B) is over the 10GB limit, not saving cache.'
|
|
||||||
)
|
|
||||||
|
|
||||||
const archiveFolder = '/foo/bar'
|
|
||||||
|
|
||||||
expect(createTarMock).toHaveBeenCalledWith(
|
|
||||||
archiveFolder,
|
|
||||||
cachePaths,
|
|
||||||
compression
|
|
||||||
)
|
|
||||||
expect(getCompressionMock).toHaveBeenCalledTimes(1)
|
|
||||||
})
|
|
||||||
|
|
||||||
test('create cache entry failure on non-ok response', async () => {
|
test('create cache entry failure on non-ok response', async () => {
|
||||||
const paths = ['node_modules']
|
const paths = ['node_modules']
|
||||||
const key = 'Linux-node-bb828da54c148048dd17899ba9fda624811cfb43'
|
const key = 'Linux-node-bb828da54c148048dd17899ba9fda624811cfb43'
|
||||||
|
|||||||
Vendored
-10
@@ -12,7 +12,6 @@ import {
|
|||||||
FinalizeCacheEntryUploadResponse,
|
FinalizeCacheEntryUploadResponse,
|
||||||
GetCacheEntryDownloadURLRequest
|
GetCacheEntryDownloadURLRequest
|
||||||
} from './generated/results/api/v1/cache'
|
} from './generated/results/api/v1/cache'
|
||||||
import {CacheFileSizeLimit} from './internal/constants'
|
|
||||||
import {HttpClientError} from '@actions/http-client'
|
import {HttpClientError} from '@actions/http-client'
|
||||||
export class ValidationError extends Error {
|
export class ValidationError extends Error {
|
||||||
constructor(message: string) {
|
constructor(message: string) {
|
||||||
@@ -550,15 +549,6 @@ async function saveCacheV2(
|
|||||||
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath)
|
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath)
|
||||||
core.debug(`File Size: ${archiveFileSize}`)
|
core.debug(`File Size: ${archiveFileSize}`)
|
||||||
|
|
||||||
// For GHES, this check will take place in ReserveCache API with enterprise file size limit
|
|
||||||
if (archiveFileSize > CacheFileSizeLimit && !isGhes()) {
|
|
||||||
throw new Error(
|
|
||||||
`Cache size of ~${Math.round(
|
|
||||||
archiveFileSize / (1024 * 1024)
|
|
||||||
)} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the archive size in the options, will be used to display the upload progress
|
// Set the archive size in the options, will be used to display the upload progress
|
||||||
options.archiveSizeBytes = archiveFileSize
|
options.archiveSizeBytes = archiveFileSize
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user