From e158b4ee60b1d3bcf1f08b304ab9caa1c0af960a Mon Sep 17 00:00:00 2001 From: HarrisChu <1726587+HarrisChu@users.noreply.github.com> Date: Tue, 28 Dec 2021 14:23:19 +0800 Subject: [PATCH 1/2] add ssl connetion pool --- client.go | 237 +++++++++++++++++++++++------------ example/cert/test.ca.pem | 24 ++++ example/cert/test.derive.crt | 23 ++++ example/cert/test.derive.key | 27 ++++ example/nebula-test-ssl.js | 47 +++++++ go.mod | 2 +- go.sum | 4 +- 7 files changed, 279 insertions(+), 85 deletions(-) create mode 100644 example/cert/test.ca.pem create mode 100644 example/cert/test.derive.crt create mode 100644 example/cert/test.derive.key create mode 100644 example/nebula-test-ssl.js diff --git a/client.go b/client.go index f566450..f403732 100644 --- a/client.go +++ b/client.go @@ -1,6 +1,7 @@ package nebulagraph import ( + "crypto/tls" "fmt" "strconv" "strings" @@ -10,31 +11,78 @@ import ( nebula "github.com/vesoft-inc/nebula-go/v2" ) -type Data []string +type ( + // NebulaPool nebula connection pool + NebulaPool struct { + HostList []nebula.HostAddress + Pool *nebula.ConnectionPool + Log nebula.Logger + DataChs []chan Data + OutoptCh chan []string + Version string + csvStrategy csvReaderStrategy + initialized bool + sessions []*nebula.Session + channelBufferSize int + sslconfig *sslConfig + mutex sync.Mutex + } -type Output struct { - TimeStamp int64 - NGQL string - Latency int64 - ResponseTime int32 - IsSucceed bool - Rows int32 - ErrorMsg string -} + // NebulaSession a wrapper for nebula session, could read data from DataCh + NebulaSession struct { + Session *nebula.Session + Pool *NebulaPool + DataCh chan Data + } + + // Response a wrapper for nebula resultset + Response struct { + *nebula.ResultSet + ResponseTime int32 + } + + csvReaderStrategy int + + sslConfig struct { + rootCAPath string + certPath string + privateKeyPath string + } + + // Data data in csv file + Data []string + + output struct { + timeStamp int64 + nGQL string + latency int64 + responseTime int32 + isSucceed bool + rows int32 + errorMsg string + } +) + +const ( + // AllInOne all the vus use the same DataCh + AllInOne csvReaderStrategy = iota + // Separate each vu has a seprate DataCh + Separate +) -func formatOutput(o *Output) []string { +func formatOutput(o *output) []string { return []string{ - strconv.FormatInt(o.TimeStamp, 10), - o.NGQL, - strconv.Itoa(int(o.Latency)), - strconv.Itoa(int(o.ResponseTime)), - strconv.FormatBool(o.IsSucceed), - strconv.Itoa(int(o.Rows)), - o.ErrorMsg, + strconv.FormatInt(o.timeStamp, 10), + o.nGQL, + strconv.Itoa(int(o.latency)), + strconv.Itoa(int(o.responseTime)), + strconv.FormatBool(o.isSucceed), + strconv.Itoa(int(o.rows)), + o.errorMsg, } } -var OutputHeader []string = []string{ +var outputHeader []string = []string{ "timestamp", "nGQL", "latency", @@ -44,37 +92,7 @@ var OutputHeader []string = []string{ "errorMsg", } -type Response struct { - *nebula.ResultSet - ResponseTime int32 -} -type CSVReaderStrategy int - -const ( - AllInOne CSVReaderStrategy = iota - Separate -) - -type NebulaPool struct { - HostList []nebula.HostAddress - Pool *nebula.ConnectionPool - Log nebula.Logger - DataChs []chan Data - OutoptCh chan []string - Version string - csvStrategy CSVReaderStrategy - initialized bool - sessions []*nebula.Session - channelBufferSize int - mutex sync.Mutex -} - -type NebulaSession struct { - Session *nebula.Session - Pool *NebulaPool - DataCh chan Data -} - +// New for k6 initialization. func New() *NebulaPool { return &NebulaPool{ Log: nebula.DefaultLogger{}, @@ -83,57 +101,105 @@ func New() *NebulaPool { } } +// NewSSLConfig return sslConfig +func (np *NebulaPool) NewSSLConfig(rootCAPath, certPath, privateKeyPath string) { + np.sslconfig = &sslConfig{ + rootCAPath: rootCAPath, + certPath: certPath, + privateKeyPath: privateKeyPath, + } +} + +// Init init nebula pool with address and concurrent, by default the buffersize is 20000 func (np *NebulaPool) Init(address string, concurrent int) (*NebulaPool, error) { return np.InitWithSize(address, concurrent, 20000) - } +// InitWithSize init nebula pool with channel buffer size func (np *NebulaPool) InitWithSize(address string, concurrent int, size int) (*NebulaPool, error) { - if np.initialized { - return np, nil - } + np.mutex.Lock() + defer np.mutex.Unlock() np.Log.Info("begin init the nebula pool") - np.sessions = make([]*nebula.Session, concurrent) - np.channelBufferSize = size - np.OutoptCh = make(chan []string, np.channelBufferSize) + np.initialized = true + var ( + sslConfig *tls.Config + err error + pool *nebula.ConnectionPool + ) + + if np.sslconfig != nil { + sslConfig, err = nebula.GetDefaultSSLConfig( + np.sslconfig.rootCAPath, + np.sslconfig.certPath, + np.sslconfig.privateKeyPath, + ) + if err != nil { + return nil, err + } + // skip insecure verification for stress testing. + sslConfig.InsecureSkipVerify = true + } + err = np.initAndVerifyPool(address, concurrent, size) + if err != nil { + return nil, err + } + conf := np.getDefaultConf(concurrent) + if sslConfig != nil { + pool, err = nebula.NewSslConnectionPool(np.HostList, *conf, sslConfig, np.Log) + + } else { + pool, err = nebula.NewConnectionPool(np.HostList, *conf, np.Log) + } + + if err != nil { + return nil, err + } + np.Pool = pool + np.Log.Info("finish init the pool") + np.initialized = true + return np, nil +} + +func (np *NebulaPool) initAndVerifyPool(address string, concurrent int, size int) error { addrs := strings.Split(address, ",") var hosts []nebula.HostAddress for _, addr := range addrs { hostPort := strings.Split(addr, ":") if len(hostPort) != 2 { - return nil, fmt.Errorf("Invalid address: %s", addr) + return fmt.Errorf("Invalid address: %s", addr) } port, err := strconv.Atoi(hostPort[1]) if err != nil { - return nil, err + return err } host := hostPort[0] hostAddr := nebula.HostAddress{Host: host, Port: port} hosts = append(hosts, hostAddr) - + np.HostList = hosts } + np.sessions = make([]*nebula.Session, concurrent) + np.channelBufferSize = size + np.OutoptCh = make(chan []string, np.channelBufferSize) + return nil +} + +func (np *NebulaPool) getDefaultConf(concurrent int) *nebula.PoolConfig { conf := nebula.PoolConfig{ TimeOut: 0, IdleTime: 0, MaxConnPoolSize: concurrent, MinConnPoolSize: 1, } - pool, err := nebula.NewConnectionPool(hosts, conf, np.Log) - if err != nil { - return nil, err - } - - np.Log.Info("finish init the pool") - np.Pool = pool - np.initialized = true - return np, nil + return &conf } +// ConfigCsvStrategy set csv reader strategy func (np *NebulaPool) ConfigCsvStrategy(strategy int) { - np.csvStrategy = CSVReaderStrategy(strategy) + np.csvStrategy = csvReaderStrategy(strategy) } +// ConfigCSV config the csv file to be read func (np *NebulaPool) ConfigCSV(path, delimiter string, withHeader bool) error { for _, dataCh := range np.DataChs { reader := NewCsvReader(path, delimiter, withHeader, dataCh) @@ -144,15 +210,19 @@ func (np *NebulaPool) ConfigCSV(path, delimiter string, withHeader bool) error { return nil } +// ConfigOutput config the output file, would write the execution outputs func (np *NebulaPool) ConfigOutput(path string) error { - writer := NewCsvWriter(path, ",", OutputHeader, np.OutoptCh) + writer := NewCsvWriter(path, ",", outputHeader, np.OutoptCh) if err := writer.WriteForever(); err != nil { return err } return nil } +// Close close the nebula pool func (np *NebulaPool) Close() error { + np.mutex.Lock() + defer np.mutex.Unlock() if !np.initialized { return nil } @@ -162,11 +232,11 @@ func (np *NebulaPool) Close() error { s.Release() } } - np.Pool.Close() np.initialized = false return nil } +// GetSession get the session from pool func (np *NebulaPool) GetSession(user, password string) (*NebulaSession, error) { session, err := np.Pool.GetSession(user, password) if err != nil { @@ -176,12 +246,12 @@ func (np *NebulaPool) GetSession(user, password string) (*NebulaSession, error) defer np.mutex.Unlock() np.sessions = append(np.sessions, session) s := &NebulaSession{Session: session, Pool: np} - s.PrepareCsvReader() + s.prepareCsvReader() return s, nil } -func (s *NebulaSession) PrepareCsvReader() error { +func (s *NebulaSession) prepareCsvReader() error { np := s.Pool if np.csvStrategy == AllInOne { if len(np.DataChs) == 0 { @@ -197,6 +267,7 @@ func (s *NebulaSession) PrepareCsvReader() error { return nil } +// GetData get data from csv reader func (s *NebulaSession) GetData() (Data, error) { if s.DataCh != nil && len(s.DataCh) != 0 { if d, ok := <-s.DataCh; ok { @@ -206,6 +277,7 @@ func (s *NebulaSession) GetData() (Data, error) { return nil, fmt.Errorf("no Data at all") } +// Execute execute nebula query func (s *NebulaSession) Execute(stmt string) (*Response, error) { start := time.Now() rs, err := s.Session.Execute(stmt) @@ -217,14 +289,14 @@ func (s *NebulaSession) Execute(stmt string) (*Response, error) { // output if s.Pool.OutoptCh != nil && len(s.Pool.OutoptCh) != cap(s.Pool.OutoptCh) { - o := &Output{ - TimeStamp: start.Unix(), - NGQL: stmt, - Latency: rs.GetLatency(), - ResponseTime: responseTime, - IsSucceed: rs.IsSucceed(), - Rows: int32(rs.GetRowSize()), - ErrorMsg: rs.GetErrorMsg(), + o := &output{ + timeStamp: start.Unix(), + nGQL: stmt, + latency: rs.GetLatency(), + responseTime: responseTime, + isSucceed: rs.IsSucceed(), + rows: int32(rs.GetRowSize()), + errorMsg: rs.GetErrorMsg(), } s.Pool.OutoptCh <- formatOutput(o) @@ -233,6 +305,7 @@ func (s *NebulaSession) Execute(stmt string) (*Response, error) { return &Response{ResultSet: rs, ResponseTime: responseTime}, nil } +// GetResponseTime GetResponseTime func (r *Response) GetResponseTime() int32 { return r.ResponseTime } diff --git a/example/cert/test.ca.pem b/example/cert/test.ca.pem new file mode 100644 index 0000000..412ba31 --- /dev/null +++ b/example/cert/test.ca.pem @@ -0,0 +1,24 @@ +-----BEGIN CERTIFICATE----- +MIIEGzCCAwOgAwIBAgIUDcmZFpL4PcdCXfLRBK8bR2vb39cwDQYJKoZIhvcNAQEL +BQAwgZwxCzAJBgNVBAYTAkNOMREwDwYDVQQIDAhaaGVqaWFuZzERMA8GA1UEBwwI +SGFuZ3pob3UxFDASBgNVBAoMC1Zlc29mdCBJbmMuMRAwDgYDVQQLDAdzZWN0aW9u +MRYwFAYDVQQDDA1zaHlsb2NrIGh1YW5nMScwJQYJKoZIhvcNAQkBFhhzaHlsb2Nr +Lmh1YW5nQHZlc29mdC5jb20wHhcNMjEwODE5MDkyNDQ3WhcNMjUwODE4MDkyNDQ3 +WjCBnDELMAkGA1UEBhMCQ04xETAPBgNVBAgMCFpoZWppYW5nMREwDwYDVQQHDAhI +YW5nemhvdTEUMBIGA1UECgwLVmVzb2Z0IEluYy4xEDAOBgNVBAsMB3NlY3Rpb24x +FjAUBgNVBAMMDXNoeWxvY2sgaHVhbmcxJzAlBgkqhkiG9w0BCQEWGHNoeWxvY2su +aHVhbmdAdmVzb2Z0LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB +AMEAgpamCQHl+8JnUHI6/VmJHjDLYJLTliN/CwpFrhMqIVjJ8wG57WYLpXpn91Lz +eHu52LkVzcikybIJ2a+LOTvnhNFdbmTbqDtrb+s6wM/sO+nF6tU2Av4e5zhyKoeR +LL+rHMk3nymohbdN4djySFmOOU5A1O/4b0bZz4Ylu995kUawdiaEo13BzxxOC7Ik +Gge5RyDcm0uLXZqTAPy5Sjv/zpOyj0AqL1CJUH7XBN9OMRhVU0ZX9nHWl1vgLRld +J6XT17Y9QbbHhCNEdAmFE5kEFgCvZc+MungUYABlkvoj86TLmC/FMV6fWdxQssyd +hS+ssfJFLaTDaEFz5a/Tr48CAwEAAaNTMFEwHQYDVR0OBBYEFK0GVrQx+wX1GCHy +e+6fl4X+prmYMB8GA1UdIwQYMBaAFK0GVrQx+wX1GCHye+6fl4X+prmYMA8GA1Ud +EwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAHqP8P+ZUHmngviHLSSN1ln5 +Mx4BCkVeFRUaFx0yFXytV/iLXcG2HpFg3A9rAFoYgCDwi1xpsERnBZ/ShTv/eFOc +IxBY5yggx3/lGi8tAgvUdarhd7mQO67UJ0V4YU3hAkbnZ8grHHXj+4hfgUpY4ok6 +yaed6HXwknBb9W8N1jZI8ginhkhjaeRCHdMiF+fBvNCtmeR1bCml1Uz7ailrpcaT +Mf84+5VYuFEnaRZYWFNsWNCOBlJ/6/b3V10vMXzMmYHqz3xgAq0M3fVTFTzopnAX +DLSzorL/dYVdqEDCQi5XI9YAlgWN4VeGzJI+glkLOCNzHxRNP6Qev+YI+7Uxz6I= +-----END CERTIFICATE----- diff --git a/example/cert/test.derive.crt b/example/cert/test.derive.crt new file mode 100644 index 0000000..8f03073 --- /dev/null +++ b/example/cert/test.derive.crt @@ -0,0 +1,23 @@ +-----BEGIN CERTIFICATE----- +MIIDvjCCAqYCFEry67lB6n7oNY7MflHC8aOO4YhzMA0GCSqGSIb3DQEBCwUAMIGc +MQswCQYDVQQGEwJDTjERMA8GA1UECAwIWmhlamlhbmcxETAPBgNVBAcMCEhhbmd6 +aG91MRQwEgYDVQQKDAtWZXNvZnQgSW5jLjEQMA4GA1UECwwHc2VjdGlvbjEWMBQG +A1UEAwwNc2h5bG9jayBodWFuZzEnMCUGCSqGSIb3DQEJARYYc2h5bG9jay5odWFu +Z0B2ZXNvZnQuY29tMB4XDTIxMDgyNDEwNTExMloXDTIzMTEyNzEwNTExMlowgZkx +CzAJBgNVBAYTAkNOMREwDwYDVQQIDAhaaGVqaWFuZzERMA8GA1UEBwwISGFuZ3po +b3UxFDASBgNVBAoMC1Zlc29mdCBJbmMuMRAwDgYDVQQLDAdzZWN0aW9uMRMwEQYD +VQQDDApTaHlsb2NrIEhnMScwJQYJKoZIhvcNAQkBFhhzaHlsb2NrLmh1YW5nQHZl +c29mdC5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDHk1PQtaCG +S31nvxKuT6pzVQuOsA2hEIDzBZuoBK3blezBB16fjUWG2wHG/r9Oss5YzOly4viL +1oFLsNdYg27EFH7pcGfdSUmZa6LHILegJTmLa1aB4lRG9EsvPIxNuo637CW2z6EW +ElVKXn2N1G1vW3fpKGxJ+d1ovaFfBliO0sK+myW+vYdKrNg70WqKKCoCIlIjEWw3 +vQdrmvhuhIBbG1bXkXbJwIepBdb4wGSx8qsgs93I6/je/K/iJaPJIqdH8loo6fSo +DBUiNA87ZsQdtbBeuk7QuF71SxD5+E8wCMtFMwRGmL0vYMPwkaurKxwEs49e8eTz +RvIrNtyYgVo7AgMBAAEwDQYJKoZIhvcNAQELBQADggEBAGBpm5OLXn02kWr1ENU5 +FOOVryD41SCmPy8hLwQ2MCXd446UfTXc5TTlllksaePn373ZANLUe78vUCoVPjOh +dU5GxyOKtubXovI+yuvMS11u00KtgiAd5qa+IhX3c/P60bh4+fdKZ9ViyLsG+IpQ ++XDYT2uekLyjXXJU6h1raW7M1VY9FcDC63moXz0WgWJ/9tJgB0ZQkVcL+2UpveoZ +Whf9P0xAzCmNSrR7CMhdeRN2vBQQaHXk/64wkHncdkz/NglVl00rh4MtBKZ6Cqze +uZvgrxOJNzB4aXBMHO7sWzw1VSfS79CZm4H39hBWGiVEkr3yZYQbboDRY6F5dQyc +BZc= +-----END CERTIFICATE----- diff --git a/example/cert/test.derive.key b/example/cert/test.derive.key new file mode 100644 index 0000000..a011917 --- /dev/null +++ b/example/cert/test.derive.key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEowIBAAKCAQEAx5NT0LWghkt9Z78Srk+qc1ULjrANoRCA8wWbqASt25XswQde +n41FhtsBxv6/TrLOWMzpcuL4i9aBS7DXWINuxBR+6XBn3UlJmWuixyC3oCU5i2tW +geJURvRLLzyMTbqOt+wlts+hFhJVSl59jdRtb1t36ShsSfndaL2hXwZYjtLCvpsl +vr2HSqzYO9FqiigqAiJSIxFsN70Ha5r4boSAWxtW15F2ycCHqQXW+MBksfKrILPd +yOv43vyv4iWjySKnR/JaKOn0qAwVIjQPO2bEHbWwXrpO0Lhe9UsQ+fhPMAjLRTME +Rpi9L2DD8JGrqyscBLOPXvHk80byKzbcmIFaOwIDAQABAoIBAEZ50URHjzs9VziW +sdsaSN/XbXBi3T0+Xbr0BQatOFPtuqBjoNeJBL9dgWArP5Vj8RhMrDekzQ5cnmYD +OdiI+UmGz1ZSGmt7YOErsFzPQejsnEiOjArryMURqacxo34jXhi27I6E/aaUrMfJ +XF8EX+zOCSct3ie1c6l0JZMv43/zbzP2vMFEdfnVfZA2Kxo5l3I4rjuxHUEWHzrb +EgM4a2+y7LQrut75zP9zWEZAqim/VEIEj24Gqj+Vocb6cHlc31KzKaEz7Ra5ha2J +kN2CQRKCzoMupVL5E6dWMiDVjUyUXdUgjSCIW2H+E1ONgvxA78jJx7+Dzj+/bWxH +h/vr3dkCgYEA9Aev7PGoGF0eapZY3crehvtCn1v4YLheh0dk4EpbpbEx0rQaG3h7 +YYCf7euxMvoTsKPETHAUG/s/RZV1DNOjxs8GKgEIVaRYEf1VZeDXudtnyKBwCMAL +5CKHRBvfmNG9n+PpQQlrIAZGej7HU+/IzEVsrD2A5DeH9IVpMNvrX10CgYEA0V1r +aydbBP+Ma/fiG5UDa8l4GdLzvAoW2cY6ZhQX4NiLTK91MwA/QOQcVMvJAN2KpPHC +kGDRT7IhMs66cMxl0ImIJ2QSnv8HRNmBBSdUtJx1S6nV2u0VfgP61oNT/YbLR/Jk +CAIl1qe7Q8IsrMbPxCbt8g+D8Wr9C3pdYYqFvncCgYEAicGdKmDwx3Apr3nYCLxx +CjnkzhkZCWCK3EsNQyA2xD5XJd7NrhxBajU2ExUuHtzVKK4KLixG7dTTTvCj9u2y +UpSjoiqbDd2MaftcrfpTTXPyDmujUw02qT5kpaomexpLtWrvTeuHMbjZKEEwPM3r +yISYaFL/49UFRp/ZVd+P63ECgYAX1B0ctf77A6bUxwK6Buy7wNNlhQful+tf39rX +sWPCWIMKOFILevS4Cv5afFMlQRG9kjKFwi8wdeKnaLX5jpnr8StI6G/iHr6SDHtN +vds7Ly9+bBcF8sPmcseC0LGngkbyqljOPIhX9QEwRhJVm88b0R511WQ7/uRMASJN +rrloIwKBgCxYlu1xvvEuQNoIux/yKAEJ1h4Ta2zc5upjw0uDKMi0UNIbNhgdFOvj +LuVbxTRU8WktrLNk3T0rsopKsTbEZVg6Yuv8ZLkEiNYTzhUbn2Y5yM3bnoVwyOns +pTtqmBtvDZxaRCYdIQG3b09IvrewDk26AOtNHdeKw883G2muP/vA +-----END RSA PRIVATE KEY----- diff --git a/example/nebula-test-ssl.js b/example/nebula-test-ssl.js new file mode 100644 index 0000000..b8b2ad7 --- /dev/null +++ b/example/nebula-test-ssl.js @@ -0,0 +1,47 @@ +import nebulaPool from 'k6/x/nebulagraph'; +import { check } from 'k6'; +import { Trend } from 'k6/metrics'; +import { sleep } from 'k6'; + +var lantencyTrend = new Trend('latency'); +var responseTrend = new Trend('responseTime'); +// initial nebula connect pool +nebulaPool.newSSLConfig("cert/test.ca.pem", "cert/test.derive.crt", "cert/test.derive.key") +var pool = nebulaPool.init("192.168.15.7:10004", 400); +// initial session for every vu +var session = pool.getSession("root", "nebula") +session.execute("USE ldbc") +// export let options = { +// stages: [ +// { duration: '2s', target: 20 }, +// { duration: '2m', target: 20 }, +// { duration: '1m', target: 0 }, +// ], +// }; + +export function setup() { + // config csv file + pool.configCSV("person.csv", "|", false) + // config output file, save every query information + pool.configOutput("output.csv") + sleep(1) +} + +export default function (data) { + // get csv data from csv file + let d = session.getData() + // d[0] means the first column data in the csv file + let ngql = 'go 2 steps from ' + d[0] + ' over KNOWS ' + let response = session.execute(ngql) + check(response, { + "IsSucceed": (r) => r.isSucceed() === true + }); + // add trend + lantencyTrend.add(response.getLatency()); + responseTrend.add(response.getResponseTime()); + +}; + +export function teardown() { + pool.close() +} diff --git a/go.mod b/go.mod index 319b929..e31ea75 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,6 @@ module github.com/vesoft-inc/k6-plugin go 1.16 require ( - github.com/vesoft-inc/nebula-go/v2 v2.5.2-0.20211223072708-423659a022a3 + github.com/vesoft-inc/nebula-go/v2 v2.5.2-0.20211227113225-86a2cfc48475 go.k6.io/k6 v0.33.0 ) diff --git a/go.sum b/go.sum index 438a96f..a81eae2 100644 --- a/go.sum +++ b/go.sum @@ -324,8 +324,8 @@ github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLY github.com/urfave/negroni v0.3.1-0.20180130044549-22c5532ea862/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v0.0.0-20170224212429-dcecefd839c4/go.mod h1:50wTf68f99/Zt14pr046Tgt3Lp2vLyFZKzbFXTOabXw= -github.com/vesoft-inc/nebula-go/v2 v2.5.2-0.20211223072708-423659a022a3 h1:ccWeKTZoyH9S1E81ApPHFomfPseEDTzvgpgOHzlJiz8= -github.com/vesoft-inc/nebula-go/v2 v2.5.2-0.20211223072708-423659a022a3/go.mod h1:fehDUs97/mpmxXi9WezhznX0Dg7hmQRUoOWgDZv9zG0= +github.com/vesoft-inc/nebula-go/v2 v2.5.2-0.20211227113225-86a2cfc48475 h1:KhmJlYhQiPN3SrF6xhJpBwNf1ebPG5UV0Ii7LqyoMqs= +github.com/vesoft-inc/nebula-go/v2 v2.5.2-0.20211227113225-86a2cfc48475/go.mod h1:fehDUs97/mpmxXi9WezhznX0Dg7hmQRUoOWgDZv9zG0= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= From 429e9ef40f155e070d4261be0d89774ddf186a4f Mon Sep 17 00:00:00 2001 From: HarrisChu <1726587+HarrisChu@users.noreply.github.com> Date: Tue, 28 Dec 2021 16:10:17 +0800 Subject: [PATCH 2/2] change example --- example/nebula-test-ssl.js | 14 +++++++------- example/nebula-test.js | 7 ------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/example/nebula-test-ssl.js b/example/nebula-test-ssl.js index b8b2ad7..5288fcd 100644 --- a/example/nebula-test-ssl.js +++ b/example/nebula-test-ssl.js @@ -11,13 +11,13 @@ var pool = nebulaPool.init("192.168.15.7:10004", 400); // initial session for every vu var session = pool.getSession("root", "nebula") session.execute("USE ldbc") -// export let options = { -// stages: [ -// { duration: '2s', target: 20 }, -// { duration: '2m', target: 20 }, -// { duration: '1m', target: 0 }, -// ], -// }; +export let options = { + stages: [ + { duration: '2s', target: 20 }, + { duration: '2m', target: 20 }, + { duration: '1m', target: 0 }, + ], +}; export function setup() { // config csv file diff --git a/example/nebula-test.js b/example/nebula-test.js index afc15e7..8a981f0 100644 --- a/example/nebula-test.js +++ b/example/nebula-test.js @@ -10,13 +10,6 @@ var pool = nebulaPool.init("192.168.8.152:9669", 400); // initial session for every vu var session = pool.getSession("root", "nebula") session.execute("USE ldbc") -// export let options = { -// stages: [ -// { duration: '2s', target: 20 }, -// { duration: '2m', target: 20 }, -// { duration: '1m', target: 0 }, -// ], -// }; export function setup() { // config csv file