forked from TrueCloudLab/frostfs-node
[#607] network: Implement WriteToNodeInfo method on Address
Implement `Address.WriteToNodeInfo` method which sets address of `NodeInfo` structure. Use it in storage node application. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
e5504c7130
commit
5de074f24c
3 changed files with 23 additions and 1 deletions
|
@ -4,6 +4,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/multiformats/go-multiaddr"
|
||||
"github.com/nspcc-dev/neofs-api-go/pkg/netmap"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
@ -63,3 +64,18 @@ func buildMultiaddr(s string, t *testing.T) multiaddr.Multiaddr {
|
|||
require.NoError(t, err)
|
||||
return ma
|
||||
}
|
||||
|
||||
func TestAddress_WriteToNodeInfo(t *testing.T) {
|
||||
a := "127.0.0.1:8080"
|
||||
|
||||
addr, err := AddressFromString(a)
|
||||
require.NoError(t, err)
|
||||
|
||||
var ni netmap.NodeInfo
|
||||
|
||||
addr.WriteToNodeInfo(&ni)
|
||||
|
||||
restored, err := AddressFromString(ni.Address())
|
||||
require.NoError(t, err)
|
||||
require.True(t, restored.Equal(*addr))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue