From 0a9a87ec10a6f88e03d6117d4ea57c9d2c27fc62 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 26 Jul 2022 13:42:03 +0930 Subject: [PATCH] pytest: fix test_commando_stress On fast machines, we don't get failures sometimes on commando commands. (*But* we still got "New cmd replacing old" messages, which is how I realized we weren't freeing them promptly, hence the previous fix). ``` # Should have exactly one discard msg from each discard > nodes[0].daemon.wait_for_logs([r"New cmd from .*, replacing old"] * discards) tests/test_plugin.py:2839: ... > raise TimeoutError('Unable to find "{}" in logs.'.format(exs)) E TimeoutError: Unable to find "[]" in logs. ``` Signed-off-by: Rusty Russell --- tests/test_plugin.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/test_plugin.py b/tests/test_plugin.py index ac8bbda9f..fb0790d61 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -2835,8 +2835,12 @@ def test_commando_stress(node_factory, executor): assert(e.error['message'] == "Invalid JSON") discards += 1 - # Should have exactly one discard msg from each discard - nodes[0].daemon.wait_for_logs([r"New cmd from .*, replacing old"] * discards) + # Should have at least one discard msg from each failure (we can have + # more, if they kept replacing each other, as happens!) + if discards > 0: + nodes[0].daemon.wait_for_logs([r"New cmd from .*, replacing old"] * discards) + else: + assert not nodes[0].daemon.is_in_log(r"New cmd from .*, replacing old") def test_commando_badrune(node_factory):