test: Remove confusing connect_nodes global #19821

issue MarcoFalke openend this issue on August 27, 2020
  1. MarcoFalke commented at 4:02 pm on August 27, 2020: member

    connect_nodes(self.nodes[a], b) is confusing because

    • the types of the arguments differ
    • the test framework is aware of all nodes, so solving a to self.nodes[a] can be done hidden from the caller

    This should be fixed by replacing connect_nodes(self.nodes[a], b) with self.connect_nodes(a, b) and removing the global connect_nodes.

  2. MarcoFalke added the label good first issue on Aug 27, 2020
  3. slmtpz commented at 5:02 pm on August 27, 2020: contributor
    Can I also pick this up? Or do we have a “good second issue” for me that does not require a lot of bitcoin logic yet and could help me understand further?
  4. MarcoFalke commented at 5:43 pm on August 27, 2020: member

    @slmtpz You may also help with review, as explained in https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#contributing-to-bitcoin-core Currently there are about 400 open pull request, so I am sure there is something in for you.

    If not, apart from the good first issues, there are also ones that are up for grabs. Some of them might no longer be applicable. So if you are interested, but unsure, you might want to leave a comment on the issue first.

    Generally, you can also write tests to improve the coverage. Any kind of test is welcome and coverage information can be obtained from a relatively recent coverage report. If you are unsure, don’t hesitate to check back first.

  5. ghost commented at 4:45 am on August 28, 2020: none

    So we just need to replace connect_nodes(self.nodes[a], b) with self.connect_nodes(a, b) and remove the global connect_nodes ?

    https://github.com/search?l=&q=connect_nodes+repo%3Abitcoin%2Fbitcoin%2Ftest&type=Code

    For example:

    Remove line 42 https://github.com/bitcoin/bitcoin/blob/cb1ee1551cf39905ccb67e3d07b0e3aaaca18ce3/test/functional/wallet_backup.py#L42

    And replace line 65,66 and 67 here: https://github.com/bitcoin/bitcoin/blob/cb1ee1551cf39905ccb67e3d07b0e3aaaca18ce3/test/functional/wallet_backup.py#L65

    with following:

    self.connect_nodes(0, 3) self.connect_nodes(1, 3) self.connect_nodes(2, 3) self.connect_nodes(2, 0)

  6. MarcoFalke commented at 9:55 am on September 9, 2020: member
  7. ghost commented at 5:24 pm on September 9, 2020: none

    @MarcoFalke Made the changes in 37 files accordingly

    Not sure if anything has to be changed in below files:

    /test/functional/mempool_unbroadcast.py /test/functional/test_framework/test_framework.py

  8. robot-dreams commented at 8:09 am on September 17, 2020: contributor

    Thanks again for working on this, @prayank23 !

    As mentioned in the #19945 discussion, in #19967 I’ve built on your work to use scripted-diff as suggested (while keeping you as the author for the relevant commit). @MarcoFalke Do you have any additional context about why we might not want to update disconnect_nodes as well?

  9. MarcoFalke closed this on Oct 21, 2020

  10. sidhujag referenced this in commit fa2305a135 on Oct 21, 2020
  11. 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: 2024-12-19 03:12 UTC

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