(t *testing.T)
| 250 | } |
| 251 | |
| 252 | func TestFullProcess(t *testing.T) { |
| 253 | log.SetLevel(log.DebugLevel) |
| 254 | |
| 255 | Convey("test full process", t, func() { |
| 256 | var ( |
| 257 | err error |
| 258 | cliPriv, obPriv *asymmetric.PrivateKey |
| 259 | addr, addr2 proto.AccountAddress |
| 260 | dbAddr, dbAddr2, obAddr, cliAddr proto.AccountAddress |
| 261 | dsn, dsn2 string |
| 262 | cfg, cfg2 *client.Config |
| 263 | dbID, dbID2 proto.DatabaseID |
| 264 | nonce interfaces.AccountNonce |
| 265 | ctx1, ctx2, ctx3, ctx4, ctx5 context.Context |
| 266 | ccl1, ccl2, ccl3, ccl4, ccl5 context.CancelFunc |
| 267 | ) |
| 268 | startNodes() |
| 269 | defer stopNodes() |
| 270 | |
| 271 | err = client.Init(FJ(testWorkingDir, "./observation/node_c/config.yaml"), []byte("")) |
| 272 | So(err, ShouldBeNil) |
| 273 | |
| 274 | // get miner addresses |
| 275 | cliPriv, cliAddr, err = privKeyStoreToAccountAddr( |
| 276 | FJ(testWorkingDir, "./observation/node_c/private.key"), []byte{}) |
| 277 | So(err, ShouldBeNil) |
| 278 | _, addr, err = privKeyStoreToAccountAddr( |
| 279 | FJ(testWorkingDir, "./observation/node_miner_0/private.key"), []byte{}) |
| 280 | So(err, ShouldBeNil) |
| 281 | _, addr2, err = privKeyStoreToAccountAddr( |
| 282 | FJ(testWorkingDir, "./observation/node_miner_1/private.key"), []byte{}) |
| 283 | So(err, ShouldBeNil) |
| 284 | obPriv, obAddr, err = privKeyStoreToAccountAddr( |
| 285 | FJ(testWorkingDir, "./observation/node_observer/private.key"), []byte{}) |
| 286 | So(err, ShouldBeNil) |
| 287 | |
| 288 | // wait until bp chain service is ready |
| 289 | ctx1, ccl1 = context.WithTimeout(context.Background(), 1*time.Minute) |
| 290 | defer ccl1() |
| 291 | err = test.WaitBPChainService(ctx1, 3*time.Second) |
| 292 | So(err, ShouldBeNil) |
| 293 | |
| 294 | // create |
| 295 | _, dsn, err = test.Create(types.ResourceMeta{ |
| 296 | TargetMiners: []proto.AccountAddress{addr}, |
| 297 | Node: 1, |
| 298 | }, 1, 10000000, cliPriv) |
| 299 | So(err, ShouldBeNil) |
| 300 | log.Infof("the created database dsn is %v", dsn) |
| 301 | |
| 302 | db, err := sql.Open("covenantsql", dsn) |
| 303 | So(err, ShouldBeNil) |
| 304 | |
| 305 | // wait |
| 306 | cfg, err = client.ParseDSN(dsn) |
| 307 | So(err, ShouldBeNil) |
| 308 | dbID = proto.DatabaseID(cfg.DatabaseID) |
| 309 | dbAddr, err = dbID.AccountAddress() |
nothing calls this directly
no test coverage detected