mirror of https://github.com/actions/toolkit
Review comments
parent
babb9fb0bc
commit
7b1bc1f56a
|
@ -83,7 +83,7 @@ test('restore with server error should fail', async () => {
|
||||||
expect(cacheKey).toBe(undefined)
|
expect(cacheKey).toBe(undefined)
|
||||||
expect(logWarningMock).toHaveBeenCalledTimes(1)
|
expect(logWarningMock).toHaveBeenCalledTimes(1)
|
||||||
expect(logWarningMock).toHaveBeenCalledWith(
|
expect(logWarningMock).toHaveBeenCalledWith(
|
||||||
'Fail to restore: HTTP Error Occurred'
|
'Failed to restore: HTTP Error Occurred'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ test('save with large cache outputs should fail', async () => {
|
||||||
expect(cacheId).toBe(-1)
|
expect(cacheId).toBe(-1)
|
||||||
expect(logWarningMock).toHaveBeenCalledTimes(1)
|
expect(logWarningMock).toHaveBeenCalledTimes(1)
|
||||||
expect(logWarningMock).toHaveBeenCalledWith(
|
expect(logWarningMock).toHaveBeenCalledWith(
|
||||||
'Fail to save: Cache size of ~11264 MB (11811160064 B) is over the 10GB limit, not saving cache.'
|
'Failed to save: Cache size of ~11264 MB (11811160064 B) is over the 10GB limit, not saving cache.'
|
||||||
)
|
)
|
||||||
|
|
||||||
const archiveFolder = '/foo/bar'
|
const archiveFolder = '/foo/bar'
|
||||||
|
@ -115,7 +115,7 @@ test('save with large cache outputs should fail in GHES with error message', asy
|
||||||
expect(cacheId).toBe(-1)
|
expect(cacheId).toBe(-1)
|
||||||
expect(logWarningMock).toHaveBeenCalledTimes(1)
|
expect(logWarningMock).toHaveBeenCalledTimes(1)
|
||||||
expect(logWarningMock).toHaveBeenCalledWith(
|
expect(logWarningMock).toHaveBeenCalledWith(
|
||||||
'Fail to save: The cache filesize must be between 0 and 1073741824 bytes'
|
'Failed to save: The cache filesize must be between 0 and 1073741824 bytes'
|
||||||
)
|
)
|
||||||
|
|
||||||
const archiveFolder = '/foo/bar'
|
const archiveFolder = '/foo/bar'
|
||||||
|
@ -163,7 +163,7 @@ test('save with large cache outputs should fail in GHES without error message',
|
||||||
expect(cacheId).toBe(-1)
|
expect(cacheId).toBe(-1)
|
||||||
expect(logWarningMock).toHaveBeenCalledTimes(1)
|
expect(logWarningMock).toHaveBeenCalledTimes(1)
|
||||||
expect(logWarningMock).toHaveBeenCalledWith(
|
expect(logWarningMock).toHaveBeenCalledWith(
|
||||||
'Fail to save: Cache size of ~11264 MB (11811160064 B) is over the data cap limit, not saving cache.'
|
'Failed to save: Cache size of ~11264 MB (11811160064 B) is over the data cap limit, not saving cache.'
|
||||||
)
|
)
|
||||||
|
|
||||||
const archiveFolder = '/foo/bar'
|
const archiveFolder = '/foo/bar'
|
||||||
|
@ -204,7 +204,7 @@ test('save with reserve cache failure should fail', async () => {
|
||||||
expect(cacheId).toBe(-1)
|
expect(cacheId).toBe(-1)
|
||||||
expect(logInfoMock).toHaveBeenCalledTimes(1)
|
expect(logInfoMock).toHaveBeenCalledTimes(1)
|
||||||
expect(logInfoMock).toHaveBeenCalledWith(
|
expect(logInfoMock).toHaveBeenCalledWith(
|
||||||
`Fail to save: Unable to reserve cache with key ${primaryKey}, another job may be creating this cache. More details: undefined`
|
`Failed to save: Unable to reserve cache with key ${primaryKey}, another job may be creating this cache. More details: undefined`
|
||||||
)
|
)
|
||||||
|
|
||||||
expect(reserveCacheMock).toHaveBeenCalledTimes(1)
|
expect(reserveCacheMock).toHaveBeenCalledTimes(1)
|
||||||
|
@ -248,7 +248,7 @@ test('save with server error should fail', async () => {
|
||||||
await saveCache([filePath], primaryKey)
|
await saveCache([filePath], primaryKey)
|
||||||
expect(logWarningMock).toHaveBeenCalledTimes(1)
|
expect(logWarningMock).toHaveBeenCalledTimes(1)
|
||||||
expect(logWarningMock).toHaveBeenCalledWith(
|
expect(logWarningMock).toHaveBeenCalledWith(
|
||||||
'Fail to save: HTTP Error Occurred'
|
'Failed to save: HTTP Error Occurred'
|
||||||
)
|
)
|
||||||
|
|
||||||
expect(reserveCacheMock).toHaveBeenCalledTimes(1)
|
expect(reserveCacheMock).toHaveBeenCalledTimes(1)
|
||||||
|
|
|
@ -128,7 +128,7 @@ export async function restoreCache(
|
||||||
return cacheEntry.cacheKey
|
return cacheEntry.cacheKey
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Supress all cache related errors because caching should be optional
|
// Supress all cache related errors because caching should be optional
|
||||||
core.warning(`Fail to restore: ${(error as Error).message}`)
|
core.warning(`Failed to restore: ${(error as Error).message}`)
|
||||||
} finally {
|
} finally {
|
||||||
// Try to delete the archive to save space
|
// Try to delete the archive to save space
|
||||||
try {
|
try {
|
||||||
|
@ -226,9 +226,9 @@ export async function saveCache(
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const typedError = error as Error
|
const typedError = error as Error
|
||||||
if (typedError.name === ReserveCacheError.name) {
|
if (typedError.name === ReserveCacheError.name) {
|
||||||
core.info(`Fail to save: ${typedError.message}`)
|
core.info(`Failed to save: ${typedError.message}`)
|
||||||
} else {
|
} else {
|
||||||
core.warning(`Fail to save: ${typedError.message}`)
|
core.warning(`Failed to save: ${typedError.message}`)
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
// Try to delete the archive to save space
|
// Try to delete the archive to save space
|
||||||
|
|
Loading…
Reference in New Issue