[#321] shard/test: Execute tests in parallel

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2023-05-05 14:08:10 +03:00 committed by Evgenii Stratonikov
parent d35e4c389f
commit 4578d00619
12 changed files with 37 additions and 0 deletions

View file

@ -43,6 +43,8 @@ type objAddr struct {
} }
func TestShardOpen(t *testing.T) { func TestShardOpen(t *testing.T) {
t.Parallel()
dir := t.TempDir() dir := t.TempDir()
metaPath := filepath.Join(dir, "meta") metaPath := filepath.Join(dir, "meta")
@ -111,6 +113,8 @@ func TestShardOpen(t *testing.T) {
} }
func TestRefillMetabaseCorrupted(t *testing.T) { func TestRefillMetabaseCorrupted(t *testing.T) {
t.Parallel()
dir := t.TempDir() dir := t.TempDir()
fsTree := fstree.New( fsTree := fstree.New(
@ -164,6 +168,8 @@ func TestRefillMetabaseCorrupted(t *testing.T) {
} }
func TestRefillMetabase(t *testing.T) { func TestRefillMetabase(t *testing.T) {
t.Parallel()
p := t.Name() p := t.Name()
defer os.RemoveAll(p) defer os.RemoveAll(p)

View file

@ -13,11 +13,15 @@ import (
) )
func TestShard_Delete(t *testing.T) { func TestShard_Delete(t *testing.T) {
t.Parallel()
t.Run("without write cache", func(t *testing.T) { t.Run("without write cache", func(t *testing.T) {
t.Parallel()
testShardDelete(t, false) testShardDelete(t, false)
}) })
t.Run("with write cache", func(t *testing.T) { t.Run("with write cache", func(t *testing.T) {
t.Parallel()
testShardDelete(t, true) testShardDelete(t, true)
}) })
} }

View file

@ -25,6 +25,8 @@ import (
) )
func Test_GCDropsLockedExpiredObject(t *testing.T) { func Test_GCDropsLockedExpiredObject(t *testing.T) {
t.Parallel()
var sh *shard.Shard var sh *shard.Shard
epoch := &epochState{ epoch := &epochState{

View file

@ -17,11 +17,15 @@ import (
) )
func TestShard_Get(t *testing.T) { func TestShard_Get(t *testing.T) {
t.Parallel()
t.Run("without write cache", func(t *testing.T) { t.Run("without write cache", func(t *testing.T) {
t.Parallel()
testShardGet(t, false) testShardGet(t, false)
}) })
t.Run("with write cache", func(t *testing.T) { t.Run("with write cache", func(t *testing.T) {
t.Parallel()
testShardGet(t, true) testShardGet(t, true)
}) })
} }

View file

@ -15,11 +15,15 @@ import (
) )
func TestShard_Head(t *testing.T) { func TestShard_Head(t *testing.T) {
t.Parallel()
t.Run("without write cache", func(t *testing.T) { t.Run("without write cache", func(t *testing.T) {
t.Parallel()
testShardHead(t, false) testShardHead(t, false)
}) })
t.Run("with write cache", func(t *testing.T) { t.Run("with write cache", func(t *testing.T) {
t.Parallel()
testShardHead(t, true) testShardHead(t, true)
}) })
} }

View file

@ -13,11 +13,15 @@ import (
) )
func TestShard_Inhume(t *testing.T) { func TestShard_Inhume(t *testing.T) {
t.Parallel()
t.Run("without write cache", func(t *testing.T) { t.Run("without write cache", func(t *testing.T) {
t.Parallel()
testShardInhume(t, false) testShardInhume(t, false)
}) })
t.Run("with write cache", func(t *testing.T) { t.Run("with write cache", func(t *testing.T) {
t.Parallel()
testShardInhume(t, true) testShardInhume(t, true)
}) })
} }

View file

@ -14,6 +14,8 @@ import (
) )
func TestShard_List(t *testing.T) { func TestShard_List(t *testing.T) {
t.Parallel()
t.Run("without write cache", func(t *testing.T) { t.Run("without write cache", func(t *testing.T) {
t.Parallel() t.Parallel()
sh := newShard(t, false) sh := newShard(t, false)

View file

@ -23,6 +23,8 @@ import (
) )
func TestShard_Lock(t *testing.T) { func TestShard_Lock(t *testing.T) {
t.Parallel()
var sh *shard.Shard var sh *shard.Shard
rootPath := t.TempDir() rootPath := t.TempDir()

View file

@ -72,6 +72,8 @@ const physical = "phy"
const logical = "logic" const logical = "logic"
func TestCounters(t *testing.T) { func TestCounters(t *testing.T) {
t.Parallel()
dir := t.TempDir() dir := t.TempDir()
sh, mm := shardWithMetrics(t, dir) sh, mm := shardWithMetrics(t, dir)

View file

@ -22,11 +22,14 @@ import (
) )
func TestShard_GetRange(t *testing.T) { func TestShard_GetRange(t *testing.T) {
t.Parallel()
t.Run("without write cache", func(t *testing.T) { t.Run("without write cache", func(t *testing.T) {
t.Parallel()
testShardGetRange(t, false) testShardGetRange(t, false)
}) })
t.Run("with write cache", func(t *testing.T) { t.Run("with write cache", func(t *testing.T) {
t.Parallel()
testShardGetRange(t, true) testShardGetRange(t, true)
}) })
} }

View file

@ -24,6 +24,8 @@ import (
) )
func TestShardReload(t *testing.T) { func TestShardReload(t *testing.T) {
t.Parallel()
p := t.Name() p := t.Name()
defer os.RemoveAll(p) defer os.RemoveAll(p)

View file

@ -16,6 +16,8 @@ import (
) )
func TestWriteCacheObjectLoss(t *testing.T) { func TestWriteCacheObjectLoss(t *testing.T) {
t.Parallel()
const ( const (
smallSize = 1024 smallSize = 1024
objCount = 100 objCount = 100