Merge pull request #2101 from actions/Link-/clarify-cache-hit-log
Explicit logging of cache key and restore key matches
This commit is contained in:
@@ -265,6 +265,7 @@ test('restore with zstd compressed cache found', async () => {
|
|||||||
const cacheKey = await restoreCache(paths, key, [], options)
|
const cacheKey = await restoreCache(paths, key, [], options)
|
||||||
|
|
||||||
expect(cacheKey).toBe(key)
|
expect(cacheKey).toBe(key)
|
||||||
|
expect(logInfoMock).toHaveBeenCalledWith(`Cache hit for: ${key}`)
|
||||||
expect(getCacheVersionMock).toHaveBeenCalledWith(
|
expect(getCacheVersionMock).toHaveBeenCalledWith(
|
||||||
paths,
|
paths,
|
||||||
compressionMethod,
|
compressionMethod,
|
||||||
@@ -342,6 +343,9 @@ test('restore with cache found for restore key', async () => {
|
|||||||
const cacheKey = await restoreCache(paths, key, restoreKeys, options)
|
const cacheKey = await restoreCache(paths, key, restoreKeys, options)
|
||||||
|
|
||||||
expect(cacheKey).toBe(restoreKeys[0])
|
expect(cacheKey).toBe(restoreKeys[0])
|
||||||
|
expect(logInfoMock).toHaveBeenCalledWith(
|
||||||
|
`Cache hit for restore-key: ${restoreKeys[0]}`
|
||||||
|
)
|
||||||
expect(getCacheVersionMock).toHaveBeenCalledWith(
|
expect(getCacheVersionMock).toHaveBeenCalledWith(
|
||||||
paths,
|
paths,
|
||||||
compressionMethod,
|
compressionMethod,
|
||||||
|
|||||||
Vendored
+6
-1
@@ -264,7 +264,12 @@ async function restoreCacheV2(
|
|||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
core.info(`Cache hit for: ${request.key}`)
|
const isRestoreKeyMatch = request.key !== response.matchedKey
|
||||||
|
if (isRestoreKeyMatch) {
|
||||||
|
core.info(`Cache hit for restore-key: ${response.matchedKey}`)
|
||||||
|
} else {
|
||||||
|
core.info(`Cache hit for: ${response.matchedKey}`)
|
||||||
|
}
|
||||||
|
|
||||||
if (options?.lookupOnly) {
|
if (options?.lookupOnly) {
|
||||||
core.info('Lookup only - skipping download')
|
core.info('Lookup only - skipping download')
|
||||||
|
|||||||
Reference in New Issue
Block a user