-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
blobovnicza: Fix write error at zero depth
Previously, blobovnicza tree with depth=0 (i.e. group of DBs without subdirectories) failed to write any object. There was a mistake in code which worked incorrectly for depth=0 particular case. Fix `iterateDeepest` method iterating over paths to DBs as if they were directories. From now it passes current directory only. Signed-off-by: Leonard Lyubich <[email protected]>
- Loading branch information
1 parent
f751d71
commit be4bbfb
Showing
2 changed files
with
44 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
pkg/local_object_storage/blobstor/blobovniczatree/put_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package blobovniczatree_test | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/blobovniczatree" | ||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/common" | ||
oidtest "github.com/nspcc-dev/neofs-sdk-go/object/id/test" | ||
objecttest "github.com/nspcc-dev/neofs-sdk-go/object/test" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestSingleDir(t *testing.T) { | ||
tree := NewBlobovniczaTree( | ||
WithRootPath(t.TempDir()), | ||
WithBlobovniczaShallowDepth(0), | ||
WithBlobovniczaShallowWidth(10), | ||
) | ||
|
||
require.NoError(t, tree.Open(false)) | ||
defer func() { _ = tree.Close() }() | ||
require.NoError(t, tree.Init()) | ||
|
||
bObj, err := objecttest.Object(t).Marshal() | ||
require.NoError(t, err) | ||
|
||
putPrm := common.PutPrm{ | ||
Address: oidtest.Address(), | ||
RawData: bObj, | ||
} | ||
|
||
_, err = tree.Put(putPrm) | ||
require.NoError(t, err) | ||
|
||
_, err = tree.Get(common.GetPrm{ | ||
Address: putPrm.Address, | ||
}) | ||
require.NoError(t, err) | ||
} |