forked from mtusi2026/mtusi2026lab6
31 lines
771 B
Go
31 lines
771 B
Go
package objectstore
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
)
|
|
|
|
type tracerFixture struct {
|
|
operation string
|
|
finished bool
|
|
}
|
|
|
|
// Start records a stable operation name and closes it through the returned callback.
|
|
func (f *tracerFixture) Start(ctx context.Context, name, _ string) (context.Context, func(error)) {
|
|
f.operation = name
|
|
return ctx, func(error) {
|
|
f.finished = true
|
|
}
|
|
}
|
|
|
|
// TestObjectObservationOmitsCoordinates keeps bucket keys and credentials outside the tracer boundary.
|
|
func TestObjectObservationOmitsCoordinates(t *testing.T) {
|
|
tracer := &tracerFixture{}
|
|
client := (&Client{}).WithTracer(tracer)
|
|
_, finish := client.start(t.Context(), "s3.put")
|
|
finish(nil)
|
|
if tracer.operation != "s3.put" || !tracer.finished {
|
|
t.Fatal("operation span missing")
|
|
}
|
|
}
|