misc: refactor loop tests to use require where possible

This commit is contained in:
Andras Banki-Horvath 2022-11-29 21:36:14 +01:00
parent bdb4b773ed
commit 049b17ff96
No known key found for this signature in database
GPG key ID: 80E5375C094198D8
10 changed files with 100 additions and 193 deletions

View file

@ -140,9 +140,8 @@ func (ctx *testContext) finish() {
ctx.stop()
select {
case err := <-ctx.runErr:
if err != nil {
ctx.T.Fatal(err)
}
require.NoError(ctx.T, err)
case <-time.After(test.Timeout):
ctx.T.Fatal("client not stopping")
}
@ -156,19 +155,12 @@ func (ctx *testContext) finish() {
func (ctx *testContext) notifyHeight(height int32) {
ctx.T.Helper()
if err := ctx.Lnd.NotifyHeight(height); err != nil {
ctx.T.Fatal(err)
}
require.NoError(ctx.T, ctx.Lnd.NotifyHeight(height))
}
func (ctx *testContext) assertIsDone() {
if err := ctx.Lnd.IsDone(); err != nil {
ctx.T.Fatal(err)
}
if err := ctx.store.isDone(); err != nil {
ctx.T.Fatal(err)
}
require.NoError(ctx.T, ctx.Lnd.IsDone())
require.NoError(ctx.T, ctx.store.isDone())
select {
case <-ctx.statusChan: