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

Function TestExtension_JSONRoundTrip_Overrides

modules/overrides/extension_test.go:371–393  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

369}
370
371func TestExtension_JSONRoundTrip_Overrides(t *testing.T) {
372 resetRegistryForTesting(t)
373 get := RegisterExtension(&testExtension{})
374
375 fieldB := 13
376 o := Overrides{}
377 o.Ingestion.MaxLocalTracesPerUser = 777
378 o.Extensions = map[string]any{
379 "test_extension": &testExtension{FieldA: "json_rt", FieldB: &fieldB},
380 }
381
382 b, err := json.Marshal(&o)
383 require.NoError(t, err)
384
385 var o2 Overrides
386 require.NoError(t, json.Unmarshal(b, &o2))
387
388 assert.Equal(t, 777, o2.Ingestion.MaxLocalTracesPerUser)
389 ext := get(&o2)
390 require.NotNil(t, ext)
391 assert.Equal(t, "json_rt", ext.FieldA)
392 assert.Equal(t, 13, *ext.FieldB)
393}
394
395func TestExtension_LegacyConversionRoundTrip(t *testing.T) {
396 resetRegistryForTesting(t)

Callers

nothing calls this directly

Calls 5

resetRegistryForTestingFunction · 0.85
RegisterExtensionFunction · 0.85
MarshalMethod · 0.65
UnmarshalMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected