query_node_test.go 552 字节
Newer Older
Z
zhenshan.cao 已提交
1
package querynode
Z
zhenshan.cao 已提交
2

D
dragondriver 已提交
3 4 5 6 7 8
import (
	"context"
	"testing"
	"time"
)

Z
zhenshan.cao 已提交
9
const ctxTimeInMillisecond = 200
D
dragondriver 已提交
10 11 12 13
const closeWithDeadline = true

// NOTE: start pulsar and etcd before test
func TestQueryNode_start(t *testing.T) {
C
cai.zhang 已提交
14
	Params.Init()
D
dragondriver 已提交
15 16 17 18 19 20 21 22 23 24 25

	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()
	}

D
dragondriver 已提交
26
	node := NewQueryNode(ctx, 0)
D
dragondriver 已提交
27
	node.Start()
28
	node.Close()
D
dragondriver 已提交
29
}