Skip to content

Commit

Permalink
test: add ut
Browse files Browse the repository at this point in the history
  • Loading branch information
welkeyever committed Nov 29, 2023
1 parent a95b095 commit d3a9273
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/protocol/http1/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,3 +443,13 @@ type mockErrorWriter struct {
func (errorWriter *mockErrorWriter) Flush() error {
return errors.New("error")
}

func TestShouldRecordInTraceError(t *testing.T) {
assert.False(t, shouldRecordInTraceError(nil))
assert.False(t, shouldRecordInTraceError(errHijacked))
assert.False(t, shouldRecordInTraceError(errIdleTimeout))
assert.False(t, shouldRecordInTraceError(errShortConnection))

assert.True(t, shouldRecordInTraceError(errTimeout))
assert.True(t, shouldRecordInTraceError(errors.New("foo error")))
}

0 comments on commit d3a9273

Please sign in to comment.