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

Function pushToLiveStore

modules/livestore/live_store_test.go:1081–1106  ·  view source on GitHub ↗
(t *testing.T, liveStore *LiveStore)

Source from the content-addressed store, hash-verified

1079}
1080
1081func pushToLiveStore(t *testing.T, liveStore *LiveStore) ([]byte, *tempopb.Trace) {
1082 // create trace
1083 id := test.ValidTraceID(nil)
1084 expectedTrace := test.MakeTrace(5, id)
1085 traceBytes, err := proto.Marshal(expectedTrace)
1086 require.NoError(t, err)
1087
1088 // create push bytes request
1089 request := &tempopb.PushBytesRequest{
1090 Traces: []tempopb.PreallocBytes{{Slice: traceBytes}},
1091 Ids: [][]byte{id},
1092 }
1093 requestRecords, err := ingest.Encode(0, testTenantID, request, 1_000_000)
1094 require.NoError(t, err)
1095
1096 // set timestamp so they are accepted
1097 now := time.Now()
1098 for _, kgoRec := range requestRecords {
1099 kgoRec.Timestamp = now
1100 }
1101
1102 _, err = liveStore.consume(t.Context(), createRecordIter(requestRecords), now)
1103 require.NoError(t, err)
1104
1105 return id, expectedTrace
1106}
1107
1108func TestIsLagged(t *testing.T) {
1109 now := time.Now()

Calls 8

ValidTraceIDFunction · 0.92
MakeTraceFunction · 0.92
EncodeFunction · 0.92
createRecordIterFunction · 0.85
MarshalMethod · 0.65
NowMethod · 0.65
ContextMethod · 0.65
consumeMethod · 0.45

Tested by

no test coverage detected