(t *testing.T)
| 335 | } |
| 336 | |
| 337 | func TestRunPeerListUpdater(t *testing.T) { |
| 338 | Convey("test peersUpdaterRunning", t, func() { |
| 339 | var stopTestService func() |
| 340 | var err error |
| 341 | |
| 342 | err = runPeerListUpdater() |
| 343 | So(err, ShouldNotBeNil) |
| 344 | |
| 345 | stopTestService, _, err = startTestService() |
| 346 | So(err, ShouldBeNil) |
| 347 | defer stopTestService() |
| 348 | |
| 349 | // normal case |
| 350 | err = runPeerListUpdater() |
| 351 | So(err, ShouldBeNil) |
| 352 | |
| 353 | // only one goroutine will be started |
| 354 | err = runPeerListUpdater() |
| 355 | So(err, ShouldBeNil) |
| 356 | |
| 357 | var priv *asymmetric.PrivateKey |
| 358 | priv, err = kms.GetLocalPrivateKey() |
| 359 | So(err, ShouldBeNil) |
| 360 | dbID := proto.DatabaseID("db") |
| 361 | |
| 362 | _, err = getPeers(dbID, priv) |
| 363 | So(err, ShouldBeNil) |
| 364 | |
| 365 | time.Sleep(1 * time.Second) |
| 366 | stopPeersUpdater() |
| 367 | }) |
| 368 | } |
nothing calls this directly
no test coverage detected