WIP: Morph: Add unit tests #2

Closed
dstepanov-yadro wants to merge 233 commits from TrueCloudLab/frostfs-node:master into object-3608-morph-unit-tests
12 changed files with 37 additions and 0 deletions
Showing only changes of commit 4578d00619 - Show all commits

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