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"
|
||||
|
@ -12,7 +12,6 @@ import (
|
|||
"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/pilorama"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard/mode"
|
||||
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
||||
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
|
||||
|
@ -126,9 +125,6 @@ func (m *metricsStore) DeleteShardMetrics() {
|
|||
m.errCounter = 0
|
||||
}
|
||||
|
||||
const physical = "phy"
|
||||
const logical = "logic"
|
||||
|
||||
func TestCounters(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -163,7 +159,7 @@ func TestCounters(t *testing.T) {
|
|||
totalPayload += oSize
|
||||
}
|
||||
|
||||
var prm shard.PutPrm
|
||||
var prm PutPrm
|
||||
|
||||
for i := 0; i < objNumber; i++ {
|
||||
prm.SetObject(oo[i])
|
||||
|
@ -178,7 +174,7 @@ func TestCounters(t *testing.T) {
|
|||
require.Equal(t, totalPayload, mm.payloadSize())
|
||||
|
||||
t.Run("inhume_GC", func(t *testing.T) {
|
||||
var prm shard.InhumePrm
|
||||
var prm InhumePrm
|
||||
inhumedNumber := objNumber / 4
|
||||
|
||||
for i := 0; i < inhumedNumber; i++ {
|
||||
|
@ -197,7 +193,7 @@ func TestCounters(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("inhume_TS", func(t *testing.T) {
|
||||
var prm shard.InhumePrm
|
||||
var prm InhumePrm
|
||||
ts := objectcore.AddressOf(testutil.GenerateObject())
|
||||
|
||||
phy := mm.getObjectCounter(physical)
|
||||
|
@ -218,7 +214,7 @@ func TestCounters(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("Delete", func(t *testing.T) {
|
||||
var prm shard.DeletePrm
|
||||
var prm DeletePrm
|
||||
|
||||
phy := mm.getObjectCounter(physical)
|
||||
logic := mm.getObjectCounter(logical)
|
||||
|
@ -244,7 +240,7 @@ func TestCounters(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func shardWithMetrics(t *testing.T, path string) (*shard.Shard, *metricsStore) {
|
||||
func shardWithMetrics(t *testing.T, path string) (*Shard, *metricsStore) {
|
||||
blobOpts := []blobstor.Option{
|
||||
blobstor.WithStorages([]blobstor.SubStorage{
|
||||
{
|
||||
|
@ -264,14 +260,14 @@ func shardWithMetrics(t *testing.T, path string) (*shard.Shard, *metricsStore) {
|
|||
cnrSize: make(map[string]int64),
|
||||
}
|
||||
|
||||
sh := shard.New(
|
||||
shard.WithID(shard.NewIDFromBytes([]byte{})),
|
||||
shard.WithBlobStorOptions(blobOpts...),
|
||||
shard.WithPiloramaOptions(pilorama.WithPath(filepath.Join(path, "pilorama"))),
|
||||
shard.WithMetaBaseOptions(
|
||||
sh := New(
|
||||
WithID(NewIDFromBytes([]byte{})),
|
||||
WithBlobStorOptions(blobOpts...),
|
||||
WithPiloramaOptions(pilorama.WithPath(filepath.Join(path, "pilorama"))),
|
||||
WithMetaBaseOptions(
|
||||
meta.WithPath(filepath.Join(path, "meta")),
|
||||
meta.WithEpochState(epochState{})),
|
||||
shard.WithMetricsWriter(mm),
|
||||
WithMetricsWriter(mm),
|
||||
)
|
||||
require.NoError(t, sh.Open())
|
||||
require.NoError(t, sh.Init(context.Background()))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue