mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
This failure became normal recently:
=== RUN TestAutoLoopInEnabled
autoloop_testcontext_test.go:318:
Error Trace: /home/runner/work/loop/loop/liquidity/autoloop_testcontext_test.go:318
/home/runner/work/loop/loop/liquidity/autoloop_test.go:804
Error: Not equal:
expected: 80000
actual : 160000
Test: TestAutoLoopInEnabled
autoloop_testcontext_test.go:318:
Error Trace: /home/runner/work/loop/loop/liquidity/autoloop_testcontext_test.go:318
/home/runner/work/loop/loop/liquidity/autoloop_test.go:804
Error: Not equal:
expected: 160000
actual : 80000
Test: TestAutoLoopInEnabled
autoloop_testcontext_test.go:343:
Error Trace: /home/runner/work/loop/loop/liquidity/autoloop_testcontext_test.go:343
/home/runner/work/loop/loop/liquidity/autoloop_test.go:804
Error: Should be true
Test: TestAutoLoopInEnabled
The root cause is them the order of items in c.quoteRequestIn depends on the
order of loopInBuilder.buildSwap calls, which depends on the order of channel
handling in Manager.SuggestSwaps, which depends on the order of map traversal,
which is not determitistic.
Since in the test all the amounts are different, I used amount as a key and
put the expected calls into a map using amount as a key. When I extract an
item from c.quoteRequestIn channel, I find the corresponding item in the map
and remove it. All other logic is preserved.
|
||
|---|---|---|
| .. | ||
| autoloop_test.go | ||
| autoloop_testcontext_test.go | ||
| balances.go | ||
| fees.go | ||
| interface.go | ||
| liquidity.go | ||
| liquidity_test.go | ||
| log.go | ||
| loopin.go | ||
| loopin_builder.go | ||
| loopin_builder_test.go | ||
| loopout.go | ||
| loopout_builder.go | ||
| mock.go | ||
| parameters.go | ||
| parameters_test.go | ||
| reasons.go | ||
| restrictions.go | ||
| threshold_rule.go | ||
| threshold_rule_test.go | ||