Skip to content

Commit 0be05a9

Browse files
authored
Merge pull request #596 from GeorgeTsagk/autoloop-false-positive-check
liquidity: add false-positive checks on autoloop tests
2 parents 9847f3a + afca558 commit 0be05a9

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

liquidity/autoloop_testcontext_test.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,24 @@ func (c *autoloopTestCtx) autoloop(step *autoloopStep) {
344344
return c.manager.numActiveStickyLoops() == 0
345345
}, defaultEventuallyTimeout, defaultEventuallyInterval, "failed to"+
346346
" wait for sticky loop counter")
347+
348+
// Since we're checking if any false-positive swaps were dispatched we
349+
// need to give some time to autoloop to possibly dispatch them.
350+
select {
351+
case <-c.outRequest:
352+
c.t.Fatal("expected no more loopout requests")
353+
354+
case <-c.inRequest:
355+
c.t.Fatal("expected no more loopin requests")
356+
357+
case <-c.quoteRequestIn:
358+
c.t.Fatal("expected no more loopout quote requests")
359+
360+
case <-c.quoteRequest:
361+
c.t.Fatal("expected no more loopin quote requests")
362+
363+
case <-time.After(500 * time.Millisecond):
364+
}
347365
}
348366

349367
// easyautoloop walks our test context through the process of triggering our
@@ -383,6 +401,24 @@ func (c *autoloopTestCtx) easyautoloop(step *easyAutoloopStep, noop bool) {
383401
actual.OutgoingChanSet,
384402
)
385403
}
404+
405+
// Since we're checking if any false-positive swaps were dispatched we
406+
// need to give some time to autoloop to possibly dispatch them.
407+
select {
408+
case <-c.outRequest:
409+
c.t.Fatal("expected no more loopout requests")
410+
411+
case <-c.inRequest:
412+
c.t.Fatal("expected no more loopin requests")
413+
414+
case <-c.quoteRequestIn:
415+
c.t.Fatal("expected no more loopout quote requests")
416+
417+
case <-c.quoteRequest:
418+
c.t.Fatal("expected no more loopin quote requests")
419+
420+
case <-time.After(500 * time.Millisecond):
421+
}
386422
}
387423

388424
// matchLoopOuts checks that the actual loop out requests we got match the

0 commit comments

Comments
 (0)