| 62 | } |
| 63 | |
| 64 | func 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 | |
| 88 | func TestCodecMarshallAndUnmarshall_otel_proto_type(t *testing.T) { |
| 89 | c := NewCodec() |