Skip to content

Issue in p2p_timeouts: no_send_node.wait_for_disconnect(timeout=1) #23739

@jonatack

Description

@jonatack

CI
https://cirrus-ci.com/task/5687505285545984

Locally

$ test/functional/p2p_timeouts.py 
2021-12-10T23:40:36.399000Z TestFramework (INFO): Initializing test directory /tmp/bitcoin_func_test_hpui5kz3
2021-12-10T23:40:38.232000Z TestFramework.utils (ERROR): wait_until() failed. Predicate: ''''
        def test_function():
            if check_connected:
                assert self.is_connected
            return test_function_in()
'''
2021-12-10T23:40:38.232000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/home/jon/projects/bitcoin/bitcoin/test/functional/test_framework/test_framework.py", line 132, in main
    self.run_test()
  File "/home/jon/projects/bitcoin/bitcoin/test/functional/p2p_timeouts.py", line 92, in run_test
    no_send_node.wait_for_disconnect(timeout=1)
  File "/home/jon/projects/bitcoin/bitcoin/test/functional/test_framework/p2p.py", line 461, in wait_for_disconnect
    self.wait_until(test_function, timeout=timeout, check_connected=False)
  File "/home/jon/projects/bitcoin/bitcoin/test/functional/test_framework/p2p.py", line 453, in wait_until
    wait_until_helper(test_function, timeout=timeout, lock=p2p_lock, timeout_factor=self.timeout_factor)
  File "/home/jon/projects/bitcoin/bitcoin/test/functional/test_framework/util.py", line 269, in wait_until_helper
    raise AssertionError("Predicate {} not true after {} seconds".format(predicate_source, timeout))
AssertionError: Predicate ''''
        def test_function():
            if check_connected:
                assert self.is_connected
            return test_function_in()
''' not true after 1.0 seconds

Appears to be related to the merge of #19499. Relevant diff:

--- a/test/functional/p2p_timeouts.py
+++ b/test/functional/p2p_timeouts.py
         with self.nodes[0].assert_debug_log(expected_msgs=expected_timeout_logs):
-            sleep(3)
-            # By now, we waited a total of 5 seconds. Off-by-two for two
-            # reasons:
-            #  * The internal precision is one second
-            #  * Account for network delay
-            assert not no_verack_node.is_connected
-            assert not no_version_node.is_connectedZ
-            assert not no_send_node.is_connected
+            self.mock_forward(2)
+            no_verack_node.wait_for_disconnect(timeout=1)
+            no_version_node.wait_for_disconnect(timeout=1)
+            no_send_node.wait_for_disconnect(timeout=1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions