[#948] engine: Fix test file path

Before: `<t.Name()>.<id>.blobstor`
After:  `<t.Name()>/<id>.blobstor`
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-10-27 17:50:58 +03:00 committed by Alex Vanin
parent 1950724a04
commit 5b6be7bc1c
3 changed files with 10 additions and 4 deletions

View file

@ -2,6 +2,7 @@ package engine
import ( import (
"errors" "errors"
"os"
"testing" "testing"
cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test" cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test"
@ -10,7 +11,10 @@ import (
func TestExecBlocks(t *testing.T) { func TestExecBlocks(t *testing.T) {
e := testNewEngineWithShardNum(t, 2) // number doesn't matter in this test, 2 is several but not many e := testNewEngineWithShardNum(t, 2) // number doesn't matter in this test, 2 is several but not many
defer e.Close() t.Cleanup(func() {
e.Close()
os.RemoveAll(t.Name())
})
// put some object // put some object
obj := generateRawObjectWithCID(t, cidtest.GenerateID()).Object() obj := generateRawObjectWithCID(t, cidtest.GenerateID()).Object()

View file

@ -4,6 +4,7 @@ import (
"crypto/sha256" "crypto/sha256"
"fmt" "fmt"
"math/rand" "math/rand"
"path"
"sync" "sync"
"testing" "testing"
@ -56,13 +57,13 @@ func testNewShard(t *testing.T, id int) *shard.Shard {
shard.WithID(sid), shard.WithID(sid),
shard.WithLogger(zap.L()), shard.WithLogger(zap.L()),
shard.WithBlobStorOptions( shard.WithBlobStorOptions(
blobstor.WithRootPath(fmt.Sprintf("%s.%d.blobstor", t.Name(), id)), blobstor.WithRootPath(path.Join(t.Name(), fmt.Sprintf("%d.blobstor", id))),
blobstor.WithBlobovniczaShallowWidth(2), blobstor.WithBlobovniczaShallowWidth(2),
blobstor.WithBlobovniczaShallowDepth(2), blobstor.WithBlobovniczaShallowDepth(2),
blobstor.WithRootPerm(0700), blobstor.WithRootPerm(0700),
), ),
shard.WithMetaBaseOptions( shard.WithMetaBaseOptions(
meta.WithPath(fmt.Sprintf("%s.%d.metabase", t.Name(), id)), meta.WithPath(path.Join(t.Name(), fmt.Sprintf("%d.metabase", id))),
meta.WithPermissions(0700), meta.WithPermissions(0700),
)) ))

View file

@ -5,6 +5,7 @@ import (
"math/rand" "math/rand"
"os" "os"
"path" "path"
"strings"
"testing" "testing"
"github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/core/object"
@ -60,7 +61,7 @@ func newShard(t testing.TB, enableWriteCache bool) *shard.Shard {
func releaseShard(s *shard.Shard, t testing.TB) { func releaseShard(s *shard.Shard, t testing.TB) {
s.Close() s.Close()
os.RemoveAll(t.Name()) os.RemoveAll(strings.Split(t.Name(), string(os.PathSeparator))[0])
} }
func generateRawObject(t *testing.T) *object.RawObject { func generateRawObject(t *testing.T) *object.RawObject {