Skip to content

Commit

Permalink
Validate proper error code is reported on connection write failed test
Browse files Browse the repository at this point in the history
  • Loading branch information
renato.freitas authored and felipejfc committed Jun 25, 2024
1 parent 1d1cfe9 commit 11965de
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions agent/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1140,8 +1140,14 @@ func TestAgentWriteChSendWriteError(t *testing.T) {
var wg sync.WaitGroup
wg.Add(2)

errorTags := map[string]string{}
errorTags["route"] = "route"
errorTags["status"] = "failed"
errorTags["type"] = "handler"
errorTags["code"] = e.ErrClosedRequest

mockMetricsReporter.EXPECT().ReportGauge(metrics.ConnectedClients, gomock.Any(), gomock.Any())
mockMetricsReporter.EXPECT().ReportSummary(metrics.ResponseTime, gomock.Any(), gomock.Any())
mockMetricsReporter.EXPECT().ReportSummary(metrics.ResponseTime, errorTags, gomock.Any())

mockConn.EXPECT().RemoteAddr().Return(&mockAddr{}).Times(3)
mockConn.EXPECT().Close().Do(func() {
Expand All @@ -1151,7 +1157,6 @@ func TestAgentWriteChSendWriteError(t *testing.T) {
wg.Done()
}).Return(0, writeError)

//assert.Equal(t, e.NewError(constants.ErrBrokenPipe, e.ErrClientClosedRequest), err)
go ag.write()
ag.chSend <- pendingWrite{ctx: ctx, data: expectedPacket, err: nil}
wg.Wait()
Expand Down

0 comments on commit 11965de

Please sign in to comment.