MCPcopy
hub / github.com/grafana/tempo / TestRedactCmdSubmit

Function TestRedactCmdSubmit

cmd/tempo-cli/cmd-redact_test.go:28–52  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

26}
27
28func TestRedactCmdSubmit(t *testing.T) {
29 const (
30 tenant = "test-tenant"
31 traceIDHex = "931281e2a09876de16e15f45ff86283d"
32 )
33
34 traceIDBytes, err := util.HexStringToTraceID(traceIDHex)
35 require.NoError(t, err)
36
37 mock := &mockSchedulerClient{}
38 cmd := &redactCmd{TenantID: tenant}
39
40 resp, err := cmd.submit(context.Background(), mock, [][]byte{traceIDBytes})
41 require.NoError(t, err)
42 require.Equal(t, "test-batch", resp.BatchId)
43
44 // Org ID must be present in the outgoing gRPC metadata.
45 md, ok := metadata.FromOutgoingContext(mock.capturedCtx)
46 require.True(t, ok, "expected outgoing metadata on context")
47 require.Equal(t, []string{tenant}, md["x-scope-orgid"])
48
49 // Request body must carry the tenant and trace IDs.
50 require.Equal(t, tenant, mock.capturedReq.TenantId)
51 require.Equal(t, [][]byte{traceIDBytes}, mock.capturedReq.TraceIds)
52}
53
54func TestParseTraceIDs(t *testing.T) {
55 t.Run("valid", func(t *testing.T) {

Callers

nothing calls this directly

Calls 3

submitMethod · 0.95
HexStringToTraceIDFunction · 0.92
EqualMethod · 0.45

Tested by

no test coverage detected