forked from TrueCloudLab/frostfs-api-go
[#302] pkg/netmap: Convert nil NetworkInfo
to nil message
Document that `NetworkInfo.ToV2` method return `nil` when called on `nil`. Document that `NewNetworkInfoFromV2` function return `nil` when called on `nil`. Write corresponding unit tests. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
44437bf81a
commit
6142a352da
2 changed files with 18 additions and 0 deletions
|
@ -51,3 +51,17 @@ func TestNetworkInfoEncoding(t *testing.T) {
|
|||
require.Equal(t, i, i2)
|
||||
})
|
||||
}
|
||||
|
||||
func TestNewNetworkInfoFromV2(t *testing.T) {
|
||||
t.Run("nil", func(t *testing.T) {
|
||||
require.Nil(t, NewNetworkInfoFromV2(nil))
|
||||
})
|
||||
}
|
||||
|
||||
func TestNetworkInfo_ToV2(t *testing.T) {
|
||||
t.Run("nil", func(t *testing.T) {
|
||||
var x *NetworkInfo
|
||||
|
||||
require.Nil(t, x.ToV2())
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue