Skip to content

Commit

Permalink
Add test for the Unwrap error codes path
Browse files Browse the repository at this point in the history
  • Loading branch information
mstoykov committed Oct 8, 2020
1 parent c26e54e commit d1def0f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/netext/httpext/error_codes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,14 @@ func TestConnReset(t *testing.T) {
assert.Nil(t, err)
}
}

func TestDnsResolve(t *testing.T) {
// this uses the Unwrap path
// this is not happening in our current codebase as the resolution in our code
// happens earlier so it doesn't get wrapped, but possibly happens in other cases as well
_, err := http.Get("http://s.com") //nolint:bodyclose,noctx
code, msg := errorCodeForError(err)

assert.Equal(t, dnsNoSuchHostErrorCode, code)
assert.Equal(t, dnsNoSuchHostErrorCodeMsg, msg)
}

0 comments on commit d1def0f

Please sign in to comment.