Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: skip unstable test #29433

Merged
merged 3 commits into from
Nov 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions util/profile/trackerrecorder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ import (
"math/rand"
"testing"
"time"
"unsafe"

"github.com/pingcap/tidb/util/kvcache"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestHeapProfileRecorder(t *testing.T) {
Expand All @@ -39,13 +37,15 @@ func TestHeapProfileRecorder(t *testing.T) {
v := getRandomString(10)
lru.Put(keys[i], v)
}
bytes, err := col.getFuncMemUsage(kvcache.ProfileName)
require.Nil(t, err)

valueSize := int(unsafe.Sizeof(getRandomString(10)))
// ensure that the consumed bytes is at least larger than num * size of value
assert.LessOrEqual(t, int64(valueSize*num), bytes)
// we should assert lru size last and value size to reference lru in order to avoid gc
// TODO: TestHeapProfileRecorder is not stable, skip memory profile for now.
//bytes, err := col.getFuncMemUsage(kvcache.ProfileName)
//require.Nil(t, err)
//
//valueSize := int(unsafe.Sizeof(getRandomString(10)))
//// ensure that the consumed bytes is at least larger than num * size of value
//assert.LessOrEqual(t, int64(valueSize*num), bytes)
//// we should assert lru size last and value size to reference lru in order to avoid gc
for _, k := range lru.Keys() {
assert.Len(t, k.Hash(), 8)
}
Expand Down