From 9470ea3032a00438504e3769a65212fe22165717 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Thu, 22 Apr 2021 16:48:54 +0200 Subject: [PATCH] pytest: Fix racy `test_unreachable_routehint` It was failing likely because we were racing on the log processing. Using `wait_for_log` instead should address that. --- tests/test_pay.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/test_pay.py b/tests/test_pay.py index 69f09d2b4f3b..47a725d12905 100644 --- a/tests/test_pay.py +++ b/tests/test_pay.py @@ -4210,11 +4210,11 @@ def test_unreachable_routehint(node_factory, bitcoind): with pytest.raises(RpcError, match=r'Destination [a-f0-9]{66} is not reachable'): l1.rpc.pay(invoice) - assert(l1.daemon.is_in_log( + l1.daemon.wait_for_log( r"Removed routehint 0 because entrypoint {entrypoint} is unknown.".format( entrypoint=entrypoint ) - )) + ) # Now connect l2 to l3 to create a bridge, but without a # channel. The entrypoint will become known, but still @@ -4225,11 +4225,13 @@ def test_unreachable_routehint(node_factory, bitcoind): with pytest.raises(RpcError, match=r'Destination [a-f0-9]{66} is not reachable') as excinfo: l1.rpc.pay(invoice) - assert(l1.daemon.is_in_log( + + # Verify that we failed for the correct reason. + l1.daemon.wait_for_log( r"Removed routehint 0 because entrypoint {entrypoint} is unreachable.".format( entrypoint=entrypoint ) - )) + ) # Since we aborted once we realized the destination is unreachable # both directly, and via the routehints we should now just have a