You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-11-27 22:49:15 +02:00
sdk/trace: Refine context cancellation in batchSpanProcessor.ForceFlush (#4369)
This commit is contained in:
@@ -560,6 +560,18 @@ func TestBatchSpanProcessorForceFlushCancellation(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestBatchSpanProcessorForceFlushTimeout(t *testing.T) {
|
||||
// Add timeout to context to test deadline
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Nanosecond)
|
||||
defer cancel()
|
||||
<-ctx.Done()
|
||||
|
||||
bsp := sdktrace.NewBatchSpanProcessor(indefiniteExporter{})
|
||||
if got, want := bsp.ForceFlush(ctx), context.DeadlineExceeded; !errors.Is(got, want) {
|
||||
t.Errorf("expected %q error, got %v", want, got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBatchSpanProcessorForceFlushQueuedSpans(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user