1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-11-27 22:49:15 +02:00

Move trace sdk tests from trace_test into trace package (#6400)

I would like to be able to use a private option in
https://github.com/open-telemetry/opentelemetry-go/pull/6393 in tests,
and decided to split this refactoring out into its own PR.

This moves the batch span processor benchmarks into benchmark_test.go,
and replaces one instance of the tracetest.NewInMemoryExporter with a
different test exporter implementation. It then moves most unit tests
from `trace_test` to the main `trace` package.
This commit is contained in:
David Ashpole
2025-03-04 21:29:11 -05:00
committed by GitHub
parent 38f4f39284
commit e2aee3aff8
5 changed files with 147 additions and 171 deletions

View File

@@ -1,25 +1,24 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
package trace_test
package trace
import (
"context"
"testing"
"go.opentelemetry.io/otel/attribute"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
"go.opentelemetry.io/otel/trace"
)
type testSpanProcessor struct {
name string
spansStarted []sdktrace.ReadWriteSpan
spansEnded []sdktrace.ReadOnlySpan
spansStarted []ReadWriteSpan
spansEnded []ReadOnlySpan
shutdownCount int
}
func (t *testSpanProcessor) OnStart(parent context.Context, s sdktrace.ReadWriteSpan) {
func (t *testSpanProcessor) OnStart(parent context.Context, s ReadWriteSpan) {
if t == nil {
return
}
@@ -46,7 +45,7 @@ func (t *testSpanProcessor) OnStart(parent context.Context, s sdktrace.ReadWrite
t.spansStarted = append(t.spansStarted, s)
}
func (t *testSpanProcessor) OnEnd(s sdktrace.ReadOnlySpan) {
func (t *testSpanProcessor) OnEnd(s ReadOnlySpan) {
if t == nil {
return
}