Skip to content

Commit

Permalink
test(all): do not perform GC manually (#641)
Browse files Browse the repository at this point in the history
  • Loading branch information
ijsong authored Jan 2, 2024
2 parents 5237f8f + 7e2fe96 commit bbbb5ab
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 42 deletions.
1 change: 0 additions & 1 deletion internal/metarepos/raft_metadata_repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ func (clus *metadataRepoCluster) Close() error {
}
err = multierr.Append(err, os.RemoveAll(vtesting.TestRaftDir()))
err = multierr.Append(err, clus.portLease.Release())
testutil.GC()
return err
}

Expand Down
14 changes: 0 additions & 14 deletions internal/metarepos/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@ func TestStorageUpdateLS(t *testing.T) {
ms.Run()
Reset(func() {
ms.Close()
testutil.GC()
})

rep := 2
Expand Down Expand Up @@ -574,7 +573,6 @@ func TestStorageSealLS(t *testing.T) {
ms.Run()
Reset(func() {
ms.Close()
testutil.GC()
})

rep := 2
Expand Down Expand Up @@ -746,7 +744,6 @@ func TestStorageUnsealLS(t *testing.T) {
ms.Run()
Reset(func() {
ms.Close()
testutil.GC()
})

rep := 2
Expand Down Expand Up @@ -936,7 +933,6 @@ func TestStorageCopyOnWrite(t *testing.T) {
ms.Run()
Reset(func() {
ms.Close()
testutil.GC()
})

snID := types.StorageNodeID(time.Now().UnixNano())
Expand All @@ -956,7 +952,6 @@ func TestStorageCopyOnWrite(t *testing.T) {
ms.Run()
Reset(func() {
ms.Close()
testutil.GC()
})

snID := types.StorageNodeID(time.Now().UnixNano())
Expand Down Expand Up @@ -1049,7 +1044,6 @@ func TestStorageCopyOnWrite(t *testing.T) {
ms.Run()
Reset(func() {
ms.Close()
testutil.GC()
})

rep := 2
Expand Down Expand Up @@ -1156,7 +1150,6 @@ func TestStorageMetadataCache(t *testing.T) {
ms.Run()
Reset(func() {
ms.Close()
testutil.GC()
})

m := ms.GetMetadata()
Expand All @@ -1175,7 +1168,6 @@ func TestStorageMetadataCache(t *testing.T) {
ms.Run()
Reset(func() {
ms.Close()
testutil.GC()
})

snID := types.StorageNodeID(time.Now().UnixNano())
Expand Down Expand Up @@ -1246,7 +1238,6 @@ func TestStorageMetadataCache(t *testing.T) {
ms.Run()
Reset(func() {
ms.Close()
testutil.GC()
})

<-ch
Expand Down Expand Up @@ -1299,7 +1290,6 @@ func TestStorageStateMachineMerge(t *testing.T) {
ms.Run()
Reset(func() {
ms.Close()
testutil.GC()
})

snID += types.StorageNodeID(1)
Expand Down Expand Up @@ -1387,7 +1377,6 @@ func TestStorageSnapshot(t *testing.T) {
ms.Run()
Reset(func() {
ms.Close()
testutil.GC()
})

snID := types.StorageNodeID(time.Now().UnixNano())
Expand Down Expand Up @@ -1472,7 +1461,6 @@ func TestStorageApplySnapshot(t *testing.T) {
ms.Run()
Reset(func() {
ms.Close()
testutil.GC()
})

appliedIndex := uint64(0)
Expand Down Expand Up @@ -1550,7 +1538,6 @@ func TestStorageSnapshotRace(t *testing.T) {
ms.Run()
Reset(func() {
ms.Close()
testutil.GC()
})

n := 10000
Expand Down Expand Up @@ -1782,7 +1769,6 @@ func TestStorageRecoverStateMachine(t *testing.T) {
ms.Run()
Reset(func() {
ms.Close()
testutil.GC()
})

Convey("When recover state machine ", func(ctx C) {
Expand Down
15 changes: 0 additions & 15 deletions pkg/util/testutil/testutil.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package testutil

import (
"fmt"
"reflect"
"runtime"
"strings"
Expand Down Expand Up @@ -93,20 +92,6 @@ func CompareWaitErrorN(factor int64, cmp func() (bool, error)) error {
return CompareWaitError(cmp, vtesting.TimeoutUnitTimesFactor(factor))
}

func GC() {
var ms runtime.MemStats
var gc runtime.MemStats

runtime.ReadMemStats(&ms)
runtime.GC()
runtime.ReadMemStats(&gc)

fmt.Printf("\nGC Stat:: %f -> %f mb, Sys: %f mb\n",
float32(ms.Alloc)/float32(1024*1024),
float32(gc.Alloc)/float32(1024*1024),
float32(gc.Sys)/float32(1024*1024))
}

func GetFunctionName(i interface{}) string {
a := runtime.FuncForPC(reflect.ValueOf(i).Pointer()).Name()
s := strings.Split(a, "/")
Expand Down
9 changes: 0 additions & 9 deletions tests/it/cluster/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/stretchr/testify/require"

"github.com/kakao/varlog/pkg/types"
"github.com/kakao/varlog/pkg/util/testutil"
"github.com/kakao/varlog/pkg/varlog"
"github.com/kakao/varlog/pkg/varlog/x/mlsa"
"github.com/kakao/varlog/proto/varlogpb"
Expand All @@ -37,7 +36,6 @@ func TestClientNoLogStream(t *testing.T) {

defer func() {
clus.Close(t)
testutil.GC()
}()

topicID := clus.TopicIDs()[0]
Expand All @@ -59,7 +57,6 @@ func TestClientAppendToSubscribeTo(t *testing.T) {

defer func() {
clus.Close(t)
testutil.GC()
}()

topicID := clus.TopicIDs()[0]
Expand Down Expand Up @@ -125,7 +122,6 @@ func TestClientAppendTo(t *testing.T) {

defer func() {
clus.Close(t)
testutil.GC()
}()

// FIXME: remove this ugly code
Expand Down Expand Up @@ -158,7 +154,6 @@ func TestClientAppend(t *testing.T) {

defer func() {
clus.Close(t)
testutil.GC()
}()

topicID := clus.TopicIDs()[0]
Expand Down Expand Up @@ -226,7 +221,6 @@ func TestClientAppendCancel(t *testing.T) {

defer func() {
clus.Close(t)
testutil.GC()
}()

topicID := clus.TopicIDs()[0]
Expand Down Expand Up @@ -279,7 +273,6 @@ func TestClientSubscribe(t *testing.T) {

defer func() {
clus.Close(t)
testutil.GC()
}()

newMsg := func(glsn types.GLSN) string {
Expand Down Expand Up @@ -344,7 +337,6 @@ func TestClientTrim(t *testing.T) {

defer func() {
clus.Close(t)
testutil.GC()
}()

topicID := clus.TopicIDs()[0]
Expand Down Expand Up @@ -673,7 +665,6 @@ func TestClientAppendWithAllowedLogStream(t *testing.T) {

defer func() {
clus.Close(t)
testutil.GC()
}()

topicID := clus.TopicIDs()[0]
Expand Down
1 change: 0 additions & 1 deletion tests/it/failover/failover_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ func TestVarlogFailoverSNBackupInitialFault(t *testing.T) {

defer func() {
clus.Close(t)
testutil.GC()
}()

topicID := clus.TopicIDs()[0]
Expand Down
2 changes: 0 additions & 2 deletions tests/it/testenv.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"github.com/kakao/varlog/pkg/mrc"
"github.com/kakao/varlog/pkg/rpc"
"github.com/kakao/varlog/pkg/types"
"github.com/kakao/varlog/pkg/util/testutil"
"github.com/kakao/varlog/pkg/util/testutil/ports"
"github.com/kakao/varlog/pkg/varlog"
"github.com/kakao/varlog/proto/admpb"
Expand Down Expand Up @@ -1464,7 +1463,6 @@ func WithTestCluster(t *testing.T, opts []Option, f func(env *VarlogCluster)) fu

defer func() {
env.Close(t)
testutil.GC()
}()

f(env)
Expand Down

0 comments on commit bbbb5ab

Please sign in to comment.