Skip to content

Commit

Permalink
fix wrong assert/require merge
Browse files Browse the repository at this point in the history
  • Loading branch information
dmathieu committed Sep 18, 2024
1 parent 9a8b8a7 commit 8549655
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions exporter/exporterhelper/internal/batch_sender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -550,8 +550,8 @@ func TestBatchSender_ShutdownDeadlock(t *testing.T) {
sink := newFakeRequestSink()

// Send 2 concurrent requests
go func() { require.NoError(t, be.Send(context.Background(), &fakeRequest{items: 4, sink: sink})) }()
go func() { require.NoError(t, be.Send(context.Background(), &fakeRequest{items: 4, sink: sink})) }()
go func() { assert.NoError(t, be.Send(context.Background(), &fakeRequest{items: 4, sink: sink})) }()
go func() { assert.NoError(t, be.Send(context.Background(), &fakeRequest{items: 4, sink: sink})) }()

// Wait for the requests to enter the merge function
<-waitMerge
Expand Down Expand Up @@ -591,7 +591,7 @@ func TestBatchSenderWithTimeout(t *testing.T) {
for i := 0; i < 3; i++ {
wg.Add(1)
go func() {
require.NoError(t, be.Send(context.Background(), &fakeRequest{items: 4, sink: sink}))
assert.NoError(t, be.Send(context.Background(), &fakeRequest{items: 4, sink: sink}))
wg.Done()
}()
}
Expand Down Expand Up @@ -645,11 +645,11 @@ func TestBatchSenderTimerResetNoConflict(t *testing.T) {

// Send 2 concurrent requests that should be merged in one batch in the same interval as the flush timer
go func() {
require.NoError(t, be.Send(context.Background(), &fakeRequest{items: 4, sink: sink}))
assert.NoError(t, be.Send(context.Background(), &fakeRequest{items: 4, sink: sink}))
}()
time.Sleep(30 * time.Millisecond)
go func() {
require.NoError(t, be.Send(context.Background(), &fakeRequest{items: 4, sink: sink}))
assert.NoError(t, be.Send(context.Background(), &fakeRequest{items: 4, sink: sink}))
}()

// The batch should be sent either with the flush interval or by reaching the minimum items size with no conflict
Expand Down Expand Up @@ -677,10 +677,10 @@ func TestBatchSenderTimerFlush(t *testing.T) {

// Send 2 concurrent requests that should be merged in one batch and sent immediately
go func() {
require.NoError(t, be.Send(context.Background(), &fakeRequest{items: 4, sink: sink}))
assert.NoError(t, be.Send(context.Background(), &fakeRequest{items: 4, sink: sink}))
}()
go func() {
require.NoError(t, be.Send(context.Background(), &fakeRequest{items: 4, sink: sink}))
assert.NoError(t, be.Send(context.Background(), &fakeRequest{items: 4, sink: sink}))
}()
assert.EventuallyWithT(t, func(c *assert.CollectT) {
assert.LessOrEqual(c, uint64(1), sink.requestsCount.Load())
Expand All @@ -689,7 +689,7 @@ func TestBatchSenderTimerFlush(t *testing.T) {

// Send another request that should be flushed after 100ms instead of 50ms since last flush
go func() {
require.NoError(t, be.Send(context.Background(), &fakeRequest{items: 4, sink: sink}))
assert.NoError(t, be.Send(context.Background(), &fakeRequest{items: 4, sink: sink}))
}()

// Confirm that it is not flushed in 50ms
Expand Down
4 changes: 2 additions & 2 deletions exporter/otlphttpexporter/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -952,10 +952,10 @@ func TestPartialSuccess_profiles(t *testing.T) {
partial.SetErrorMessage("hello")
partial.SetRejectedProfiles(1)
bytes, err := response.MarshalProto()
require.NoError(t, err)
assert.NoError(t, err)
writer.Header().Set("Content-Type", "application/x-protobuf")
_, err = writer.Write(bytes)
require.NoError(t, err)
assert.NoError(t, err)
})
defer srv.Close()

Expand Down

0 comments on commit 8549655

Please sign in to comment.