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

Function TestWireCompatibility

pkg/gogocodec/gogocodec_test.go:64–86  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

62}
63
64func TestWireCompatibility(t *testing.T) {
65 // marshal a tempo object using the custom codec
66 c := NewCodec()
67 req1 := &tempopb.TraceByIDRequest{
68 TraceID: []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01},
69 }
70 data, err := c.Marshal(req1)
71 require.NoError(t, err)
72
73 // unmarshal this into the generic empty type using golang proto
74 var goprotoMessage emptypb.Empty
75 err = proto.Unmarshal(data, &goprotoMessage)
76 require.NoError(t, err)
77
78 // marshal emptypb using golang proto
79 data2, err := proto.Marshal(&goprotoMessage)
80 require.NoError(t, err)
81
82 req2 := &tempopb.TraceByIDRequest{}
83 err = c.Unmarshal(data2, req2)
84 require.NoError(t, err)
85 assert.Equal(t, req1, req2)
86}
87
88func TestCodecMarshallAndUnmarshall_otel_proto_type(t *testing.T) {
89 c := NewCodec()

Callers

nothing calls this directly

Calls 4

NewCodecFunction · 0.85
MarshalMethod · 0.65
UnmarshalMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected