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 <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2022-07-26 13:42:03 +09:30
committed by neil saitug
parent 9aa9a8236f
commit 0a9a87ec10

View File

@@ -2835,8 +2835,12 @@ def test_commando_stress(node_factory, executor):
assert(e.error['message'] == "Invalid JSON") assert(e.error['message'] == "Invalid JSON")
discards += 1 discards += 1
# Should have exactly one discard msg from each discard # Should have at least one discard msg from each failure (we can have
nodes[0].daemon.wait_for_logs([r"New cmd from .*, replacing old"] * discards) # 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): def test_commando_badrune(node_factory):