-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathssl_sessionpool_test.go
74 lines (67 loc) · 1.54 KB
/
ssl_sessionpool_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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//go:build integration
// +build integration
/*
*
* Copyright (c) 2023 vesoft inc. All rights reserved.
*
* This source code is licensed under Apache 2.0 License.
*
*/
package nebula_go
import (
"testing"
"time"
)
func TestSslSessionPool(t *testing.T) {
skipSsl(t)
hostAddress := HostAddress{Host: address, Port: port}
hostList := []HostAddress{}
hostList = append(hostList, hostAddress)
sslConfig, err := GetDefaultSSLConfig(
"./nebula-docker-compose/secrets/root.crt",
"./nebula-docker-compose/secrets/client.crt",
"./nebula-docker-compose/secrets/client.key",
)
if err != nil {
t.Fatal(err)
}
sslConfig.InsecureSkipVerify = true // This is only used for testing
conf, err := NewSessionPoolConf(
username,
password,
hostList,
"session_pool",
WithMaxSize(10),
WithMinSize(1),
WithTimeOut(0*time.Millisecond),
WithIdleTime(0*time.Millisecond),
WithSSLConfig(sslConfig),
)
if err != nil {
t.Fatal(err)
}
pool, err := NewSessionPool(*conf, nebulaLog)
if err != nil {
t.Fatal(err)
}
defer pool.Close()
resp, err := pool.Execute("SHOW HOSTS;")
if err != nil {
t.Fatalf(err.Error())
return
}
checkResultSet(t, "show hosts", resp)
// Create a new space
resp, err = pool.Execute("CREATE SPACE client_test(partition_num=1024, replica_factor=1, vid_type = FIXED_STRING(30));")
if err != nil {
t.Fatalf(err.Error())
return
}
checkResultSet(t, "create space", resp)
resp, err = pool.Execute("DROP SPACE client_test;")
if err != nil {
t.Fatalf(err.Error())
return
}
checkResultSet(t, "drop space", resp)
}