fix/355-increase-tree-service-client-cache-size #359

Closed
ale64bit wants to merge 156 commits from ale64bit/frostfs-node:fix/355-increase-tree-service-client-cache-size into support/v0.36
6 changed files with 9 additions and 36 deletions
Showing only changes of commit 973af12854 - Show all commits

View file

@ -2,7 +2,6 @@ package blobstor
import ( import (
"context" "context"
"os"
"testing" "testing"
objectCore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object" objectCore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object"
@ -15,13 +14,9 @@ import (
) )
func TestExists(t *testing.T) { func TestExists(t *testing.T) {
dir, err := os.MkdirTemp("", "frostfs*")
require.NoError(t, err)
t.Cleanup(func() { _ = os.RemoveAll(dir) })
const smallSizeLimit = 512 const smallSizeLimit = 512
storages, _, largeFileStorage := defaultTestStorages(dir, smallSizeLimit) storages, _, largeFileStorage := defaultTestStorages(t.TempDir(), smallSizeLimit)
b := New(WithStorages(storages)) b := New(WithStorages(storages))

View file

@ -3,7 +3,6 @@ package blobstor
import ( import (
"context" "context"
"fmt" "fmt"
"os"
"testing" "testing"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/blobovniczatree" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/blobovniczatree"
@ -21,18 +20,13 @@ type storage struct {
} }
func (s storage) open(b *testing.B) common.Storage { func (s storage) open(b *testing.B) common.Storage {
dir, err := os.MkdirTemp(os.TempDir(), s.desc) st := s.create(b.TempDir())
if err != nil {
b.Fatalf("creating %s root path: %v", s.desc, err)
}
st := s.create(dir)
require.NoError(b, st.Open(false)) require.NoError(b, st.Open(false))
require.NoError(b, st.Init()) require.NoError(b, st.Init())
b.Cleanup(func() { b.Cleanup(func() {
require.NoError(b, st.Close()) require.NoError(b, st.Close())
require.NoError(b, os.RemoveAll(dir))
}) })
return st return st

View file

@ -233,8 +233,7 @@ func TestExecBlocks(t *testing.T) {
} }
func TestPersistentShardID(t *testing.T) { func TestPersistentShardID(t *testing.T) {
dir, err := os.MkdirTemp("", "*") dir := t.TempDir()
require.NoError(t, err)
te := newEngineWithErrorThreshold(t, dir, 1) te := newEngineWithErrorThreshold(t, dir, 1)

View file

@ -41,11 +41,7 @@ type testShard struct {
func newEngineWithErrorThreshold(t testing.TB, dir string, errThreshold uint32) *testEngine { func newEngineWithErrorThreshold(t testing.TB, dir string, errThreshold uint32) *testEngine {
if dir == "" { if dir == "" {
var err error dir = t.TempDir()
dir, err = os.MkdirTemp("", "*")
require.NoError(t, err)
t.Cleanup(func() { _ = os.RemoveAll(dir) })
} }
var testShards [2]*testShard var testShards [2]*testShard
@ -171,9 +167,7 @@ func TestErrorReporting(t *testing.T) {
} }
func TestBlobstorFailback(t *testing.T) { func TestBlobstorFailback(t *testing.T) {
dir, err := os.MkdirTemp("", "*") dir := t.TempDir()
require.NoError(t, err)
t.Cleanup(func() { require.NoError(t, os.RemoveAll(dir)) })
te := newEngineWithErrorThreshold(t, dir, 1) te := newEngineWithErrorThreshold(t, dir, 1)
@ -185,7 +179,7 @@ func TestBlobstorFailback(t *testing.T) {
var prm shard.PutPrm var prm shard.PutPrm
prm.SetObject(obj) prm.SetObject(obj)
te.ng.mtx.RLock() te.ng.mtx.RLock()
_, err = te.ng.shards[te.shards[0].id.String()].Shard.Put(context.Background(), prm) _, err := te.ng.shards[te.shards[0].id.String()].Shard.Put(context.Background(), prm)
te.ng.mtx.RUnlock() te.ng.mtx.RUnlock()
require.NoError(t, err) require.NoError(t, err)
objs = append(objs, obj) objs = append(objs, obj)
@ -193,7 +187,7 @@ func TestBlobstorFailback(t *testing.T) {
for i := range objs { for i := range objs {
addr := object.AddressOf(objs[i]) addr := object.AddressOf(objs[i])
_, err = te.ng.Get(context.Background(), GetPrm{addr: addr}) _, err := te.ng.Get(context.Background(), GetPrm{addr: addr})
require.NoError(t, err) require.NoError(t, err)
_, err = te.ng.GetRange(context.Background(), RngPrm{addr: addr}) _, err = te.ng.GetRange(context.Background(), RngPrm{addr: addr})
require.NoError(t, err) require.NoError(t, err)

View file

@ -4,7 +4,6 @@ import (
"context" "context"
"errors" "errors"
"fmt" "fmt"
"os"
"path/filepath" "path/filepath"
"strconv" "strconv"
"testing" "testing"
@ -25,9 +24,7 @@ import (
) )
func newEngineEvacuate(t *testing.T, shardNum int, objPerShard int) (*StorageEngine, []*shard.ID, []*objectSDK.Object) { func newEngineEvacuate(t *testing.T, shardNum int, objPerShard int) (*StorageEngine, []*shard.ID, []*objectSDK.Object) {
dir, err := os.MkdirTemp("", "*") dir := t.TempDir()
require.NoError(t, err)
t.Cleanup(func() { _ = os.RemoveAll(dir) })
te := testNewEngine(t, WithShardPoolSize(1)). te := testNewEngine(t, WithShardPoolSize(1)).
setShardsNumOpts(t, shardNum, func(id int) []shard.Option { setShardsNumOpts(t, shardNum, func(id int) []shard.Option {

View file

@ -4,7 +4,6 @@ import (
"context" "context"
"fmt" "fmt"
"math/rand" "math/rand"
"os"
"path/filepath" "path/filepath"
"strconv" "strconv"
"sync" "sync"
@ -31,19 +30,14 @@ var providers = []struct {
return f return f
}}, }},
{"bbolt", func(t testing.TB, opts ...Option) Forest { {"bbolt", func(t testing.TB, opts ...Option) Forest {
// Use `os.TempDir` because we construct multiple times in the same test.
tmpDir, err := os.MkdirTemp(os.TempDir(), "*")
require.NoError(t, err)
f := NewBoltForest( f := NewBoltForest(
append([]Option{ append([]Option{
WithPath(filepath.Join(tmpDir, "test.db")), WithPath(filepath.Join(t.TempDir(), "test.db")),
WithMaxBatchSize(1)}, opts...)...) WithMaxBatchSize(1)}, opts...)...)
require.NoError(t, f.Open(false)) require.NoError(t, f.Open(false))
require.NoError(t, f.Init()) require.NoError(t, f.Init())
t.Cleanup(func() { t.Cleanup(func() {
require.NoError(t, f.Close()) require.NoError(t, f.Close())
require.NoError(t, os.RemoveAll(tmpDir))
}) })
return f return f
}}, }},