Skip to content

Commit

Permalink
[chore] [exporterhelper] Remove redundant test helper (#8625)
Browse files Browse the repository at this point in the history
Cut from
#8275
  • Loading branch information
dmitryax authored Oct 5, 2023
1 parent b5635a7 commit 72d469b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
9 changes: 1 addition & 8 deletions exporter/exporterhelper/queue_sender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,6 @@ func TestQueuedRetryPersistentEnabled_shutdown_dataIsRequeued(t *testing.T) {
rCfg.InitialInterval = time.Millisecond
rCfg.MaxElapsedTime = 0 // retry infinitely so shutdown can be triggered

req := newMockRequest(context.Background(), 3, errors.New("some error"))

be, err := newBaseExporter(defaultSettings, "", false, nil, nil, newNoopObsrepSender, WithRetry(rCfg), WithQueue(qCfg))
require.NoError(t, err)

Expand All @@ -320,13 +318,8 @@ func TestQueuedRetryPersistentEnabled_shutdown_dataIsRequeued(t *testing.T) {
}
be.queueSender.(*queueSender).requeuingEnabled = true

// replace nextSender inside retrySender to always return error so it doesn't exit send loop
be.retrySender.setNextSender(&errorRequestSender{
errToReturn: errors.New("some error"),
})

// Invoke queuedRetrySender so the producer will put the item for consumer to poll
require.NoError(t, be.send(req))
require.NoError(t, be.send(newErrorRequest(context.Background())))

// first wait for the item to be produced to the queue initially
assert.Eventually(t, func() bool {
Expand Down
9 changes: 0 additions & 9 deletions exporter/exporterhelper/retry_sender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,12 +404,3 @@ func (pcq *producerConsumerQueueWithCounter) Produce(item internal.Request) bool
pcq.produceCounter.Add(1)
return pcq.ProducerConsumerQueue.Produce(item)
}

type errorRequestSender struct {
baseRequestSender
errToReturn error
}

func (rs *errorRequestSender) send(_ internal.Request) error {
return rs.errToReturn
}

0 comments on commit 72d469b

Please sign in to comment.