milvus/internal/reader/query_node_test.go
xige-16 1a929ac655 Fix memory leak when running query node’s unites
Signed-off-by: xige-16 <xi.ge@zilliz.com>
2020-11-24 20:14:51 +08:00

30 lines
550 B
Go

package reader
import (
"context"
"testing"
"time"
)
const ctxTimeInMillisecond = 2000
const closeWithDeadline = true
// NOTE: start pulsar and etcd before test
func TestQueryNode_start(t *testing.T) {
Params.Init()
var ctx context.Context
if closeWithDeadline {
var cancel context.CancelFunc
d := time.Now().Add(ctxTimeInMillisecond * time.Millisecond)
ctx, cancel = context.WithDeadline(context.Background(), d)
defer cancel()
} else {
ctx = context.Background()
}
node := NewQueryNode(ctx, 0)
node.Start()
node.Close()
}