[#168] container: Implement binary/JSON encoders/decoders on Attribute

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-13 15:14:39 +03:00 committed by Alex Vanin
parent ec957be60c
commit bc5d9dcce5
4 changed files with 92 additions and 49 deletions

View file

@ -14,16 +14,14 @@ import (
func TestAttribute_StableMarshal(t *testing.T) {
attributeFrom := generateAttribute("key", "value")
transport := new(grpc.Container_Attribute)
t.Run("non empty", func(t *testing.T) {
wire, err := attributeFrom.StableMarshal(nil)
require.NoError(t, err)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
attributeTo := new(container.Attribute)
require.NoError(t, attributeTo.Unmarshal(wire))
attributeTo := container.AttributeFromGRPCMessage(transport)
require.Equal(t, attributeFrom, attributeTo)
})
}