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

Function TestFullProcess

cmd/cql-minerd/integration_test.go:368–642  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

366}
367
368func TestFullProcess(t *testing.T) {
369 log.SetLevel(log.DebugLevel)
370
371 Convey("test full process", t, func(c C) {
372 startNodes()
373 defer stopNodes()
374 var err error
375
376 time.Sleep(10 * time.Second)
377
378 So(err, ShouldBeNil)
379
380 err = client.Init(FJ(testWorkingDir, "./integration/node_c/config.yaml"), []byte(""))
381 So(err, ShouldBeNil)
382
383 var (
384 clientPrivKey *asymmetric.PrivateKey
385 clientAddr proto.AccountAddress
386
387 minersPrivKeys = make([]*asymmetric.PrivateKey, 3)
388 minersAddrs = make([]proto.AccountAddress, 3)
389 )
390
391 // get miners' private keys
392 minersPrivKeys[0], err = kms.LoadPrivateKey(FJ(testWorkingDir, "./integration/node_miner_0/private.key"), []byte{})
393 So(err, ShouldBeNil)
394 minersPrivKeys[1], err = kms.LoadPrivateKey(FJ(testWorkingDir, "./integration/node_miner_1/private.key"), []byte{})
395 So(err, ShouldBeNil)
396 minersPrivKeys[2], err = kms.LoadPrivateKey(FJ(testWorkingDir, "./integration/node_miner_2/private.key"), []byte{})
397 So(err, ShouldBeNil)
398 clientPrivKey, err = kms.LoadPrivateKey(FJ(testWorkingDir, "./integration/node_c/private.key"), []byte{})
399 So(err, ShouldBeNil)
400
401 // get miners' addr
402 minersAddrs[0], err = crypto.PubKeyHash(minersPrivKeys[0].PubKey())
403 So(err, ShouldBeNil)
404 minersAddrs[1], err = crypto.PubKeyHash(minersPrivKeys[1].PubKey())
405 So(err, ShouldBeNil)
406 minersAddrs[2], err = crypto.PubKeyHash(minersPrivKeys[2].PubKey())
407 So(err, ShouldBeNil)
408 clientAddr, err = crypto.PubKeyHash(clientPrivKey.PubKey())
409 So(err, ShouldBeNil)
410
411 // client send create database transaction
412 meta := client.ResourceMeta{
413 TargetMiners: minersAddrs,
414 Node: uint16(len(minersAddrs)),
415 IsolationLevel: int(sql.LevelReadUncommitted),
416 GasPrice: testGasPrice,
417 AdvancePayment: testAdvancePayment,
418 }
419 // wait for chain service
420 var ctx1, cancel1 = context.WithTimeout(context.Background(), 1*time.Minute)
421 defer cancel1()
422 err = test.WaitBPChainService(ctx1, 3*time.Second)
423 if err != nil {
424 t.Fatalf("wait for chain service failed: %v", err)
425 }

Callers

nothing calls this directly

Calls 15

SetLevelFunction · 0.92
InitFunction · 0.92
LoadPrivateKeyFunction · 0.92
PubKeyHashFunction · 0.92
WaitBPChainServiceFunction · 0.92
CreateFunction · 0.92
ParseDSNFunction · 0.92
InfofFunction · 0.92
WaitDBCreationFunction · 0.92
DatabaseIDTypeAlias · 0.92
PubKeyMethod · 0.80
FatalfMethod · 0.80

Tested by

no test coverage detected