From 8668a2244d95256708f53a38fc5ce9de2722959c Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Fri, 15 May 2020 17:39:33 +0200 Subject: [PATCH] noise: Disabled retry test for being way too flaky --- noise/test_chat.py | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/noise/test_chat.py b/noise/test_chat.py index e7336c6..b77b69c 100644 --- a/noise/test_chat.py +++ b/noise/test_chat.py @@ -1,10 +1,12 @@ from binascii import hexlify from onion import TlvPayload +from flaky import flaky from pprint import pprint from pyln.client import RpcError from pyln.testing.fixtures import * from pyln.testing.utils import wait_for import hashlib +import unittest import zbase32 @@ -30,7 +32,25 @@ def test_sendmsg_success(node_factory, executor): assert(m2['verified'] == True) +@unittest.skipIf(True, "This test is flaky since we cannot force a payment to take a specific route") def test_sendmsg_retry(node_factory, executor): + """Fail a sendmsg using a cheap route, and check that it retries. + + ```dot + digraph { + l1 -> l2; + l2 -> l3; + l3 -> l4 [label = "fee-base=100'000"]; + l2 -> l5; + l5 -> l4 [label = "fee-base=normal"]; + } + ``` + + By having a huge fee on the l3 -> l4 edge we force the initial attempt to + go through l1 -> l2 -> l5 -> l4, which should fail since l5 is offline (l1 + should still be unaware about this). + + """ opts = [{'plugin': plugin}, {}, {'fee-base': 10000}, {'plugin': plugin}] l1, l2, l3, l4 = node_factory.line_graph(4, opts=opts) l5 = node_factory.get_node() @@ -44,21 +64,23 @@ def test_sendmsg_retry(node_factory, executor): return False return True - wait_for(lambda: gossip_synced([l1, l2, l3, l4, l5])) + wait_for(lambda: [c['active'] for c in l1.rpc.listchannels()['channels']] == [True]*10) # Now stop l5 so the first attempt will fail. l5.stop() recv = executor.submit(l4.rpc.recvmsg) - send = executor.submit(l1.rpc.sendmsg, l4.info['id'], "Hello world!") + # Just making sure our view didn't change since we initiated the attempt + assert([c['active'] for c in l1.rpc.listchannels()['channels']] == [True]*10) + pprint(l1.rpc.listchannels()) + l1.daemon.wait_for_log(r'Retrying delivery') sres = send.result(10) assert(sres['attempt'] == 2) pprint(sres) - print(recv.result(10)) msg = l4.rpc.recvmsg(last_id=-1)