(t *testing.T)
| 67 | } |
| 68 | |
| 69 | func TestWithoutCaller(t *testing.T) { |
| 70 | provider := sdktrace.NewTracerProvider() |
| 71 | hook := newTracingHook( |
| 72 | "", |
| 73 | WithTracerProvider(provider), |
| 74 | WithCallerEnabled(false), |
| 75 | ) |
| 76 | ctx, span := provider.Tracer("redis-test").Start(context.TODO(), "redis-test") |
| 77 | cmd := redis.NewCmd(ctx, "ping") |
| 78 | defer span.End() |
| 79 | |
| 80 | processHook := hook.ProcessHook(func(ctx context.Context, cmd redis.Cmder) error { |
| 81 | attrs := trace.SpanFromContext(ctx).(sdktrace.ReadOnlySpan).Attributes() |
| 82 | for _, attr := range attrs { |
| 83 | switch attr.Key { |
| 84 | case semconv.CodeFunctionKey, |
| 85 | semconv.CodeFilepathKey, |
| 86 | semconv.CodeLineNumberKey: |
| 87 | t.Fatalf("Attribute with %s statement should not exist", attr.Key) |
| 88 | } |
| 89 | } |
| 90 | return nil |
| 91 | }) |
| 92 | err := processHook(ctx, cmd) |
| 93 | if err != nil { |
| 94 | t.Fatal(err) |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | func TestWithCommandFilter(t *testing.T) { |
| 99 |
nothing calls this directly
no test coverage detected