diff --git a/internal/metarepos/raft_metadata_repository_test.go b/internal/metarepos/raft_metadata_repository_test.go index 5d6e36427..276217b0d 100644 --- a/internal/metarepos/raft_metadata_repository_test.go +++ b/internal/metarepos/raft_metadata_repository_test.go @@ -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 } diff --git a/internal/metarepos/storage_test.go b/internal/metarepos/storage_test.go index 6a0ce24ab..219f81197 100644 --- a/internal/metarepos/storage_test.go +++ b/internal/metarepos/storage_test.go @@ -395,7 +395,6 @@ func TestStorageUpdateLS(t *testing.T) { ms.Run() Reset(func() { ms.Close() - testutil.GC() }) rep := 2 @@ -574,7 +573,6 @@ func TestStorageSealLS(t *testing.T) { ms.Run() Reset(func() { ms.Close() - testutil.GC() }) rep := 2 @@ -746,7 +744,6 @@ func TestStorageUnsealLS(t *testing.T) { ms.Run() Reset(func() { ms.Close() - testutil.GC() }) rep := 2 @@ -936,7 +933,6 @@ func TestStorageCopyOnWrite(t *testing.T) { ms.Run() Reset(func() { ms.Close() - testutil.GC() }) snID := types.StorageNodeID(time.Now().UnixNano()) @@ -956,7 +952,6 @@ func TestStorageCopyOnWrite(t *testing.T) { ms.Run() Reset(func() { ms.Close() - testutil.GC() }) snID := types.StorageNodeID(time.Now().UnixNano()) @@ -1049,7 +1044,6 @@ func TestStorageCopyOnWrite(t *testing.T) { ms.Run() Reset(func() { ms.Close() - testutil.GC() }) rep := 2 @@ -1156,7 +1150,6 @@ func TestStorageMetadataCache(t *testing.T) { ms.Run() Reset(func() { ms.Close() - testutil.GC() }) m := ms.GetMetadata() @@ -1175,7 +1168,6 @@ func TestStorageMetadataCache(t *testing.T) { ms.Run() Reset(func() { ms.Close() - testutil.GC() }) snID := types.StorageNodeID(time.Now().UnixNano()) @@ -1246,7 +1238,6 @@ func TestStorageMetadataCache(t *testing.T) { ms.Run() Reset(func() { ms.Close() - testutil.GC() }) <-ch @@ -1299,7 +1290,6 @@ func TestStorageStateMachineMerge(t *testing.T) { ms.Run() Reset(func() { ms.Close() - testutil.GC() }) snID += types.StorageNodeID(1) @@ -1387,7 +1377,6 @@ func TestStorageSnapshot(t *testing.T) { ms.Run() Reset(func() { ms.Close() - testutil.GC() }) snID := types.StorageNodeID(time.Now().UnixNano()) @@ -1472,7 +1461,6 @@ func TestStorageApplySnapshot(t *testing.T) { ms.Run() Reset(func() { ms.Close() - testutil.GC() }) appliedIndex := uint64(0) @@ -1550,7 +1538,6 @@ func TestStorageSnapshotRace(t *testing.T) { ms.Run() Reset(func() { ms.Close() - testutil.GC() }) n := 10000 @@ -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) { diff --git a/pkg/util/testutil/testutil.go b/pkg/util/testutil/testutil.go index f95ef2c1f..b0e8b232f 100644 --- a/pkg/util/testutil/testutil.go +++ b/pkg/util/testutil/testutil.go @@ -1,7 +1,6 @@ package testutil import ( - "fmt" "reflect" "runtime" "strings" @@ -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, "/") diff --git a/tests/it/cluster/client_test.go b/tests/it/cluster/client_test.go index 199bb13b2..9bb88080e 100644 --- a/tests/it/cluster/client_test.go +++ b/tests/it/cluster/client_test.go @@ -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" @@ -37,7 +36,6 @@ func TestClientNoLogStream(t *testing.T) { defer func() { clus.Close(t) - testutil.GC() }() topicID := clus.TopicIDs()[0] @@ -59,7 +57,6 @@ func TestClientAppendToSubscribeTo(t *testing.T) { defer func() { clus.Close(t) - testutil.GC() }() topicID := clus.TopicIDs()[0] @@ -125,7 +122,6 @@ func TestClientAppendTo(t *testing.T) { defer func() { clus.Close(t) - testutil.GC() }() // FIXME: remove this ugly code @@ -158,7 +154,6 @@ func TestClientAppend(t *testing.T) { defer func() { clus.Close(t) - testutil.GC() }() topicID := clus.TopicIDs()[0] @@ -226,7 +221,6 @@ func TestClientAppendCancel(t *testing.T) { defer func() { clus.Close(t) - testutil.GC() }() topicID := clus.TopicIDs()[0] @@ -279,7 +273,6 @@ func TestClientSubscribe(t *testing.T) { defer func() { clus.Close(t) - testutil.GC() }() newMsg := func(glsn types.GLSN) string { @@ -344,7 +337,6 @@ func TestClientTrim(t *testing.T) { defer func() { clus.Close(t) - testutil.GC() }() topicID := clus.TopicIDs()[0] @@ -673,7 +665,6 @@ func TestClientAppendWithAllowedLogStream(t *testing.T) { defer func() { clus.Close(t) - testutil.GC() }() topicID := clus.TopicIDs()[0] diff --git a/tests/it/failover/failover_test.go b/tests/it/failover/failover_test.go index 8819f90d9..3edce4299 100644 --- a/tests/it/failover/failover_test.go +++ b/tests/it/failover/failover_test.go @@ -142,7 +142,6 @@ func TestVarlogFailoverSNBackupInitialFault(t *testing.T) { defer func() { clus.Close(t) - testutil.GC() }() topicID := clus.TopicIDs()[0] diff --git a/tests/it/testenv.go b/tests/it/testenv.go index bd062f1f0..87290a5f0 100644 --- a/tests/it/testenv.go +++ b/tests/it/testenv.go @@ -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" @@ -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)