forked from TrueCloudLab/frostfs-node
pilorama/tests: Remove magic constants for inmemory type
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
c916a75948
commit
e4344fd5cc
1 changed files with 7 additions and 5 deletions
|
@ -18,11 +18,13 @@ import (
|
||||||
"golang.org/x/sync/errgroup"
|
"golang.org/x/sync/errgroup"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const inmemoryType = "inmemory"
|
||||||
|
|
||||||
var providers = []struct {
|
var providers = []struct {
|
||||||
name string
|
name string
|
||||||
construct func(t testing.TB, opts ...Option) ForestStorage
|
construct func(t testing.TB, opts ...Option) ForestStorage
|
||||||
}{
|
}{
|
||||||
{"inmemory", func(t testing.TB, _ ...Option) ForestStorage {
|
{inmemoryType, func(t testing.TB, _ ...Option) ForestStorage {
|
||||||
f := NewMemoryForest()
|
f := NewMemoryForest()
|
||||||
require.NoError(t, f.Open(context.Background(), false))
|
require.NoError(t, f.Open(context.Background(), false))
|
||||||
require.NoError(t, f.Init())
|
require.NoError(t, f.Init())
|
||||||
|
@ -469,7 +471,7 @@ func testForestTreeApply(t *testing.T, constructor func(t testing.TB, _ ...Optio
|
||||||
func TestForest_ApplySameOperation(t *testing.T) {
|
func TestForest_ApplySameOperation(t *testing.T) {
|
||||||
for i := range providers {
|
for i := range providers {
|
||||||
t.Run(providers[i].name, func(t *testing.T) {
|
t.Run(providers[i].name, func(t *testing.T) {
|
||||||
parallel := providers[i].name != "inmemory"
|
parallel := providers[i].name != inmemoryType
|
||||||
testForestApplySameOperation(t, providers[i].construct, parallel)
|
testForestApplySameOperation(t, providers[i].construct, parallel)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -763,7 +765,7 @@ func TestForest_ApplyRandom(t *testing.T) {
|
||||||
|
|
||||||
func TestForest_ParallelApply(t *testing.T) {
|
func TestForest_ParallelApply(t *testing.T) {
|
||||||
for i := range providers {
|
for i := range providers {
|
||||||
if providers[i].name == "inmemory" {
|
if providers[i].name == inmemoryType {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
t.Run(providers[i].name, func(t *testing.T) {
|
t.Run(providers[i].name, func(t *testing.T) {
|
||||||
|
@ -922,7 +924,7 @@ var batchSizes = []int{1, 2, 4, 8, 16, 32}
|
||||||
|
|
||||||
func BenchmarkApplySequential(b *testing.B) {
|
func BenchmarkApplySequential(b *testing.B) {
|
||||||
for i := range providers {
|
for i := range providers {
|
||||||
if providers[i].name == "inmemory" { // memory backend is not thread-safe
|
if providers[i].name == inmemoryType { // memory backend is not thread-safe
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
b.Run(providers[i].name, func(b *testing.B) {
|
b.Run(providers[i].name, func(b *testing.B) {
|
||||||
|
@ -958,7 +960,7 @@ func BenchmarkApplyReorderLast(b *testing.B) {
|
||||||
const blockSize = 10
|
const blockSize = 10
|
||||||
|
|
||||||
for i := range providers {
|
for i := range providers {
|
||||||
if providers[i].name == "inmemory" { // memory backend is not thread-safe
|
if providers[i].name == inmemoryType { // memory backend is not thread-safe
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
b.Run(providers[i].name, func(b *testing.B) {
|
b.Run(providers[i].name, func(b *testing.B) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue