(b *testing.B)
| 232 | } |
| 233 | |
| 234 | func 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 |
nothing calls this directly
no test coverage detected