mirror of
https://github.com/cypress-io/cypress.git
synced 2026-04-29 19:41:16 -05:00
Retry network requests on ENOTFOUND (#4459)
This commit is contained in:
committed by
Brian Mann
parent
387ca00068
commit
c4a0fddd5f
@@ -19,7 +19,7 @@ CookieJar = tough.CookieJar
|
||||
## shallow clone the original
|
||||
serializableProperties = Cookie.serializableProperties.slice(0)
|
||||
|
||||
NETWORK_ERRORS = "ECONNREFUSED ECONNRESET EPIPE EHOSTUNREACH EAI_AGAIN".split(" ")
|
||||
NETWORK_ERRORS = "ECONNREFUSED ECONNRESET EPIPE EHOSTUNREACH EAI_AGAIN ENOTFOUND".split(" ")
|
||||
VERBOSE_REQUEST_OPTS = "followRedirect jar strictSSL".split(" ")
|
||||
HTTP_CLIENT_REQUEST_EVENTS = "abort connect continue information socket timeout upgrade".split(" ")
|
||||
|
||||
|
||||
@@ -214,6 +214,26 @@ describe "lib/request", ->
|
||||
expect(retries).to.eq(4)
|
||||
done()
|
||||
|
||||
it "retries 4x on a NXDOMAIN (ENOTFOUND)", (done) ->
|
||||
nock.enableNetConnect()
|
||||
|
||||
opts = {
|
||||
url: "http://will-never-exist.invalid.example.com"
|
||||
retryIntervals: [0, 1, 2, 3]
|
||||
}
|
||||
|
||||
stream = request.create(opts)
|
||||
|
||||
retries = 0
|
||||
|
||||
stream.on "retry", ->
|
||||
retries++
|
||||
|
||||
stream.on "error", (err) ->
|
||||
expect(err.code).to.eq('ENOTFOUND')
|
||||
expect(retries).to.eq(4)
|
||||
done()
|
||||
|
||||
context "retries for promises", ->
|
||||
it "does not retry on a timeout", ->
|
||||
opts = {
|
||||
|
||||
Reference in New Issue
Block a user