MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / BenchmarkKVServer_GetAllNodeInfo

Function BenchmarkKVServer_GetAllNodeInfo

cmd/cqld/bench_test.go:234–350  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

232}
233
234func BenchmarkKVServer_GetAllNodeInfo(b *testing.B) {
235 log.SetLevel(log.DebugLevel)
236 start3BPs()
237
238 time.Sleep(5 * time.Second)
239
240 var err error
241 conf.GConf, err = conf.LoadConfig(FJ(testWorkingDir, "./node_c/config.yaml"))
242 if err != nil {
243 log.Fatalf("load config from %s failed: %s", configFile, err)
244 }
245 kms.InitBP()
246 log.Debugf("config:\n%#v", conf.GConf)
247 conf.GConf.GenerateKeyPair = false
248
249 nodeID := conf.GConf.ThisNodeID
250
251 var idx int
252 for i, n := range conf.GConf.KnownNodes {
253 if n.ID == nodeID {
254 idx = i
255 break
256 }
257 }
258
259 rootPath := conf.GConf.WorkingRoot
260 pubKeyStorePath := filepath.Join(rootPath, conf.GConf.PubKeyStoreFile)
261 privateKeyPath := filepath.Join(rootPath, conf.GConf.PrivateKeyFile)
262
263 // read master key
264 var masterKey []byte
265
266 err = kms.InitLocalKeyPair(privateKeyPath, masterKey)
267 if err != nil {
268 log.WithError(err).Error("init local key pair failed")
269 return
270 }
271
272 conf.GConf.KnownNodes[idx].PublicKey, err = kms.GetLocalPublicKey()
273 if err != nil {
274 log.WithError(err).Error("get local public key failed")
275 return
276 }
277
278 // init nodes
279 log.Info("init peers")
280 _, _, _, err = initNodePeers(nodeID, pubKeyStorePath)
281 if err != nil {
282 return
283 }
284
285 //connPool := rpc.newSessionPool(rpc.DefaultDialer)
286 //// do client request
287 //if err = clientRequest(connPool, clientOperation, ""); err != nil {
288 // return
289 //}
290
291 leaderNodeID := kms.BP.NodeID

Callers

nothing calls this directly

Calls 15

InitNodeCryptoInfoMethod · 0.95
CallMethod · 0.95
SetLevelFunction · 0.92
LoadConfigFunction · 0.92
FatalfFunction · 0.92
InitBPFunction · 0.92
DebugfFunction · 0.92
InitLocalKeyPairFunction · 0.92
WithErrorFunction · 0.92
GetLocalPublicKeyFunction · 0.92
InfoFunction · 0.92
DialToNodeWithPoolFunction · 0.92

Tested by

no test coverage detected