forked from TrueCloudLab/frostfs-node
[#570] *: Use generator of test container IDs from API Go lib
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
3dd10b6795
commit
3e1463cc76
26 changed files with 64 additions and 155 deletions
|
@ -8,7 +8,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
|
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
|
||||||
"github.com/nspcc-dev/neofs-api-go/pkg/object"
|
"github.com/nspcc-dev/neofs-api-go/pkg/object"
|
||||||
"github.com/nspcc-dev/neofs-api-go/pkg/owner"
|
"github.com/nspcc-dev/neofs-api-go/pkg/owner"
|
||||||
"github.com/nspcc-dev/neofs-api-go/pkg/session"
|
"github.com/nspcc-dev/neofs-api-go/pkg/session"
|
||||||
|
@ -28,13 +28,6 @@ func testSHA(t *testing.T) [sha256.Size]byte {
|
||||||
return cs
|
return cs
|
||||||
}
|
}
|
||||||
|
|
||||||
func testContainerID(t *testing.T) *cid.ID {
|
|
||||||
id := cid.New()
|
|
||||||
id.SetSHA256(testSHA(t))
|
|
||||||
|
|
||||||
return id
|
|
||||||
}
|
|
||||||
|
|
||||||
func testObjectID(t *testing.T) *object.ID {
|
func testObjectID(t *testing.T) *object.ID {
|
||||||
id := object.NewID()
|
id := object.NewID()
|
||||||
id.SetSHA256(testSHA(t))
|
id.SetSHA256(testSHA(t))
|
||||||
|
@ -50,7 +43,7 @@ func blankValidObject(t *testing.T, key *ecdsa.PrivateKey) *RawObject {
|
||||||
ownerID.SetNeo3Wallet(wallet)
|
ownerID.SetNeo3Wallet(wallet)
|
||||||
|
|
||||||
obj := NewRaw()
|
obj := NewRaw()
|
||||||
obj.SetContainerID(testContainerID(t))
|
obj.SetContainerID(cidtest.Generate())
|
||||||
obj.SetOwnerID(ownerID)
|
obj.SetOwnerID(ownerID)
|
||||||
|
|
||||||
return obj
|
return obj
|
||||||
|
@ -94,7 +87,7 @@ func TestFormatValidator_Validate(t *testing.T) {
|
||||||
|
|
||||||
t.Run("unsigned object", func(t *testing.T) {
|
t.Run("unsigned object", func(t *testing.T) {
|
||||||
obj := NewRaw()
|
obj := NewRaw()
|
||||||
obj.SetContainerID(testContainerID(t))
|
obj.SetContainerID(cidtest.Generate())
|
||||||
obj.SetID(testObjectID(t))
|
obj.SetID(testObjectID(t))
|
||||||
|
|
||||||
require.Error(t, v.Validate(obj.Object()))
|
require.Error(t, v.Validate(obj.Object()))
|
||||||
|
@ -105,7 +98,7 @@ func TestFormatValidator_Validate(t *testing.T) {
|
||||||
tok.SetSessionKey(crypto.MarshalPublicKey(&ownerKey.PublicKey))
|
tok.SetSessionKey(crypto.MarshalPublicKey(&ownerKey.PublicKey))
|
||||||
|
|
||||||
obj := NewRaw()
|
obj := NewRaw()
|
||||||
obj.SetContainerID(testContainerID(t))
|
obj.SetContainerID(cidtest.Generate())
|
||||||
obj.SetSessionToken(tok)
|
obj.SetSessionToken(tok)
|
||||||
|
|
||||||
require.NoError(t, object.SetIDWithSignature(ownerKey, obj.SDK()))
|
require.NoError(t, object.SetIDWithSignature(ownerKey, obj.SDK()))
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
package audit_test
|
package audit_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/rand"
|
|
||||||
"crypto/sha256"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
|
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
|
||||||
|
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/innerring/processors/audit"
|
"github.com/nspcc-dev/neofs-node/pkg/innerring/processors/audit"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
@ -77,16 +76,10 @@ func TestSelect(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateContainers(n int) []*cid.ID {
|
func generateContainers(n int) []*cid.ID {
|
||||||
var buf [sha256.Size]byte
|
|
||||||
result := make([]*cid.ID, 0, n)
|
result := make([]*cid.ID, 0, n)
|
||||||
|
|
||||||
for i := 0; i < n; i++ {
|
for i := 0; i < n; i++ {
|
||||||
_, _ = rand.Read(buf[:])
|
result = append(result, cidtest.Generate())
|
||||||
|
|
||||||
id := cid.New()
|
|
||||||
id.SetSHA256(buf)
|
|
||||||
|
|
||||||
result = append(result, id)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
|
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
|
||||||
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/util/logger/test"
|
"github.com/nspcc-dev/neofs-node/pkg/util/logger/test"
|
||||||
|
@ -21,15 +21,12 @@ func testSHA256() (h [sha256.Size]byte) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAddress() *objectSDK.Address {
|
func testAddress() *objectSDK.Address {
|
||||||
id := cid.New()
|
|
||||||
id.SetSHA256(testSHA256())
|
|
||||||
|
|
||||||
oid := objectSDK.NewID()
|
oid := objectSDK.NewID()
|
||||||
oid.SetSHA256(testSHA256())
|
oid.SetSHA256(testSHA256())
|
||||||
|
|
||||||
addr := objectSDK.NewAddress()
|
addr := objectSDK.NewAddress()
|
||||||
addr.SetObjectID(oid)
|
addr.SetObjectID(oid)
|
||||||
addr.SetContainerID(id)
|
addr.SetContainerID(cidtest.Generate())
|
||||||
|
|
||||||
return addr
|
return addr
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
|
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
|
||||||
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/util/logger/test"
|
"github.com/nspcc-dev/neofs-node/pkg/util/logger/test"
|
||||||
|
@ -21,15 +21,12 @@ func testSHA256() (h [sha256.Size]byte) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAddress() *objectSDK.Address {
|
func testAddress() *objectSDK.Address {
|
||||||
id := cid.New()
|
|
||||||
id.SetSHA256(testSHA256())
|
|
||||||
|
|
||||||
oid := objectSDK.NewID()
|
oid := objectSDK.NewID()
|
||||||
oid.SetSHA256(testSHA256())
|
oid.SetSHA256(testSHA256())
|
||||||
|
|
||||||
addr := objectSDK.NewAddress()
|
addr := objectSDK.NewAddress()
|
||||||
addr.SetObjectID(oid)
|
addr.SetObjectID(oid)
|
||||||
addr.SetContainerID(id)
|
addr.SetContainerID(cidtest.Generate())
|
||||||
|
|
||||||
return addr
|
return addr
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,21 +8,11 @@ import (
|
||||||
"path"
|
"path"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
|
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
|
||||||
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func testCID() *cid.ID {
|
|
||||||
cs := [sha256.Size]byte{}
|
|
||||||
_, _ = rand.Read(cs[:])
|
|
||||||
|
|
||||||
id := cid.New()
|
|
||||||
id.SetSHA256(cs)
|
|
||||||
|
|
||||||
return id
|
|
||||||
}
|
|
||||||
|
|
||||||
func testOID() *objectSDK.ID {
|
func testOID() *objectSDK.ID {
|
||||||
cs := [sha256.Size]byte{}
|
cs := [sha256.Size]byte{}
|
||||||
_, _ = rand.Read(cs[:])
|
_, _ = rand.Read(cs[:])
|
||||||
|
@ -36,7 +26,7 @@ func testOID() *objectSDK.ID {
|
||||||
func testAddress() *objectSDK.Address {
|
func testAddress() *objectSDK.Address {
|
||||||
a := objectSDK.NewAddress()
|
a := objectSDK.NewAddress()
|
||||||
a.SetObjectID(testOID())
|
a.SetObjectID(testOID())
|
||||||
a.SetContainerID(testCID())
|
a.SetContainerID(cidtest.Generate())
|
||||||
|
|
||||||
return a
|
return a
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,16 +61,6 @@ func testNewShard(t *testing.T, id int) *shard.Shard {
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
func testCID() *cid.ID {
|
|
||||||
cs := [sha256.Size]byte{}
|
|
||||||
_, _ = rand.Read(cs[:])
|
|
||||||
|
|
||||||
id := cid.New()
|
|
||||||
id.SetSHA256(cs)
|
|
||||||
|
|
||||||
return id
|
|
||||||
}
|
|
||||||
|
|
||||||
func testOID() *objectSDK.ID {
|
func testOID() *objectSDK.ID {
|
||||||
cs := [sha256.Size]byte{}
|
cs := [sha256.Size]byte{}
|
||||||
_, _ = rand.Read(cs[:])
|
_, _ = rand.Read(cs[:])
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
|
||||||
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
|
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
@ -12,7 +13,7 @@ import (
|
||||||
func TestHeadRaw(t *testing.T) {
|
func TestHeadRaw(t *testing.T) {
|
||||||
defer os.RemoveAll(t.Name())
|
defer os.RemoveAll(t.Name())
|
||||||
|
|
||||||
cid := testCID()
|
cid := cidtest.Generate()
|
||||||
splitID := objectSDK.NewSplitID()
|
splitID := objectSDK.NewSplitID()
|
||||||
|
|
||||||
parent := generateRawObjectWithCID(t, cid)
|
parent := generateRawObjectWithCID(t, cid)
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
|
||||||
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
|
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
@ -12,7 +13,7 @@ import (
|
||||||
func TestStorageEngine_Inhume(t *testing.T) {
|
func TestStorageEngine_Inhume(t *testing.T) {
|
||||||
defer os.RemoveAll(t.Name())
|
defer os.RemoveAll(t.Name())
|
||||||
|
|
||||||
cid := testCID()
|
cid := cidtest.Generate()
|
||||||
splitID := objectSDK.NewSplitID()
|
splitID := objectSDK.NewSplitID()
|
||||||
|
|
||||||
fs := objectSDK.SearchFilters{}
|
fs := objectSDK.SearchFilters{}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
|
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
|
||||||
|
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
||||||
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
|
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
@ -84,7 +85,7 @@ func TestDB_ContainerSize(t *testing.T) {
|
||||||
objs := make(map[*cid.ID][]*object.RawObject, C*N)
|
objs := make(map[*cid.ID][]*object.RawObject, C*N)
|
||||||
|
|
||||||
for i := 0; i < C; i++ {
|
for i := 0; i < C; i++ {
|
||||||
cid := testCID()
|
cid := cidtest.Generate()
|
||||||
cids[cid] = 0
|
cids[cid] = 0
|
||||||
|
|
||||||
for j := 0; j < N; j++ {
|
for j := 0; j < N; j++ {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-api-go/pkg"
|
"github.com/nspcc-dev/neofs-api-go/pkg"
|
||||||
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
|
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
|
||||||
|
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
|
||||||
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
||||||
"github.com/nspcc-dev/neofs-api-go/pkg/owner"
|
"github.com/nspcc-dev/neofs-api-go/pkg/owner"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
||||||
|
@ -32,16 +33,6 @@ func testSelect(t *testing.T, db *meta.DB, cid *cid.ID, fs objectSDK.SearchFilte
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func testCID() *cid.ID {
|
|
||||||
cs := [sha256.Size]byte{}
|
|
||||||
_, _ = rand.Read(cs[:])
|
|
||||||
|
|
||||||
id := cid.New()
|
|
||||||
id.SetSHA256(cs)
|
|
||||||
|
|
||||||
return id
|
|
||||||
}
|
|
||||||
|
|
||||||
func testOID() *objectSDK.ID {
|
func testOID() *objectSDK.ID {
|
||||||
cs := [sha256.Size]byte{}
|
cs := [sha256.Size]byte{}
|
||||||
_, _ = rand.Read(cs[:])
|
_, _ = rand.Read(cs[:])
|
||||||
|
@ -68,7 +59,7 @@ func releaseDB(db *meta.DB) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateRawObject(t *testing.T) *object.RawObject {
|
func generateRawObject(t *testing.T) *object.RawObject {
|
||||||
return generateRawObjectWithCID(t, testCID())
|
return generateRawObjectWithCID(t, cidtest.Generate())
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateRawObjectWithCID(t *testing.T, cid *cid.ID) *object.RawObject {
|
func generateRawObjectWithCID(t *testing.T, cid *cid.ID) *object.RawObject {
|
||||||
|
@ -102,7 +93,7 @@ func generateRawObjectWithCID(t *testing.T, cid *cid.ID) *object.RawObject {
|
||||||
|
|
||||||
func generateAddress() *objectSDK.Address {
|
func generateAddress() *objectSDK.Address {
|
||||||
addr := objectSDK.NewAddress()
|
addr := objectSDK.NewAddress()
|
||||||
addr.SetContainerID(testCID())
|
addr.SetContainerID(cidtest.Generate())
|
||||||
addr.SetObjectID(testOID())
|
addr.SetObjectID(testOID())
|
||||||
|
|
||||||
return addr
|
return addr
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
|
||||||
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
||||||
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
|
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
@ -13,7 +14,7 @@ func TestDB_Delete(t *testing.T) {
|
||||||
db := newDB(t)
|
db := newDB(t)
|
||||||
defer releaseDB(db)
|
defer releaseDB(db)
|
||||||
|
|
||||||
cid := testCID()
|
cid := cidtest.Generate()
|
||||||
parent := generateRawObjectWithCID(t, cid)
|
parent := generateRawObjectWithCID(t, cid)
|
||||||
addAttribute(parent, "foo", "bar")
|
addAttribute(parent, "foo", "bar")
|
||||||
|
|
||||||
|
@ -70,7 +71,7 @@ func TestDeleteAllChildren(t *testing.T) {
|
||||||
db := newDB(t)
|
db := newDB(t)
|
||||||
defer releaseDB(db)
|
defer releaseDB(db)
|
||||||
|
|
||||||
cid := testCID()
|
cid := cidtest.Generate()
|
||||||
|
|
||||||
// generate parent object
|
// generate parent object
|
||||||
parent := generateRawObjectWithCID(t, cid)
|
parent := generateRawObjectWithCID(t, cid)
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
|
||||||
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
||||||
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
|
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
@ -55,7 +56,7 @@ func TestDB_Exists(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("virtual object", func(t *testing.T) {
|
t.Run("virtual object", func(t *testing.T) {
|
||||||
cid := testCID()
|
cid := cidtest.Generate()
|
||||||
parent := generateRawObjectWithCID(t, cid)
|
parent := generateRawObjectWithCID(t, cid)
|
||||||
|
|
||||||
child := generateRawObjectWithCID(t, cid)
|
child := generateRawObjectWithCID(t, cid)
|
||||||
|
@ -72,7 +73,7 @@ func TestDB_Exists(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("merge split info", func(t *testing.T) {
|
t.Run("merge split info", func(t *testing.T) {
|
||||||
cid := testCID()
|
cid := cidtest.Generate()
|
||||||
splitID := objectSDK.NewSplitID()
|
splitID := objectSDK.NewSplitID()
|
||||||
|
|
||||||
parent := generateRawObjectWithCID(t, cid)
|
parent := generateRawObjectWithCID(t, cid)
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
|
||||||
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
||||||
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
|
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
|
||||||
|
@ -59,7 +60,7 @@ func TestDB_Get(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("put virtual object", func(t *testing.T) {
|
t.Run("put virtual object", func(t *testing.T) {
|
||||||
cid := testCID()
|
cid := cidtest.Generate()
|
||||||
splitID := objectSDK.NewSplitID()
|
splitID := objectSDK.NewSplitID()
|
||||||
|
|
||||||
parent := generateRawObjectWithCID(t, cid)
|
parent := generateRawObjectWithCID(t, cid)
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-api-go/pkg"
|
"github.com/nspcc-dev/neofs-api-go/pkg"
|
||||||
|
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
|
||||||
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
||||||
v2object "github.com/nspcc-dev/neofs-api-go/v2/object"
|
v2object "github.com/nspcc-dev/neofs-api-go/v2/object"
|
||||||
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
|
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
|
||||||
|
@ -15,7 +16,7 @@ func TestDB_SelectUserAttributes(t *testing.T) {
|
||||||
db := newDB(t)
|
db := newDB(t)
|
||||||
defer releaseDB(db)
|
defer releaseDB(db)
|
||||||
|
|
||||||
cid := testCID()
|
cid := cidtest.Generate()
|
||||||
|
|
||||||
raw1 := generateRawObjectWithCID(t, cid)
|
raw1 := generateRawObjectWithCID(t, cid)
|
||||||
addAttribute(raw1, "foo", "bar")
|
addAttribute(raw1, "foo", "bar")
|
||||||
|
@ -88,7 +89,7 @@ func TestDB_SelectRootPhyParent(t *testing.T) {
|
||||||
db := newDB(t)
|
db := newDB(t)
|
||||||
defer releaseDB(db)
|
defer releaseDB(db)
|
||||||
|
|
||||||
cid := testCID()
|
cid := cidtest.Generate()
|
||||||
|
|
||||||
// prepare
|
// prepare
|
||||||
|
|
||||||
|
@ -256,7 +257,7 @@ func TestDB_SelectInhume(t *testing.T) {
|
||||||
db := newDB(t)
|
db := newDB(t)
|
||||||
defer releaseDB(db)
|
defer releaseDB(db)
|
||||||
|
|
||||||
cid := testCID()
|
cid := cidtest.Generate()
|
||||||
|
|
||||||
raw1 := generateRawObjectWithCID(t, cid)
|
raw1 := generateRawObjectWithCID(t, cid)
|
||||||
err := putBig(db, raw1.Object())
|
err := putBig(db, raw1.Object())
|
||||||
|
@ -289,7 +290,7 @@ func TestDB_SelectPayloadHash(t *testing.T) {
|
||||||
db := newDB(t)
|
db := newDB(t)
|
||||||
defer releaseDB(db)
|
defer releaseDB(db)
|
||||||
|
|
||||||
cid := testCID()
|
cid := cidtest.Generate()
|
||||||
|
|
||||||
raw1 := generateRawObjectWithCID(t, cid)
|
raw1 := generateRawObjectWithCID(t, cid)
|
||||||
err := putBig(db, raw1.Object())
|
err := putBig(db, raw1.Object())
|
||||||
|
@ -325,7 +326,7 @@ func TestDB_SelectWithSlowFilters(t *testing.T) {
|
||||||
db := newDB(t)
|
db := newDB(t)
|
||||||
defer releaseDB(db)
|
defer releaseDB(db)
|
||||||
|
|
||||||
cid := testCID()
|
cid := cidtest.Generate()
|
||||||
|
|
||||||
v20 := new(pkg.Version)
|
v20 := new(pkg.Version)
|
||||||
v20.SetMajor(2)
|
v20.SetMajor(2)
|
||||||
|
@ -424,7 +425,7 @@ func TestDB_SelectObjectID(t *testing.T) {
|
||||||
db := newDB(t)
|
db := newDB(t)
|
||||||
defer releaseDB(db)
|
defer releaseDB(db)
|
||||||
|
|
||||||
cid := testCID()
|
cid := cidtest.Generate()
|
||||||
|
|
||||||
// prepare
|
// prepare
|
||||||
|
|
||||||
|
@ -533,7 +534,7 @@ func TestDB_SelectSplitID(t *testing.T) {
|
||||||
db := newDB(t)
|
db := newDB(t)
|
||||||
defer releaseDB(db)
|
defer releaseDB(db)
|
||||||
|
|
||||||
cid := testCID()
|
cid := cidtest.Generate()
|
||||||
|
|
||||||
child1 := generateRawObjectWithCID(t, cid)
|
child1 := generateRawObjectWithCID(t, cid)
|
||||||
child2 := generateRawObjectWithCID(t, cid)
|
child2 := generateRawObjectWithCID(t, cid)
|
||||||
|
@ -588,7 +589,7 @@ func TestDB_SelectContainerID(t *testing.T) {
|
||||||
db := newDB(t)
|
db := newDB(t)
|
||||||
defer releaseDB(db)
|
defer releaseDB(db)
|
||||||
|
|
||||||
cid := testCID()
|
cid := cidtest.Generate()
|
||||||
|
|
||||||
obj1 := generateRawObjectWithCID(t, cid)
|
obj1 := generateRawObjectWithCID(t, cid)
|
||||||
err := putBig(db, obj1.Object())
|
err := putBig(db, obj1.Object())
|
||||||
|
@ -622,7 +623,7 @@ func TestDB_SelectContainerID(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("not same cid", func(t *testing.T) {
|
t.Run("not same cid", func(t *testing.T) {
|
||||||
newCID := testCID()
|
newCID := cidtest.Generate()
|
||||||
|
|
||||||
fs := objectSDK.SearchFilters{}
|
fs := objectSDK.SearchFilters{}
|
||||||
fs.AddObjectContainerIDFilter(objectSDK.MatchStringEqual, newCID)
|
fs.AddObjectContainerIDFilter(objectSDK.MatchStringEqual, newCID)
|
||||||
|
|
|
@ -3,6 +3,7 @@ package shard_test
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
|
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
@ -22,7 +23,7 @@ func testShardDelete(t *testing.T, hasWriteCache bool) {
|
||||||
sh := newShard(t, hasWriteCache)
|
sh := newShard(t, hasWriteCache)
|
||||||
defer releaseShard(sh, t)
|
defer releaseShard(sh, t)
|
||||||
|
|
||||||
cid := generateCID()
|
cid := cidtest.Generate()
|
||||||
|
|
||||||
obj := generateRawObjectWithCID(t, cid)
|
obj := generateRawObjectWithCID(t, cid)
|
||||||
addAttribute(obj, "foo", "bar")
|
addAttribute(obj, "foo", "bar")
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
|
||||||
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
|
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
|
||||||
|
@ -67,7 +68,7 @@ func testShardGet(t *testing.T, hasWriteCache bool) {
|
||||||
t.Run("parent object", func(t *testing.T) {
|
t.Run("parent object", func(t *testing.T) {
|
||||||
obj := generateRawObject(t)
|
obj := generateRawObject(t)
|
||||||
addAttribute(obj, "foo", "bar")
|
addAttribute(obj, "foo", "bar")
|
||||||
cid := generateCID()
|
cid := cidtest.Generate()
|
||||||
splitID := objectSDK.NewSplitID()
|
splitID := objectSDK.NewSplitID()
|
||||||
|
|
||||||
parent := generateRawObjectWithCID(t, cid)
|
parent := generateRawObjectWithCID(t, cid)
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
|
||||||
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
|
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
|
||||||
|
@ -45,7 +46,7 @@ func testShardHead(t *testing.T, hasWriteCache bool) {
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("virtual object", func(t *testing.T) {
|
t.Run("virtual object", func(t *testing.T) {
|
||||||
cid := generateCID()
|
cid := cidtest.Generate()
|
||||||
splitID := objectSDK.NewSplitID()
|
splitID := objectSDK.NewSplitID()
|
||||||
|
|
||||||
parent := generateRawObjectWithCID(t, cid)
|
parent := generateRawObjectWithCID(t, cid)
|
||||||
|
|
|
@ -3,6 +3,7 @@ package shard_test
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
|
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
@ -22,7 +23,7 @@ func testShardInhume(t *testing.T, hasWriteCache bool) {
|
||||||
sh := newShard(t, hasWriteCache)
|
sh := newShard(t, hasWriteCache)
|
||||||
defer releaseShard(sh, t)
|
defer releaseShard(sh, t)
|
||||||
|
|
||||||
cid := generateCID()
|
cid := cidtest.Generate()
|
||||||
|
|
||||||
obj := generateRawObjectWithCID(t, cid)
|
obj := generateRawObjectWithCID(t, cid)
|
||||||
addAttribute(obj, "foo", "bar")
|
addAttribute(obj, "foo", "bar")
|
||||||
|
|
|
@ -3,6 +3,7 @@ package shard_test
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
|
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
@ -33,7 +34,7 @@ func testShardList(t *testing.T, sh *shard.Shard) {
|
||||||
putPrm := new(shard.PutPrm)
|
putPrm := new(shard.PutPrm)
|
||||||
|
|
||||||
for i := 0; i < C; i++ {
|
for i := 0; i < C; i++ {
|
||||||
cid := generateCID()
|
cid := cidtest.Generate()
|
||||||
|
|
||||||
for j := 0; j < N; j++ {
|
for j := 0; j < N; j++ {
|
||||||
obj := generateRawObjectWithCID(t, cid)
|
obj := generateRawObjectWithCID(t, cid)
|
||||||
|
|
|
@ -9,6 +9,7 @@ import (
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-api-go/pkg"
|
"github.com/nspcc-dev/neofs-api-go/pkg"
|
||||||
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
|
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
|
||||||
|
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
|
||||||
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
||||||
"github.com/nspcc-dev/neofs-api-go/pkg/owner"
|
"github.com/nspcc-dev/neofs-api-go/pkg/owner"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
||||||
|
@ -61,7 +62,7 @@ func releaseShard(s *shard.Shard, t testing.TB) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateRawObject(t *testing.T) *object.RawObject {
|
func generateRawObject(t *testing.T) *object.RawObject {
|
||||||
return generateRawObjectWithCID(t, generateCID())
|
return generateRawObjectWithCID(t, cidtest.Generate())
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateRawObjectWithCID(t *testing.T, cid *cid.ID) *object.RawObject {
|
func generateRawObjectWithCID(t *testing.T, cid *cid.ID) *object.RawObject {
|
||||||
|
@ -110,16 +111,6 @@ func addPayload(obj *object.RawObject, size int) {
|
||||||
obj.SetPayloadSize(uint64(size))
|
obj.SetPayloadSize(uint64(size))
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateCID() *cid.ID {
|
|
||||||
cs := [sha256.Size]byte{}
|
|
||||||
_, _ = rand.Read(cs[:])
|
|
||||||
|
|
||||||
id := cid.New()
|
|
||||||
id.SetSHA256(cs)
|
|
||||||
|
|
||||||
return id
|
|
||||||
}
|
|
||||||
|
|
||||||
func generateOID() *objectSDK.ID {
|
func generateOID() *objectSDK.ID {
|
||||||
cs := [sha256.Size]byte{}
|
cs := [sha256.Size]byte{}
|
||||||
_, _ = rand.Read(cs[:])
|
_, _ = rand.Read(cs[:])
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
package audit_test
|
package audit_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/sha256"
|
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||||
auditAPI "github.com/nspcc-dev/neofs-api-go/pkg/audit"
|
auditAPI "github.com/nspcc-dev/neofs-api-go/pkg/audit"
|
||||||
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
|
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
|
||||||
crypto "github.com/nspcc-dev/neofs-crypto"
|
crypto "github.com/nspcc-dev/neofs-crypto"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
||||||
auditWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/audit/wrapper"
|
auditWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/audit/wrapper"
|
||||||
|
@ -36,8 +35,7 @@ func TestAuditResults(t *testing.T) {
|
||||||
auditClientWrapper, err := auditWrapper.NewFromMorph(morphClient, auditHash, 0)
|
auditClientWrapper, err := auditWrapper.NewFromMorph(morphClient, auditHash, 0)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
id := cid.New()
|
id := cidtest.Generate()
|
||||||
id.SetSHA256([sha256.Size]byte{1, 2, 3})
|
|
||||||
|
|
||||||
auditRes := auditAPI.NewResult()
|
auditRes := auditAPI.NewResult()
|
||||||
auditRes.SetAuditEpoch(epoch)
|
auditRes.SetAuditEpoch(epoch)
|
||||||
|
|
|
@ -2,13 +2,12 @@ package loadcontroller_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"crypto/sha256"
|
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"sync"
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-api-go/pkg/container"
|
"github.com/nspcc-dev/neofs-api-go/pkg/container"
|
||||||
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
|
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
|
||||||
loadcontroller "github.com/nspcc-dev/neofs-node/pkg/services/container/announcement/load/controller"
|
loadcontroller "github.com/nspcc-dev/neofs-node/pkg/services/container/announcement/load/controller"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
@ -74,20 +73,9 @@ func (s *testAnnouncementStorage) Close() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func randCID() *cid.ID {
|
|
||||||
h := [sha256.Size]byte{}
|
|
||||||
|
|
||||||
rand.Read(h[:])
|
|
||||||
|
|
||||||
id := cid.New()
|
|
||||||
id.SetSHA256(h)
|
|
||||||
|
|
||||||
return id
|
|
||||||
}
|
|
||||||
|
|
||||||
func randAnnouncement() container.UsedSpaceAnnouncement {
|
func randAnnouncement() container.UsedSpaceAnnouncement {
|
||||||
a := container.NewAnnouncement()
|
a := container.NewAnnouncement()
|
||||||
a.SetContainerID(randCID())
|
a.SetContainerID(cidtest.Generate())
|
||||||
a.SetUsedSpace(rand.Uint64())
|
a.SetUsedSpace(rand.Uint64())
|
||||||
|
|
||||||
return *a
|
return *a
|
||||||
|
|
|
@ -1,31 +1,19 @@
|
||||||
package loadstorage
|
package loadstorage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/sha256"
|
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-api-go/pkg/container"
|
"github.com/nspcc-dev/neofs-api-go/pkg/container"
|
||||||
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
|
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func randCID() *cid.ID {
|
|
||||||
h := [sha256.Size]byte{}
|
|
||||||
|
|
||||||
rand.Read(h[:])
|
|
||||||
|
|
||||||
id := cid.New()
|
|
||||||
id.SetSHA256(h)
|
|
||||||
|
|
||||||
return id
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestStorage(t *testing.T) {
|
func TestStorage(t *testing.T) {
|
||||||
const epoch uint64 = 13
|
const epoch uint64 = 13
|
||||||
|
|
||||||
a := container.NewAnnouncement()
|
a := container.NewAnnouncement()
|
||||||
a.SetContainerID(randCID())
|
a.SetContainerID(cidtest.Generate())
|
||||||
a.SetEpoch(epoch)
|
a.SetEpoch(epoch)
|
||||||
|
|
||||||
const opinionsNum = 100
|
const opinionsNum = 100
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl"
|
"github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl"
|
||||||
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
|
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
|
||||||
|
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
|
||||||
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
||||||
objectV2 "github.com/nspcc-dev/neofs-api-go/v2/object"
|
objectV2 "github.com/nspcc-dev/neofs-api-go/v2/object"
|
||||||
"github.com/nspcc-dev/neofs-api-go/v2/session"
|
"github.com/nspcc-dev/neofs-api-go/v2/session"
|
||||||
|
@ -57,22 +58,10 @@ func testID(t *testing.T) *objectSDK.ID {
|
||||||
return id
|
return id
|
||||||
}
|
}
|
||||||
|
|
||||||
func testCID(t *testing.T) *cid.ID {
|
|
||||||
cs := [sha256.Size]byte{}
|
|
||||||
|
|
||||||
_, err := rand.Read(cs[:])
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
id := cid.New()
|
|
||||||
id.SetSHA256(cs)
|
|
||||||
|
|
||||||
return id
|
|
||||||
}
|
|
||||||
|
|
||||||
func testAddress(t *testing.T) *objectSDK.Address {
|
func testAddress(t *testing.T) *objectSDK.Address {
|
||||||
addr := objectSDK.NewAddress()
|
addr := objectSDK.NewAddress()
|
||||||
addr.SetObjectID(testID(t))
|
addr.SetObjectID(testID(t))
|
||||||
addr.SetContainerID(testCID(t))
|
addr.SetContainerID(cidtest.Generate())
|
||||||
|
|
||||||
return addr
|
return addr
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import (
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-api-go/pkg/container"
|
"github.com/nspcc-dev/neofs-api-go/pkg/container"
|
||||||
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
|
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
|
||||||
|
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
|
||||||
"github.com/nspcc-dev/neofs-api-go/pkg/netmap"
|
"github.com/nspcc-dev/neofs-api-go/pkg/netmap"
|
||||||
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
||||||
|
@ -192,10 +193,7 @@ func generateAddress() *objectSDK.Address {
|
||||||
addr := objectSDK.NewAddress()
|
addr := objectSDK.NewAddress()
|
||||||
addr.SetObjectID(generateID())
|
addr.SetObjectID(generateID())
|
||||||
|
|
||||||
id := cid.New()
|
addr.SetContainerID(cidtest.Generate())
|
||||||
id.SetSHA256(testSHA256())
|
|
||||||
|
|
||||||
addr.SetContainerID(id)
|
|
||||||
|
|
||||||
return addr
|
return addr
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import (
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-api-go/pkg/container"
|
"github.com/nspcc-dev/neofs-api-go/pkg/container"
|
||||||
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
|
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
|
||||||
|
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
|
||||||
"github.com/nspcc-dev/neofs-api-go/pkg/netmap"
|
"github.com/nspcc-dev/neofs-api-go/pkg/netmap"
|
||||||
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/network"
|
"github.com/nspcc-dev/neofs-node/pkg/network"
|
||||||
|
@ -127,13 +128,6 @@ func testSHA256() (cs [sha256.Size]byte) {
|
||||||
return cs
|
return cs
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateCID() *cid.ID {
|
|
||||||
id := cid.New()
|
|
||||||
id.SetSHA256(testSHA256())
|
|
||||||
|
|
||||||
return id
|
|
||||||
}
|
|
||||||
|
|
||||||
func generateIDs(num int) []*objectSDK.ID {
|
func generateIDs(num int) []*objectSDK.ID {
|
||||||
res := make([]*objectSDK.ID, num)
|
res := make([]*objectSDK.ID, num)
|
||||||
|
|
||||||
|
@ -169,7 +163,7 @@ func TestGetLocalOnly(t *testing.T) {
|
||||||
storage := newTestStorage()
|
storage := newTestStorage()
|
||||||
svc := newSvc(storage)
|
svc := newSvc(storage)
|
||||||
|
|
||||||
cid := generateCID()
|
cid := cidtest.Generate()
|
||||||
ids := generateIDs(10)
|
ids := generateIDs(10)
|
||||||
storage.addResult(cid, ids, nil)
|
storage.addResult(cid, ids, nil)
|
||||||
|
|
||||||
|
@ -185,7 +179,7 @@ func TestGetLocalOnly(t *testing.T) {
|
||||||
storage := newTestStorage()
|
storage := newTestStorage()
|
||||||
svc := newSvc(storage)
|
svc := newSvc(storage)
|
||||||
|
|
||||||
cid := generateCID()
|
cid := cidtest.Generate()
|
||||||
testErr := errors.New("any error")
|
testErr := errors.New("any error")
|
||||||
storage.addResult(cid, nil, testErr)
|
storage.addResult(cid, nil, testErr)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue