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

Function TestRoundTripMeta

tempodb/backend/raw_test.go:211–243  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

209}
210
211func TestRoundTripMeta(t *testing.T) {
212 // RoundTrip with empty DedicatedColumns
213 meta := NewBlockMeta("test", uuid.New(), "blerg")
214 // RoundTrip with empty DedicatedColumns
215 expectedPb, err := meta.Marshal()
216 assert.NoError(t, err)
217 expectedPb2 := &BlockMeta{}
218 err = expectedPb2.Unmarshal(expectedPb)
219 assert.NoError(t, err)
220 assert.Equal(t, meta, expectedPb2)
221
222 // RoundTrip with non-empty DedicatedColumns
223 meta.DedicatedColumns = DedicatedColumns{
224 {Scope: "resource", Name: "namespace", Type: "string"},
225 {Scope: "span", Name: "http.method", Type: "string"},
226 {Scope: "span", Name: "namespace", Type: "string"},
227 }
228
229 expectedPb, err = meta.Marshal()
230 assert.NoError(t, err)
231 expectedPb3 := &BlockMeta{}
232 err = expectedPb3.Unmarshal(expectedPb)
233 assert.NoError(t, err)
234 assert.Equal(t, meta, expectedPb3)
235
236 // Round trip the json
237 jsonBytes, err := json.Marshal(meta)
238 assert.NoError(t, err)
239 expected2 := &BlockMeta{}
240 err = json.Unmarshal(jsonBytes, expected2)
241 assert.NoError(t, err)
242 assert.Equal(t, meta, expected2)
243}
244
245func TestTenantIndexFallback(t *testing.T) {
246 var (

Callers

nothing calls this directly

Calls 6

MarshalMethod · 0.95
UnmarshalMethod · 0.95
NewBlockMetaFunction · 0.85
MarshalMethod · 0.65
UnmarshalMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected