Skip to content

Commit

Permalink
Cherry-pick #20366 to 7.x: Pipeline client test log progress (#23283)
Browse files Browse the repository at this point in the history
(cherry picked from commit ff4d1c0)
  • Loading branch information
Steffen Siering authored Jan 4, 2021
1 parent 7bd1179 commit 8a6f030
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions libbeat/publisher/pipeline/output_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ func TestReplaceClientWorker(t *testing.T) {
var numEvents int
for i := uint(0); i < numBatches; i++ {
batch := randomBatch(minEventsInBatch, maxEventsInBatch).withRetryer(retryer)
batch.events[0].Content.Private = i
numEvents += batch.Len()
batches = append(batches, batch)
}
Expand All @@ -131,6 +132,7 @@ func TestReplaceClientWorker(t *testing.T) {
go func() {
defer wg.Done()
for _, batch := range batches {
t.Logf("publish batch: %v", batch.(*mockBatch).events[0].Content.Private)
wqu <- batch
}
}()
Expand All @@ -147,7 +149,9 @@ func TestReplaceClientWorker(t *testing.T) {
<-blockCtrl
}

publishedFirst.Add(uint(len(batch.Events())))
count := len(batch.Events())
publishedFirst.Add(uint(count))
t.Logf("#1 processed batch: %v (%v)", batch.(*mockBatch).events[0].Content.Private, count)
return nil
}

Expand All @@ -172,7 +176,9 @@ func TestReplaceClientWorker(t *testing.T) {
// Start new worker to drain work queue
var publishedLater atomic.Uint
countingPublishFn := func(batch publisher.Batch) error {
publishedLater.Add(uint(len(batch.Events())))
count := len(batch.Events())
publishedLater.Add(uint(count))
t.Logf("#2 processed batch: %v (%v)", batch.(*mockBatch).events[0].Content.Private, count)
return nil
}

Expand Down

0 comments on commit 8a6f030

Please sign in to comment.