milvus/internal/datanode/cache_test.go
XuanYang-cn 9d81a90402
Fix mem leak of flush cache in DataNode (#6862)
Resolves: #6858

Signed-off-by: yangxuan <xuan.yang@zilliz.com>
2021-08-11 14:24:09 +08:00

20 lines
337 B
Go

package datanode
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestSegmentCache(t *testing.T) {
segCache := newCache()
assert.False(t, segCache.checkIfCached(0))
segCache.Cache(UniqueID(0))
assert.True(t, segCache.checkIfCached(0))
segCache.Remove(UniqueID(0))
assert.False(t, segCache.checkIfCached(0))
}