forked from vesoft-inc/nebula-go
-
Notifications
You must be signed in to change notification settings - Fork 1
/
session_test.go
50 lines (44 loc) · 838 Bytes
/
session_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//go:build integration
// +build integration
/* Copyright (c) 2021 vesoft inc. All rights reserved.
*
* This source code is licensed under Apache 2.0 License.
*/
package nebula_go
import (
"testing"
"time"
)
func TestSession_Execute(t *testing.T) {
config := GetDefaultConf()
host := HostAddress{address, port}
pool, err := NewConnectionPool([]HostAddress{host}, config, DefaultLogger{})
if err != nil {
t.Fatal(err)
}
sess, err := pool.GetSession("root", "nebula")
if err != nil {
t.Fatal(err)
}
f := func(s *Session) {
time.Sleep(10 * time.Microsecond)
reps, err := s.Execute("yield 1")
if err != nil {
t.Fatal(err)
}
if !reps.IsSucceed() {
t.Fatal(reps.resp.ErrorMsg)
}
}
go func() {
for {
f(sess)
}
}()
go func() {
for {
f(sess)
}
}()
time.Sleep(300 * time.Millisecond)
}