(t *testing.T)
| 37 | ) |
| 38 | |
| 39 | func TestInit(t *testing.T) { |
| 40 | log.SetLevel(log.DebugLevel) |
| 41 | // test init |
| 42 | Convey("test init", t, func() { |
| 43 | var stopTestService func() |
| 44 | var confDir string |
| 45 | var err error |
| 46 | |
| 47 | stopTestService, confDir, err = startTestService() |
| 48 | log.Debugf("config dir: %s", confDir) |
| 49 | So(err, ShouldBeNil) |
| 50 | defer stopTestService() |
| 51 | |
| 52 | // already init ed |
| 53 | err = Init(filepath.Join(confDir, "config.yaml"), []byte("")) |
| 54 | So(err, ShouldNotBeNil) |
| 55 | |
| 56 | // fake driver not initialized |
| 57 | atomic.StoreUint32(&driverInitialized, 0) |
| 58 | err = Init(filepath.Join(confDir, "config.yaml"), []byte("")) |
| 59 | So(err, ShouldBeNil) |
| 60 | |
| 61 | // test loaded block producer nodes |
| 62 | bps := route.GetBPs() |
| 63 | So(len(bps), ShouldBeGreaterThanOrEqualTo, 1) |
| 64 | //So(bps[0].ToRawNodeID().ToNodeID(), ShouldResemble, (*conf.GConf.KnownNodes)[0].ID) |
| 65 | |
| 66 | stopPeersUpdater() |
| 67 | }) |
| 68 | } |
| 69 | |
| 70 | func TestDefaultInit(t *testing.T) { |
| 71 | log.SetLevel(log.DebugLevel) |
nothing calls this directly
no test coverage detected