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

Function BenchmarkRuntime

kayak/runtime_test.go:554–737  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

552}
553
554func BenchmarkRuntime(b *testing.B) {
555 Convey("runtime test", b, func(c C) {
556 log.SetLevel(log.FatalLevel)
557 f, err := os.OpenFile("test.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0600)
558 So(err, ShouldBeNil)
559 log.SetOutput(f)
560 defer f.Close()
561
562 db1, err := newSQLiteStorage("test1.db")
563 So(err, ShouldBeNil)
564 defer func() {
565 db1.Close()
566 os.Remove("test1.db")
567 }()
568 db2, err := newSQLiteStorage("test2.db")
569 So(err, ShouldBeNil)
570 defer func() {
571 db2.Close()
572 os.Remove("test2.db")
573 }()
574
575 node1 := proto.NodeID("000005aa62048f85da4ae9698ed59c14ec0d48a88a07c15a32265634e7e64ade")
576 node2 := proto.NodeID("000005f4f22c06f76c43c4f48d5a7ec1309cc94030cbf9ebae814172884ac8b5")
577
578 peers := &proto.Peers{
579 PeersHeader: proto.PeersHeader{
580 Leader: node1,
581 Servers: []proto.NodeID{
582 node1,
583 node2,
584 },
585 },
586 }
587
588 privKey, _, err := asymmetric.GenSecp256k1KeyPair()
589 So(err, ShouldBeNil)
590 err = peers.Sign(privKey)
591 So(err, ShouldBeNil)
592
593 wal1 := kl.NewMemWal()
594 defer wal1.Close()
595 cfg1 := &kt.RuntimeConfig{
596 Handler: db1,
597 PrepareThreshold: 1.0,
598 CommitThreshold: 0.0,
599 PrepareTimeout: time.Second,
600 CommitTimeout: 10 * time.Second,
601 LogWaitTimeout: 10 * time.Second,
602 Peers: peers,
603 Wal: wal1,
604 NodeID: node1,
605 ServiceName: "Test",
606 ApplyMethodName: "Apply",
607 }
608 rt1, err := kayak.NewRuntime(cfg1)
609 So(err, ShouldBeNil)
610
611 wal2 := kl.NewMemWal()

Callers

nothing calls this directly

Calls 15

SignMethod · 0.95
CloseMethod · 0.95
StartMethod · 0.95
ShutdownMethod · 0.95
ApplyMethod · 0.95
SetLevelFunction · 0.92
SetOutputFunction · 0.92
NodeIDTypeAlias · 0.92
GenSecp256k1KeyPairFunction · 0.92
NewRuntimeFunction · 0.92
newSQLiteStorageFunction · 0.85
newFakeMuxFunction · 0.85

Tested by

no test coverage detected