forked from TrueCloudLab/frostfs-node
[#668] shard/test: Move tests to the main package
Semantic patch (also, duplicate definitions are removed): ``` @@ var e identifier @@ -import "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard" -shard.e +e ``` Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
aa23c6a83a
commit
bdecfbc1be
12 changed files with 79 additions and 99 deletions
|
@ -1,4 +1,4 @@
|
|||
package shard_test
|
||||
package shard
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
@ -11,7 +11,6 @@ import (
|
|||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/fstree"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/testutil"
|
||||
meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client"
|
||||
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
|
||||
|
@ -26,13 +25,13 @@ import (
|
|||
func TestShard_Lock(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var sh *shard.Shard
|
||||
var sh *Shard
|
||||
|
||||
rootPath := t.TempDir()
|
||||
opts := []shard.Option{
|
||||
shard.WithID(shard.NewIDFromBytes([]byte{})),
|
||||
shard.WithLogger(&logger.Logger{Logger: zap.NewNop()}),
|
||||
shard.WithBlobStorOptions(
|
||||
opts := []Option{
|
||||
WithID(NewIDFromBytes([]byte{})),
|
||||
WithLogger(&logger.Logger{Logger: zap.NewNop()}),
|
||||
WithBlobStorOptions(
|
||||
blobstor.WithStorages([]blobstor.SubStorage{
|
||||
{
|
||||
Storage: blobovniczatree.NewBlobovniczaTree(
|
||||
|
@ -49,16 +48,16 @@ func TestShard_Lock(t *testing.T) {
|
|||
},
|
||||
}),
|
||||
),
|
||||
shard.WithMetaBaseOptions(
|
||||
WithMetaBaseOptions(
|
||||
meta.WithPath(filepath.Join(rootPath, "meta")),
|
||||
meta.WithEpochState(epochState{}),
|
||||
),
|
||||
shard.WithDeletedLockCallback(func(_ context.Context, addresses []oid.Address) {
|
||||
WithDeletedLockCallback(func(_ context.Context, addresses []oid.Address) {
|
||||
sh.HandleDeletedLocks(addresses)
|
||||
}),
|
||||
}
|
||||
|
||||
sh = shard.New(opts...)
|
||||
sh = New(opts...)
|
||||
require.NoError(t, sh.Open())
|
||||
require.NoError(t, sh.Init(context.Background()))
|
||||
|
||||
|
@ -76,7 +75,7 @@ func TestShard_Lock(t *testing.T) {
|
|||
|
||||
// put the object
|
||||
|
||||
var putPrm shard.PutPrm
|
||||
var putPrm PutPrm
|
||||
putPrm.SetObject(obj)
|
||||
|
||||
_, err := sh.Put(context.Background(), putPrm)
|
||||
|
@ -94,7 +93,7 @@ func TestShard_Lock(t *testing.T) {
|
|||
t.Run("inhuming locked objects", func(t *testing.T) {
|
||||
ts := testutil.GenerateObjectWithCID(cnr)
|
||||
|
||||
var inhumePrm shard.InhumePrm
|
||||
var inhumePrm InhumePrm
|
||||
inhumePrm.SetTarget(objectcore.AddressOf(ts), objectcore.AddressOf(obj))
|
||||
|
||||
var objLockedErr *apistatus.ObjectLocked
|
||||
|
@ -110,7 +109,7 @@ func TestShard_Lock(t *testing.T) {
|
|||
t.Run("inhuming lock objects", func(t *testing.T) {
|
||||
ts := testutil.GenerateObjectWithCID(cnr)
|
||||
|
||||
var inhumePrm shard.InhumePrm
|
||||
var inhumePrm InhumePrm
|
||||
inhumePrm.SetTarget(objectcore.AddressOf(ts), objectcore.AddressOf(lock))
|
||||
|
||||
_, err = sh.Inhume(context.Background(), inhumePrm)
|
||||
|
@ -122,7 +121,7 @@ func TestShard_Lock(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("force objects inhuming", func(t *testing.T) {
|
||||
var inhumePrm shard.InhumePrm
|
||||
var inhumePrm InhumePrm
|
||||
inhumePrm.MarkAsGarbage(objectcore.AddressOf(lock))
|
||||
inhumePrm.ForceRemoval()
|
||||
|
||||
|
@ -132,7 +131,7 @@ func TestShard_Lock(t *testing.T) {
|
|||
// it should be possible to remove
|
||||
// lock object now
|
||||
|
||||
inhumePrm = shard.InhumePrm{}
|
||||
inhumePrm = InhumePrm{}
|
||||
inhumePrm.MarkAsGarbage(objectcore.AddressOf(obj))
|
||||
|
||||
_, err = sh.Inhume(context.Background(), inhumePrm)
|
||||
|
@ -140,7 +139,7 @@ func TestShard_Lock(t *testing.T) {
|
|||
|
||||
// check that object has been removed
|
||||
|
||||
var getPrm shard.GetPrm
|
||||
var getPrm GetPrm
|
||||
getPrm.SetAddress(objectcore.AddressOf(obj))
|
||||
|
||||
_, err = sh.Get(context.Background(), getPrm)
|
||||
|
@ -160,7 +159,7 @@ func TestShard_IsLocked(t *testing.T) {
|
|||
|
||||
// put the object
|
||||
|
||||
var putPrm shard.PutPrm
|
||||
var putPrm PutPrm
|
||||
putPrm.SetObject(obj)
|
||||
|
||||
_, err := sh.Put(context.Background(), putPrm)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue