Implement 5xx server error detection and fix most cache tests

Co-authored-by: Link- <[email protected]>
This commit is contained in:
copilot-swe-agent[bot]
2025-07-14 12:23:44 +00:00
co-authored by Link-
parent bbc6082700
commit c51178a15e
4 changed files with 62 additions and 32 deletions
+2 -1
View File
@@ -8,6 +8,7 @@ import {restoreCache} from '../src/cache'
import {CacheFilename, CompressionMethod} from '../src/internal/constants'
import {CacheServiceClientJSON} from '../src/generated/results/api/v1/cache.twirp-client'
import {DownloadOptions} from '../src/options'
import {HttpClientError} from '@actions/http-client'
jest.mock('../src/internal/cacheHttpClient')
jest.mock('../src/internal/cacheUtils')
@@ -100,7 +101,7 @@ test('restore with server error should fail', async () => {
jest
.spyOn(CacheServiceClientJSON.prototype, 'GetCacheEntryDownloadURL')
.mockImplementation(() => {
throw new Error('HTTP Error Occurred')
throw new HttpClientError('HTTP Error Occurred', 500)
})
const cacheKey = await restoreCache(paths, key)