2
0
mirror of https://github.com/lightninglabs/loop synced 2024-11-08 01:10:29 +00:00

Merge pull request #596 from GeorgeTsagk/autoloop-false-positive-check

liquidity: add false-positive checks on autoloop tests
This commit is contained in:
George Tsagkarelis 2023-06-14 16:35:03 +03:00 committed by GitHub
commit 0be05a99cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -344,6 +344,24 @@ func (c *autoloopTestCtx) autoloop(step *autoloopStep) {
return c.manager.numActiveStickyLoops() == 0
}, defaultEventuallyTimeout, defaultEventuallyInterval, "failed to"+
" wait for sticky loop counter")
// Since we're checking if any false-positive swaps were dispatched we
// need to give some time to autoloop to possibly dispatch them.
select {
case <-c.outRequest:
c.t.Fatal("expected no more loopout requests")
case <-c.inRequest:
c.t.Fatal("expected no more loopin requests")
case <-c.quoteRequestIn:
c.t.Fatal("expected no more loopout quote requests")
case <-c.quoteRequest:
c.t.Fatal("expected no more loopin quote requests")
case <-time.After(500 * time.Millisecond):
}
}
// easyautoloop walks our test context through the process of triggering our
@ -383,6 +401,24 @@ func (c *autoloopTestCtx) easyautoloop(step *easyAutoloopStep, noop bool) {
actual.OutgoingChanSet,
)
}
// Since we're checking if any false-positive swaps were dispatched we
// need to give some time to autoloop to possibly dispatch them.
select {
case <-c.outRequest:
c.t.Fatal("expected no more loopout requests")
case <-c.inRequest:
c.t.Fatal("expected no more loopin requests")
case <-c.quoteRequestIn:
c.t.Fatal("expected no more loopout quote requests")
case <-c.quoteRequest:
c.t.Fatal("expected no more loopin quote requests")
case <-time.After(500 * time.Millisecond):
}
}
// matchLoopOuts checks that the actual loop out requests we got match the