Skip to content

Commit 0274bcc

Browse files
committed
Include 409 special case in unit test
1 parent c1ca4b7 commit 0274bcc

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

exporter/elasticsearchexporter/esclient_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,17 @@ func TestComponentStatus(t *testing.T) {
5252
require.Fail(t, "LogRoundTrip with an http error code should report a recoverable error status")
5353
}
5454

55+
// Pass in a 409 (duplicate document) and make sure it doesn't report a new status
56+
_ = esLogger.LogRoundTrip(
57+
&http.Request{URL: &url.URL{}},
58+
&http.Response{StatusCode: http.StatusConflict, Status: "409 duplicate"},
59+
nil, time.Now(), 0)
60+
select {
61+
case <-statusChan:
62+
assert.Fail(t, "LogRoundTrip with a 409 should not change the component status")
63+
default:
64+
}
65+
5566
// Pass in an http success status and make sure the component status returns to OK
5667
_ = esLogger.LogRoundTrip(
5768
&http.Request{URL: &url.URL{}},

0 commit comments

Comments
 (0)