forked from TrueCloudLab/frostfs-api-go
[#189] sdk/netmap: Implement NodeInfo JSON encode/decode functions
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
8367b498d9
commit
40d7c9cd93
2 changed files with 31 additions and 0 deletions
|
@ -140,3 +140,19 @@ func TestNodeInfo_Attributes(t *testing.T) {
|
|||
|
||||
require.Equal(t, as, i.Attributes())
|
||||
}
|
||||
|
||||
func TestNodeInfoJSON(t *testing.T) {
|
||||
i := NewNodeInfo()
|
||||
i.SetPublicKey([]byte{1, 2, 3})
|
||||
i.SetAddress("some node address")
|
||||
i.SetState(NodeStateOnline)
|
||||
i.SetAttributes(testNodeAttribute(), testNodeAttribute())
|
||||
|
||||
j, err := NodeInfoToJSON(i)
|
||||
require.NoError(t, err)
|
||||
|
||||
i2, err := NodeInfoFromJSON(j)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, i, i2)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue