2022-08-22 14:16:35 +00:00
|
|
|
package fstree
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
"strconv"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/common"
|
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/internal/blobstortest"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestGeneric(t *testing.T) {
|
|
|
|
defer func() { _ = os.RemoveAll(t.Name()) }()
|
|
|
|
|
2022-10-05 12:18:01 +00:00
|
|
|
helper := func(t *testing.T, dir string) common.Storage {
|
2022-08-22 14:16:35 +00:00
|
|
|
return New(
|
|
|
|
WithPath(dir),
|
|
|
|
WithDepth(2),
|
|
|
|
WithDirNameLen(2))
|
|
|
|
}
|
|
|
|
|
2022-10-05 12:18:01 +00:00
|
|
|
var n int
|
|
|
|
newTree := func(t *testing.T) common.Storage {
|
|
|
|
dir := filepath.Join(t.Name(), strconv.Itoa(n))
|
|
|
|
return helper(t, dir)
|
|
|
|
}
|
|
|
|
|
2022-08-22 14:16:35 +00:00
|
|
|
blobstortest.TestAll(t, newTree, 2048, 16*1024)
|
2022-10-05 12:18:01 +00:00
|
|
|
|
|
|
|
t.Run("info", func(t *testing.T) {
|
|
|
|
dir := filepath.Join(t.Name(), "info")
|
|
|
|
blobstortest.TestInfo(t, func(t *testing.T) common.Storage {
|
|
|
|
return helper(t, dir)
|
|
|
|
}, Type, dir)
|
|
|
|
})
|
2022-08-22 14:16:35 +00:00
|
|
|
}
|
2022-08-23 13:04:01 +00:00
|
|
|
|
|
|
|
func TestControl(t *testing.T) {
|
|
|
|
defer func() { _ = os.RemoveAll(t.Name()) }()
|
|
|
|
|
|
|
|
var n int
|
|
|
|
newTree := func(t *testing.T) common.Storage {
|
|
|
|
dir := filepath.Join(t.Name(), strconv.Itoa(n))
|
|
|
|
return New(
|
|
|
|
WithPath(dir),
|
|
|
|
WithDepth(2),
|
|
|
|
WithDirNameLen(2))
|
|
|
|
}
|
|
|
|
|
|
|
|
blobstortest.TestControl(t, newTree, 2048, 2048)
|
|
|
|
}
|