Skip to content

Commit 97393b1

Browse files
authored
Fix race condition in 'stream updates to front' test (#1978)
As usual, the race condition is due to a delay before subscribing to the event stream.
1 parent 6dc836d commit 97393b1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

eclair-core/src/test/scala/fr/acinq/eclair/router/RouterSpec.scala

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,11 +681,20 @@ class RouterSpec extends BaseRouterSpec {
681681
}
682682
assert(nodes.size === 8 && channels.size === 5 && updates.size === 10) // public channels only
683683

684+
// just making sure that we have been subscribed to network events, otherwise there is a possible race condition
685+
awaitCond({
686+
system.eventStream.publish(SyncProgress(42))
687+
sender.msgAvailable
688+
}, max = 30 seconds)
689+
684690
// new announcements
685691
val update_ab_2 = makeChannelUpdate(Block.RegtestGenesisBlock.hash, priv_a, b, channelId_ab, CltvExpiryDelta(7), htlcMinimumMsat = 0 msat, feeBaseMsat = 10 msat, feeProportionalMillionths = 10, htlcMaximumMsat = htlcMaximum, timestamp = update_ab.timestamp + 1)
686692
val peerConnection = TestProbe()
687693
router ! PeerRoutingMessage(peerConnection.ref, remoteNodeId, update_ab_2)
688-
sender.expectMsg(ChannelUpdatesReceived(List(update_ab_2)))
694+
sender.fishForMessage() {
695+
case cu: ChannelUpdatesReceived => cu == ChannelUpdatesReceived(List(update_ab_2))
696+
case _ => false
697+
}
689698
}
690699

691700
}

0 commit comments

Comments
 (0)