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
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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user