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

Function TestRuntime

kayak/runtime_test.go:232–552  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

230}
231
232func TestRuntime(t *testing.T) {
233 Convey("runtime test", t, func(c C) {
234 lvl := log.GetLevel()
235 log.SetLevel(log.DebugLevel)
236 defer log.SetLevel(lvl)
237
238 db1, err := newSQLiteStorage("test1.db")
239 So(err, ShouldBeNil)
240 defer func() {
241 db1.Close()
242 os.Remove("test1.db")
243 }()
244 db2, err := newSQLiteStorage("test2.db")
245 So(err, ShouldBeNil)
246 defer func() {
247 db2.Close()
248 os.Remove("test2.db")
249 }()
250
251 node1 := proto.NodeID("000005aa62048f85da4ae9698ed59c14ec0d48a88a07c15a32265634e7e64ade")
252 node2 := proto.NodeID("000005f4f22c06f76c43c4f48d5a7ec1309cc94030cbf9ebae814172884ac8b5")
253
254 peers := &proto.Peers{
255 PeersHeader: proto.PeersHeader{
256 Leader: node1,
257 Servers: []proto.NodeID{
258 node1,
259 node2,
260 },
261 },
262 }
263
264 privKey, _, err := asymmetric.GenSecp256k1KeyPair()
265 So(err, ShouldBeNil)
266 err = peers.Sign(privKey)
267 So(err, ShouldBeNil)
268
269 wal1 := kl.NewMemWal()
270 defer wal1.Close()
271 cfg1 := &kt.RuntimeConfig{
272 Handler: db1,
273 PrepareThreshold: 1.0,
274 CommitThreshold: 1.0,
275 PrepareTimeout: time.Second,
276 CommitTimeout: 10 * time.Second,
277 LogWaitTimeout: 10 * time.Second,
278 Peers: peers,
279 Wal: wal1,
280 NodeID: node1,
281 ServiceName: "Test",
282 ApplyMethodName: "Apply",
283 }
284 rt1, err := kayak.NewRuntime(cfg1)
285 So(err, ShouldBeNil)
286
287 wal2 := kl.NewMemWal()
288 defer wal2.Close()
289 cfg2 := &kt.RuntimeConfig{

Callers

nothing calls this directly

Calls 15

SignMethod · 0.95
CloseMethod · 0.95
StartMethod · 0.95
ShutdownMethod · 0.95
ApplyMethod · 0.95
WriteMethod · 0.95
CloseMethod · 0.95
GetLevelFunction · 0.92
SetLevelFunction · 0.92
NodeIDTypeAlias · 0.92
GenSecp256k1KeyPairFunction · 0.92
NewRuntimeFunction · 0.92

Tested by

no test coverage detected