mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2026-05-04 20:08:04 +08:00
only retry downloadtool on 500s and 408 and 429 (#373)
This commit is contained in:
@@ -619,6 +619,39 @@ describe('@actions/tool-cache', function() {
|
||||
expect(err.toString()).toContain('502')
|
||||
}
|
||||
})
|
||||
|
||||
it('retries 429s', async function() {
|
||||
nock('http://example.com')
|
||||
.get('/too-many-requests-429')
|
||||
.times(2)
|
||||
.reply(429, undefined)
|
||||
nock('http://example.com')
|
||||
.get('/too-many-requests-429')
|
||||
.reply(500, undefined)
|
||||
|
||||
try {
|
||||
const statusCodeUrl = 'http://example.com/too-many-requests-429'
|
||||
await tc.downloadTool(statusCodeUrl)
|
||||
} catch (err) {
|
||||
expect(err.toString()).toContain('500')
|
||||
}
|
||||
})
|
||||
|
||||
it("doesn't retry 404", async function() {
|
||||
nock('http://example.com')
|
||||
.get('/not-found-404')
|
||||
.reply(404, undefined)
|
||||
nock('http://example.com')
|
||||
.get('/not-found-404')
|
||||
.reply(500, undefined)
|
||||
|
||||
try {
|
||||
const statusCodeUrl = 'http://example.com/not-found-404'
|
||||
await tc.downloadTool(statusCodeUrl)
|
||||
} catch (err) {
|
||||
expect(err.toString()).toContain('404')
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user