diff --git a/plugin/storage/kafka/marshaller_test.go b/plugin/storage/kafka/marshalling_test.go similarity index 63% rename from plugin/storage/kafka/marshaller_test.go rename to plugin/storage/kafka/marshalling_test.go index 785551ea641b..8b0d8139dc45 100644 --- a/plugin/storage/kafka/marshaller_test.go +++ b/plugin/storage/kafka/marshalling_test.go @@ -20,20 +20,22 @@ import ( "github.com/stretchr/testify/assert" ) -func TestProtoMarshaller(t *testing.T) { - marshaller := newProtobufMarshaller() +func TestProtobufMarshallerAndUnmarshaller(t *testing.T) { + testMarshallerAndUnmarshaller(t,newProtobufMarshaller(),NewProtobufUnmarshaller()) +} + +func TestJSONMarshallerAndUnmarshaller(t *testing.T) { + testMarshallerAndUnmarshaller(t,newJSONMarshaller(),NewJSONUnmarshaller()) +} +func testMarshallerAndUnmarshaller(t *testing.T, marshaller Marshaller, unmarshaller Unmarshaller) { bytes, err := marshaller.Marshal(sampleSpan) assert.NoError(t, err) assert.NotNil(t, bytes) -} -func TestJSONMarshaller(t *testing.T) { - marshaller := newJSONMarshaller() - - bytes, err := marshaller.Marshal(sampleSpan) + resultSpan, err := unmarshaller.Unmarshal(bytes) assert.NoError(t, err) - assert.NotNil(t, bytes) + assert.Equal(t, sampleSpan, resultSpan) }