forked from TrueCloudLab/frostfs-api-go
[#168] refs: Implement binary/JSON encoders/decoders on OwnerID
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
c0f3ac51d4
commit
9ec57ee9f8
6 changed files with 110 additions and 6 deletions
|
@ -11,7 +11,6 @@ import (
|
|||
|
||||
func TestOwnerID_StableMarshal(t *testing.T) {
|
||||
ownerFrom := new(refs.OwnerID)
|
||||
ownerTransport := new(grpc.OwnerID)
|
||||
|
||||
t.Run("non empty", func(t *testing.T) {
|
||||
ownerFrom.SetValue([]byte("Owner ID"))
|
||||
|
@ -19,10 +18,9 @@ func TestOwnerID_StableMarshal(t *testing.T) {
|
|||
wire, err := ownerFrom.StableMarshal(nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
err = goproto.Unmarshal(wire, ownerTransport)
|
||||
require.NoError(t, err)
|
||||
ownerTo := new(refs.OwnerID)
|
||||
require.NoError(t, ownerTo.Unmarshal(wire))
|
||||
|
||||
ownerTo := refs.OwnerIDFromGRPCMessage(ownerTransport)
|
||||
require.Equal(t, ownerFrom, ownerTo)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue