diff --git a/pkg/storagegroup/storagegroup.go b/pkg/storagegroup/storagegroup.go index 0ae52abc..c1994c3a 100644 --- a/pkg/storagegroup/storagegroup.go +++ b/pkg/storagegroup/storagegroup.go @@ -11,6 +11,8 @@ import ( type StorageGroup storagegroup.StorageGroup // NewFromV2 wraps v2 StorageGroup message to StorageGroup. +// +// Nil storagegroup.StorageGroup converts to nil. func NewFromV2(aV2 *storagegroup.StorageGroup) *StorageGroup { return (*StorageGroup)(aV2) } @@ -110,6 +112,8 @@ func (sg *StorageGroup) SetMembers(members []*object.ID) { } // ToV2 converts StorageGroup to v2 StorageGroup message. +// +// Nil StorageGroup converts to nil. func (sg *StorageGroup) ToV2() *storagegroup.StorageGroup { return (*storagegroup.StorageGroup)(sg) } diff --git a/pkg/storagegroup/storagegroup_test.go b/pkg/storagegroup/storagegroup_test.go index 51184312..b89f5440 100644 --- a/pkg/storagegroup/storagegroup_test.go +++ b/pkg/storagegroup/storagegroup_test.go @@ -8,6 +8,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg/storagegroup" storagegrouptest "github.com/nspcc-dev/neofs-api-go/pkg/storagegroup/test" refstest "github.com/nspcc-dev/neofs-api-go/pkg/test" + storagegroupV2 "github.com/nspcc-dev/neofs-api-go/v2/storagegroup" "github.com/stretchr/testify/require" ) @@ -54,3 +55,19 @@ func TestStorageGroupEncoding(t *testing.T) { require.Equal(t, sg, sg2) }) } + +func TestNewFromV2(t *testing.T) { + t.Run("from nil", func(t *testing.T) { + var x *storagegroupV2.StorageGroup + + require.Nil(t, storagegroup.NewFromV2(x)) + }) +} + +func TestStorageGroup_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *storagegroup.StorageGroup + + require.Nil(t, x.ToV2()) + }) +}