forked from TrueCloudLab/frostfs-node
[#559] Remove manual path handling in fstree tests
Signed-off-by: Alejandro Lopez <a.lopez@yadro.com>
This commit is contained in:
parent
1e8b4b8a17
commit
65c72f3e0b
1 changed files with 8 additions and 19 deletions
|
@ -1,9 +1,6 @@
|
||||||
package fstree
|
package fstree
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"strconv"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/common"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/common"
|
||||||
|
@ -11,39 +8,31 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGeneric(t *testing.T) {
|
func TestGeneric(t *testing.T) {
|
||||||
defer func() { _ = os.RemoveAll(t.Name()) }()
|
newTreeFromPath := func(path string) common.Storage {
|
||||||
|
|
||||||
helper := func(t *testing.T, dir string) common.Storage {
|
|
||||||
return New(
|
return New(
|
||||||
WithPath(dir),
|
WithPath(path),
|
||||||
WithDepth(2),
|
WithDepth(2),
|
||||||
WithDirNameLen(2))
|
WithDirNameLen(2))
|
||||||
}
|
}
|
||||||
|
|
||||||
var n int
|
|
||||||
newTree := func(t *testing.T) common.Storage {
|
newTree := func(t *testing.T) common.Storage {
|
||||||
dir := filepath.Join(t.Name(), strconv.Itoa(n))
|
return newTreeFromPath(t.TempDir())
|
||||||
return helper(t, dir)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
blobstortest.TestAll(t, newTree, 2048, 16*1024)
|
blobstortest.TestAll(t, newTree, 2048, 16*1024)
|
||||||
|
|
||||||
t.Run("info", func(t *testing.T) {
|
t.Run("info", func(t *testing.T) {
|
||||||
dir := filepath.Join(t.Name(), "info")
|
path := t.TempDir()
|
||||||
blobstortest.TestInfo(t, func(t *testing.T) common.Storage {
|
blobstortest.TestInfo(t, func(*testing.T) common.Storage {
|
||||||
return helper(t, dir)
|
return newTreeFromPath(path)
|
||||||
}, Type, dir)
|
}, Type, path)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestControl(t *testing.T) {
|
func TestControl(t *testing.T) {
|
||||||
defer func() { _ = os.RemoveAll(t.Name()) }()
|
|
||||||
|
|
||||||
var n int
|
|
||||||
newTree := func(t *testing.T) common.Storage {
|
newTree := func(t *testing.T) common.Storage {
|
||||||
dir := filepath.Join(t.Name(), strconv.Itoa(n))
|
|
||||||
return New(
|
return New(
|
||||||
WithPath(dir),
|
WithPath(t.TempDir()),
|
||||||
WithDepth(2),
|
WithDepth(2),
|
||||||
WithDirNameLen(2))
|
WithDirNameLen(2))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue