pytest: further deflake test_funding_push.
I also got an error under CI; it seems the sleep() was insufficient. So try adding a sleep inside the check_coin_moves, which should cover everyone. ``` acct_moves = acct_moves[number_moves:] else: > if not move_matches(m, acct_moves[0]): E IndexError: list index out of range ``` Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
ae4669f77f
commit
b659fbbdf7
|
@ -1077,8 +1077,6 @@ def test_funding_push(node_factory, bitcoind, chainparams):
|
|||
assert funds['channel_sat'] + push_sat == funds['channel_total_sat']
|
||||
|
||||
chanid = first_channel_id(l2, l1)
|
||||
# give the file write a second
|
||||
time.sleep(1)
|
||||
channel_mvts_1 = [
|
||||
{'type': 'chain_mvt', 'credit': 16777215000, 'debit': 0, 'tags': ['channel_open', 'opener']},
|
||||
{'type': 'channel_mvt', 'credit': 0, 'debit': 20000000, 'tags': ['pushed'], 'fees': '0msat'},
|
||||
|
|
|
@ -3,6 +3,7 @@ from pyln.testing.utils import env, only_one, wait_for, write_config, TailablePr
|
|||
import bitstring
|
||||
from pyln.client import Millisatoshi
|
||||
from pyln.testing.utils import EXPERIMENTAL_DUAL_FUND
|
||||
import time
|
||||
|
||||
EXPERIMENTAL_FEATURES = env("EXPERIMENTAL_FEATURES", "0") == "1"
|
||||
COMPAT = env("COMPAT", "1") == "1"
|
||||
|
@ -108,6 +109,19 @@ def check_balance_snaps(n, expected_bals):
|
|||
|
||||
def check_coin_moves(n, account_id, expected_moves, chainparams):
|
||||
moves = n.rpc.call('listcoinmoves_plugin')['coin_moves']
|
||||
# moves can lag; wait for a few seconds if we don't have correct number.
|
||||
# then move on: we'll get details below.
|
||||
expected_count = 0
|
||||
for m in enumerate(expected_moves):
|
||||
if isinstance(m, list):
|
||||
expected_count += len(m)
|
||||
else:
|
||||
expected_count += 1
|
||||
|
||||
if len(moves) != expected_count:
|
||||
time.sleep(5)
|
||||
moves = n.rpc.call('listcoinmoves_plugin')['coin_moves']
|
||||
|
||||
node_id = n.info['id']
|
||||
acct_moves = [m for m in moves if m['account_id'] == account_id]
|
||||
for mv in acct_moves:
|
||||
|
|
Loading…
Reference in New Issue