diff --git a/pkg/local_object_storage/blobstor/blobovniczatree/generic_test.go b/pkg/local_object_storage/blobstor/blobovniczatree/generic_test.go index b62c85774..5b60270ff 100644 --- a/pkg/local_object_storage/blobstor/blobovniczatree/generic_test.go +++ b/pkg/local_object_storage/blobstor/blobovniczatree/generic_test.go @@ -16,9 +16,7 @@ func TestGeneric(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)) + helper := func(t *testing.T, dir string) common.Storage { return NewBlobovniczaTree( WithLogger(zaptest.NewLogger(t)), WithObjectSizeLimit(maxObjectSize), @@ -28,7 +26,20 @@ func TestGeneric(t *testing.T) { WithBlobovniczaSize(1<<20)) } + var n int + newTree := func(t *testing.T) common.Storage { + dir := filepath.Join(t.Name(), strconv.Itoa(n)) + return helper(t, dir) + } + blobstortest.TestAll(t, newTree, 1024, maxObjectSize) + + 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) + }) } func TestControl(t *testing.T) { diff --git a/pkg/local_object_storage/blobstor/fstree/generic_test.go b/pkg/local_object_storage/blobstor/fstree/generic_test.go index 173611cc4..eae12d289 100644 --- a/pkg/local_object_storage/blobstor/fstree/generic_test.go +++ b/pkg/local_object_storage/blobstor/fstree/generic_test.go @@ -13,16 +13,27 @@ import ( func TestGeneric(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)) + helper := func(t *testing.T, dir string) common.Storage { return New( WithPath(dir), 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) + } + 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) + }) } func TestControl(t *testing.T) { diff --git a/pkg/local_object_storage/blobstor/internal/blobstortest/common.go b/pkg/local_object_storage/blobstor/internal/blobstortest/common.go index 7e858d3b9..0d3a79e8e 100644 --- a/pkg/local_object_storage/blobstor/internal/blobstortest/common.go +++ b/pkg/local_object_storage/blobstor/internal/blobstortest/common.go @@ -43,6 +43,12 @@ func TestAll(t *testing.T, cons Constructor, min, max uint64) { }) } +func TestInfo(t *testing.T, cons Constructor, expectedType string, expectedPath string) { + s := cons(t) + require.Equal(t, expectedType, s.Type()) + require.Equal(t, expectedPath, s.Path()) +} + func prepare(t *testing.T, count int, s common.Storage, min, max uint64) []objectDesc { objects := make([]objectDesc, count)