package tracing import ( "context" "testing" "go.opentelemetry.io/otel/trace" ) func TestSpan_NoParent(t *testing.T) { ctx := context.Background() tests := []struct { name string fn func(context.Context) (context.Context, trace.Span) }{ {"bolt", func(ctx context.Context) (context.Context, trace.Span) { return BoltSpan(ctx, "GetSession", "oauth_sessions") }}, {"sqlite", func(ctx context.Context) (context.Context, trace.Span) { return SqliteSpan(ctx, "query", "records") }}, {"pds", func(ctx context.Context) (context.Context, trace.Span) { return PdsSpan(ctx, "createRecord", "x.y.z", "did:plc:test") }}, } for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { _, span := tc.fn(ctx) if span.SpanContext().IsValid() { t.Fatal("expected no-op span without parent") } }) } } func TestEndWithError_Nil(t *testing.T) { // Should not panic on nil error span := trace.SpanFromContext(context.Background()) EndWithError(span, nil) }