mirror of
https://github.com/ACINQ/eclair.git
synced 2024-11-20 02:27:32 +01:00
Fix random trampoline test failure (#1318)
Writing the PaymentRelayed event to the DB is not atomic. Each part is written independently of the others (one row per part). This is fine as nothing relies on this event being written atomically. However tests were expecting that and we would observe rare test failures on travis.
This commit is contained in:
parent
8afc00d02f
commit
7490bf3222
@ -587,7 +587,10 @@ class IntegrationSpec extends TestKit(ActorSystem("test")) with BitcoindService
|
||||
val Some(IncomingPayment(_, _, _, _, IncomingPaymentStatus.Received(receivedAmount, _))) = nodes("F3").nodeParams.db.payments.getIncomingPayment(pr.paymentHash)
|
||||
assert(receivedAmount === amount)
|
||||
|
||||
awaitCond(nodes("G").nodeParams.db.audit.listRelayed(start, Platform.currentTime).exists(_.paymentHash == pr.paymentHash))
|
||||
awaitCond({
|
||||
val relayed = nodes("G").nodeParams.db.audit.listRelayed(start, Platform.currentTime).filter(_.paymentHash == pr.paymentHash)
|
||||
relayed.nonEmpty && relayed.head.amountOut >= amount
|
||||
})
|
||||
val relayed = nodes("G").nodeParams.db.audit.listRelayed(start, Platform.currentTime).filter(_.paymentHash == pr.paymentHash).head
|
||||
assert(relayed.amountIn - relayed.amountOut > 0.msat, relayed)
|
||||
assert(relayed.amountIn - relayed.amountOut < 1000000.msat, relayed)
|
||||
@ -623,7 +626,10 @@ class IntegrationSpec extends TestKit(ActorSystem("test")) with BitcoindService
|
||||
val Some(IncomingPayment(_, _, _, _, IncomingPaymentStatus.Received(receivedAmount, _))) = nodes("B").nodeParams.db.payments.getIncomingPayment(pr.paymentHash)
|
||||
assert(receivedAmount === amount)
|
||||
|
||||
awaitCond(nodes("C").nodeParams.db.audit.listRelayed(start, Platform.currentTime).exists(_.paymentHash == pr.paymentHash))
|
||||
awaitCond({
|
||||
val relayed = nodes("C").nodeParams.db.audit.listRelayed(start, Platform.currentTime).filter(_.paymentHash == pr.paymentHash)
|
||||
relayed.nonEmpty && relayed.head.amountOut >= amount
|
||||
})
|
||||
val relayed = nodes("C").nodeParams.db.audit.listRelayed(start, Platform.currentTime).filter(_.paymentHash == pr.paymentHash).head
|
||||
assert(relayed.amountIn - relayed.amountOut > 0.msat, relayed)
|
||||
assert(relayed.amountIn - relayed.amountOut < 300000.msat, relayed)
|
||||
@ -668,7 +674,10 @@ class IntegrationSpec extends TestKit(ActorSystem("test")) with BitcoindService
|
||||
val Some(IncomingPayment(_, _, _, _, IncomingPaymentStatus.Received(receivedAmount, _))) = nodes("A").nodeParams.db.payments.getIncomingPayment(pr.paymentHash)
|
||||
assert(receivedAmount === amount)
|
||||
|
||||
awaitCond(nodes("C").nodeParams.db.audit.listRelayed(start, Platform.currentTime).exists(_.paymentHash == pr.paymentHash))
|
||||
awaitCond({
|
||||
val relayed = nodes("C").nodeParams.db.audit.listRelayed(start, Platform.currentTime).filter(_.paymentHash == pr.paymentHash)
|
||||
relayed.nonEmpty && relayed.head.amountOut >= amount
|
||||
})
|
||||
val relayed = nodes("C").nodeParams.db.audit.listRelayed(start, Platform.currentTime).filter(_.paymentHash == pr.paymentHash).head
|
||||
assert(relayed.amountIn - relayed.amountOut > 0.msat, relayed)
|
||||
assert(relayed.amountIn - relayed.amountOut < 1000000.msat, relayed)
|
||||
|
Loading…
Reference in New Issue
Block a user