Skip to content

Commit

Permalink
Improve test case to verify multiple flushes.
Browse files Browse the repository at this point in the history
  • Loading branch information
pkwarren committed Oct 29, 2021
1 parent 4eb4f2b commit 0180f37
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions sdk/trace/batch_span_processor_test.go
Expand Up @@ -18,6 +18,7 @@ import (
"context"
"encoding/binary"
"errors"
"fmt"
"sync"
"testing"
"time"
Expand Down Expand Up @@ -470,12 +471,13 @@ func TestBatchSpanProcessorForceFlushQueuedSpans(t *testing.T) {

tracer := tp.Tracer("tracer")

_, span := tracer.Start(ctx, "span")
span.End()
for i := 0; i < 10; i++ {
_, span := tracer.Start(ctx, fmt.Sprintf("span%d", i))
span.End()

err := tp.ForceFlush(ctx)
assert.NoError(t, err)
err := tp.ForceFlush(ctx)
assert.NoError(t, err)

// Expect well defined behavior due to calling ForceFlush
assert.Len(t, exp.GetSpans(), 1)
assert.Len(t, exp.GetSpans(), i+1)
}
}

0 comments on commit 0180f37

Please sign in to comment.