[#559] Remove manual path handling in fstree tests
Some checks failed
Build / Build Components (1.19) (pull_request) Successful in 2m8s
Build / Build Components (1.20) (pull_request) Successful in 1m54s
Tests and linters / Lint (pull_request) Successful in 2m48s
Tests and linters / Tests (1.19) (pull_request) Successful in 1m53s
Tests and linters / Tests (1.20) (pull_request) Successful in 2m4s
Tests and linters / Tests with -race (pull_request) Successful in 5m21s
Tests and linters / Staticcheck (pull_request) Successful in 2m16s
Vulncheck / Vulncheck (pull_request) Failing after 16m3s

Signed-off-by: Alejandro Lopez <a.lopez@yadro.com>
This commit is contained in:
Alejandro Lopez 2023-08-03 10:00:49 +03:00
parent 1e8b4b8a17
commit 65c72f3e0b

View file

@ -1,9 +1,6 @@
package fstree
import (
"os"
"path/filepath"
"strconv"
"testing"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/common"
@ -11,39 +8,31 @@ import (
)
func TestGeneric(t *testing.T) {
defer func() { _ = os.RemoveAll(t.Name()) }()
helper := func(t *testing.T, dir string) common.Storage {
newTreeFromPath := func(path string) common.Storage {
return New(
WithPath(dir),
WithPath(path),
WithDepth(2),
WithDirNameLen(2))
}
var n int
newTree := func(t *testing.T) common.Storage {
dir := filepath.Join(t.Name(), strconv.Itoa(n))
return helper(t, dir)
return newTreeFromPath(t.TempDir())
}
blobstortest.TestAll(t, newTree, 2048, 16*1024)
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)
path := t.TempDir()
blobstortest.TestInfo(t, func(*testing.T) common.Storage {
return newTreeFromPath(path)
}, Type, path)
})
}
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),
WithPath(t.TempDir()),
WithDepth(2),
WithDirNameLen(2))
}