diff --git a/packages/cache/__tests__/restoreCache.test.ts b/packages/cache/__tests__/restoreCache.test.ts index 7992490e..d376a264 100644 --- a/packages/cache/__tests__/restoreCache.test.ts +++ b/packages/cache/__tests__/restoreCache.test.ts @@ -73,7 +73,7 @@ test('restore with no cache found', async () => { test('restore with server error should fail', async () => { const paths = ['node_modules'] const key = 'node-test' - const logWarningMock = jest.spyOn(core, 'warning') + const logErrorMock = jest.spyOn(core, 'error') jest.spyOn(cacheHttpClient, 'getCacheEntry').mockImplementation(() => { throw new Error('HTTP Error Occurred') @@ -81,8 +81,8 @@ test('restore with server error should fail', async () => { const cacheKey = await restoreCache(paths, key) expect(cacheKey).toBe(undefined) - expect(logWarningMock).toHaveBeenCalledTimes(1) - expect(logWarningMock).toHaveBeenCalledWith( + expect(logErrorMock).toHaveBeenCalledTimes(1) + expect(logErrorMock).toHaveBeenCalledWith( 'Failed to restore: HTTP Error Occurred' ) }) diff --git a/packages/cache/__tests__/restoreCacheV2.test.ts b/packages/cache/__tests__/restoreCacheV2.test.ts index 485b8aeb..28e55cc4 100644 --- a/packages/cache/__tests__/restoreCacheV2.test.ts +++ b/packages/cache/__tests__/restoreCacheV2.test.ts @@ -95,7 +95,7 @@ test('restore with no cache found', async () => { test('restore with server error should fail', async () => { const paths = ['node_modules'] const key = 'node-test' - const logWarningMock = jest.spyOn(core, 'warning') + const logErrorMock = jest.spyOn(core, 'error') jest .spyOn(CacheServiceClientJSON.prototype, 'GetCacheEntryDownloadURL') @@ -105,8 +105,8 @@ test('restore with server error should fail', async () => { const cacheKey = await restoreCache(paths, key) expect(cacheKey).toBe(undefined) - expect(logWarningMock).toHaveBeenCalledTimes(1) - expect(logWarningMock).toHaveBeenCalledWith( + expect(logErrorMock).toHaveBeenCalledTimes(1) + expect(logErrorMock).toHaveBeenCalledWith( 'Failed to restore: HTTP Error Occurred' ) }) diff --git a/packages/cache/__tests__/saveCache.test.ts b/packages/cache/__tests__/saveCache.test.ts index e5ed695b..10cdc119 100644 --- a/packages/cache/__tests__/saveCache.test.ts +++ b/packages/cache/__tests__/saveCache.test.ts @@ -50,7 +50,7 @@ test('save with large cache outputs should fail', async () => { const cachePaths = [path.resolve(filePath)] const createTarMock = jest.spyOn(tar, 'createTar') - const logWarningMock = jest.spyOn(core, 'warning') + const logErrorMock = jest.spyOn(core, 'error') const cacheSize = 11 * 1024 * 1024 * 1024 //~11GB, over the 10GB limit jest @@ -63,8 +63,8 @@ test('save with large cache outputs should fail', async () => { const cacheId = await saveCache([filePath], primaryKey) expect(cacheId).toBe(-1) - expect(logWarningMock).toHaveBeenCalledTimes(1) - expect(logWarningMock).toHaveBeenCalledWith( + expect(logErrorMock).toHaveBeenCalledTimes(1) + expect(logErrorMock).toHaveBeenCalledWith( 'Failed to save: Cache size of ~11264 MB (11811160064 B) is over the 10GB limit, not saving cache.' ) @@ -85,7 +85,7 @@ test('save with large cache outputs should fail in GHES with error message', asy const cachePaths = [path.resolve(filePath)] const createTarMock = jest.spyOn(tar, 'createTar') - const logWarningMock = jest.spyOn(core, 'warning') + const logErrorMock = jest.spyOn(core, 'error') const cacheSize = 11 * 1024 * 1024 * 1024 //~11GB, over the 10GB limit jest @@ -115,8 +115,8 @@ test('save with large cache outputs should fail in GHES with error message', asy const cacheId = await saveCache([filePath], primaryKey) expect(cacheId).toBe(-1) - expect(logWarningMock).toHaveBeenCalledTimes(1) - expect(logWarningMock).toHaveBeenCalledWith( + expect(logErrorMock).toHaveBeenCalledTimes(1) + expect(logErrorMock).toHaveBeenCalledWith( 'Failed to save: The cache filesize must be between 0 and 1073741824 bytes' ) @@ -137,7 +137,7 @@ test('save with large cache outputs should fail in GHES without error message', const cachePaths = [path.resolve(filePath)] const createTarMock = jest.spyOn(tar, 'createTar') - const logWarningMock = jest.spyOn(core, 'warning') + const logErrorMock = jest.spyOn(core, 'error') const cacheSize = 11 * 1024 * 1024 * 1024 //~11GB, over the 10GB limit jest @@ -163,8 +163,8 @@ test('save with large cache outputs should fail in GHES without error message', const cacheId = await saveCache([filePath], primaryKey) expect(cacheId).toBe(-1) - expect(logWarningMock).toHaveBeenCalledTimes(1) - expect(logWarningMock).toHaveBeenCalledWith( + expect(logErrorMock).toHaveBeenCalledTimes(1) + expect(logErrorMock).toHaveBeenCalledWith( 'Failed to save: Cache size of ~11264 MB (11811160064 B) is over the data cap limit, not saving cache.' ) @@ -224,7 +224,7 @@ test('save with server error should fail', async () => { const filePath = 'node_modules' const primaryKey = 'Linux-node-bb828da54c148048dd17899ba9fda624811cfb43' const cachePaths = [path.resolve(filePath)] - const logWarningMock = jest.spyOn(core, 'warning') + const logErrorMock = jest.spyOn(core, 'error') const cacheId = 4 const reserveCacheMock = jest .spyOn(cacheHttpClient, 'reserveCache') @@ -250,8 +250,8 @@ test('save with server error should fail', async () => { .mockReturnValueOnce(Promise.resolve(compression)) await saveCache([filePath], primaryKey) - expect(logWarningMock).toHaveBeenCalledTimes(1) - expect(logWarningMock).toHaveBeenCalledWith( + expect(logErrorMock).toHaveBeenCalledTimes(1) + expect(logErrorMock).toHaveBeenCalledWith( 'Failed to save: HTTP Error Occurred' ) diff --git a/packages/cache/__tests__/saveCacheV2.test.ts b/packages/cache/__tests__/saveCacheV2.test.ts index e96c2ac9..ab0def91 100644 --- a/packages/cache/__tests__/saveCacheV2.test.ts +++ b/packages/cache/__tests__/saveCacheV2.test.ts @@ -65,7 +65,7 @@ test('save with large cache outputs should fail using', async () => { const cachePaths = [path.resolve(paths)] const createTarMock = jest.spyOn(tar, 'createTar') - const logWarningMock = jest.spyOn(core, 'warning') + const logErrorMock = jest.spyOn(core, 'error') const cacheSize = 11 * 1024 * 1024 * 1024 //~11GB, over the 10GB limit jest @@ -78,7 +78,7 @@ test('save with large cache outputs should fail using', async () => { const cacheId = await saveCache([paths], key) expect(cacheId).toBe(-1) - expect(logWarningMock).toHaveBeenCalledWith( + expect(logErrorMock).toHaveBeenCalledWith( 'Failed to save: Cache size of ~11264 MB (11811160064 B) is over the 10GB limit, not saving cache.' ) @@ -227,7 +227,7 @@ test('finalize save cache failure', async () => { const paths = 'node_modules' const key = 'Linux-node-bb828da54c148048dd17899ba9fda624811cfb43' const cachePaths = [path.resolve(paths)] - const logWarningMock = jest.spyOn(core, 'warning') + const logErrorMock = jest.spyOn(core, 'error') const signedUploadURL = 'https://blob-storage.local?signed=true' const archiveFileSize = 1024 const options: UploadOptions = { @@ -292,7 +292,7 @@ test('finalize save cache failure', async () => { }) expect(cacheId).toBe(-1) - expect(logWarningMock).toHaveBeenCalledWith( + expect(logErrorMock).toHaveBeenCalledWith( `Failed to save: Unable to finalize cache with key ${key}, another job may be finalizing this cache.` ) })