From 54ac8fc2b0e8d2c94b3e5e1b40e5fc24502538f4 Mon Sep 17 00:00:00 2001 From: Art Leo Date: Sat, 15 Mar 2025 10:13:43 +1100 Subject: [PATCH] Log cache version requested --- __tests__/restoreCacheV2.test.ts | 9 ++++++++- src/cache.ts | 6 +++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/__tests__/restoreCacheV2.test.ts b/__tests__/restoreCacheV2.test.ts index 64e9df1..485b8ae 100644 --- a/__tests__/restoreCacheV2.test.ts +++ b/__tests__/restoreCacheV2.test.ts @@ -115,6 +115,10 @@ test('restore with restore keys and no cache found', async () => { const paths = ['node_modules'] const key = 'node-test' const restoreKeys = ['node-'] + const cacheVersion = + 'd90f107aaeb22920dba0c637a23c37b5bc497b4dfa3b07fe3f79bf88a273c11b' + const getCacheVersionMock = jest.spyOn(cacheUtils, 'getCacheVersion') + getCacheVersionMock.mockReturnValue(cacheVersion) jest .spyOn(CacheServiceClientJSON.prototype, 'GetCacheEntryDownloadURL') @@ -130,7 +134,10 @@ test('restore with restore keys and no cache found', async () => { expect(cacheKey).toBe(undefined) expect(logDebugMock).toHaveBeenCalledWith( - `Cache not found for keys: ${[key, ...restoreKeys].join(', ')}` + `Cache not found for version ${cacheVersion} of keys: ${[ + key, + ...restoreKeys + ].join(', ')}` ) }) diff --git a/src/cache.ts b/src/cache.ts index 9cbab6e..f7b2d19 100644 --- a/src/cache.ts +++ b/src/cache.ts @@ -256,7 +256,11 @@ async function restoreCacheV2( const response = await twirpClient.GetCacheEntryDownloadURL(request) if (!response.ok) { - core.debug(`Cache not found for keys: ${keys.join(', ')}`) + core.debug( + `Cache not found for version ${request.version} of keys: ${keys.join( + ', ' + )}` + ) return undefined }