test: move sync_* implementations to framework member functions #18932

pull brakmic wants to merge 1 commits into bitcoin:master from brakmic:move-sync-blocks-to-framework changing 3 files +47 −58
  1. brakmic commented at 2:18 PM on May 10, 2020: contributor

    This PR moves global util.py implementations of sync_blocks and sync_mempools to framework/test_framework.py member functions.

    Additionally, it updates feature_backwards_compatibility.py-test to use these new member functions.

    Fixes #18930

  2. in test/functional/feature_backwards_compatibility.py:30 in 85e91edda0 outdated
      26 | @@ -27,9 +27,7 @@
      27 |  
      28 |  from test_framework.util import (
      29 |      adjust_bitcoin_conf_for_pre_17,
      30 | -    assert_equal,
      31 | -    sync_blocks,
      32 | -    sync_mempools,
      33 | +    assert_equal
    


    MarcoFalke commented at 2:51 PM on May 10, 2020:

    nit: Please keep the trailing comma to minimize this diff and future diffs, as well as guiding editors with formatting.

  3. in test/functional/test_framework/test_framework.py:33 in 85e91edda0 outdated
      29 | @@ -30,9 +30,7 @@
      30 |      connect_nodes,
      31 |      disconnect_nodes,
      32 |      get_datadir_path,
      33 | -    initialize_datadir,
      34 | -    sync_blocks,
      35 | -    sync_mempools,
      36 | +    initialize_datadir
    


    MarcoFalke commented at 2:51 PM on May 10, 2020:

    same

  4. MarcoFalke approved
  5. MarcoFalke commented at 2:52 PM on May 10, 2020: member

    Approach ACK (only looked at the diff on GitHub)

  6. DrahtBot added the label Tests on May 10, 2020
  7. test: move sync_* implementations to framework member functions
    Co-authored-by: MarcoFalke <falke.marco@gmail.com>
    36d0d660d3
  8. in test/functional/test_framework/test_framework.py:529 in 84ee268773 outdated
     528 | -        sync_mempools(nodes or self.nodes, **kwargs)
     529 | +        sync_blocks needs to be called with an rpc_connections set that has least
     530 | +        one node already synced to the latest, stable tip, otherwise there's a
     531 | +        chance it might return before all nodes are stably synced.
     532 | +        """
     533 | +        stop_time = time.time() + timeout
    


    MarcoFalke commented at 5:14 PM on May 10, 2020:

    The timeout should be scaled by self.factor, no? If yes, please add a commit for that.


    brakmic commented at 5:43 PM on May 10, 2020:

    Wasn't aware of it as the methods weren't adapted in the factor-PR. Have used the original self.options.factor property to adjust timeouts for both methods.

  9. brakmic renamed this:
    test: move sync_blocks implementation to framework member function
    test: move sync_* implementations to framework member functions
    on May 10, 2020
  10. brakmic closed this on May 10, 2020

  11. MarcoFalke commented at 8:10 PM on May 10, 2020: member

    I liked the solution. Looking forward to seeing this reopened :)

  12. practicalswift commented at 1:37 PM on May 11, 2020: contributor

    Me too -- please consider re-opening :)

  13. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me