Skip to content

Commit 857c61a

Browse files
authored
Merge pull request #1994 from gitulisca-enterprise-cloud-testing/gitulisca/log-restore-request-version
Log cache version requested on debugging message
2 parents 2559a2a + 5143143 commit 857c61a

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

packages/cache/__tests__/restoreCacheV2.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ test('restore with restore keys and no cache found', async () => {
115115
const paths = ['node_modules']
116116
const key = 'node-test'
117117
const restoreKeys = ['node-']
118+
const cacheVersion =
119+
'd90f107aaeb22920dba0c637a23c37b5bc497b4dfa3b07fe3f79bf88a273c11b'
120+
const getCacheVersionMock = jest.spyOn(cacheUtils, 'getCacheVersion')
121+
getCacheVersionMock.mockReturnValue(cacheVersion)
118122

119123
jest
120124
.spyOn(CacheServiceClientJSON.prototype, 'GetCacheEntryDownloadURL')
@@ -130,7 +134,10 @@ test('restore with restore keys and no cache found', async () => {
130134

131135
expect(cacheKey).toBe(undefined)
132136
expect(logDebugMock).toHaveBeenCalledWith(
133-
`Cache not found for keys: ${[key, ...restoreKeys].join(', ')}`
137+
`Cache not found for version ${cacheVersion} of keys: ${[
138+
key,
139+
...restoreKeys
140+
].join(', ')}`
134141
)
135142
})
136143

packages/cache/src/cache.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,11 @@ async function restoreCacheV2(
256256
const response = await twirpClient.GetCacheEntryDownloadURL(request)
257257

258258
if (!response.ok) {
259-
core.debug(`Cache not found for keys: ${keys.join(', ')}`)
259+
core.debug(
260+
`Cache not found for version ${request.version} of keys: ${keys.join(
261+
', '
262+
)}`
263+
)
260264
return undefined
261265
}
262266

0 commit comments

Comments
 (0)