test: improve rpc_blockchain.py tests and assert on time and mediantime #22520

pull jonatack wants to merge 4 commits into bitcoin:master from jonatack:getblockchaininfo-time-tests changing 1 files +49 −37
  1. jonatack commented at 3:43 PM on July 21, 2021: member

    Follow-up to #22407 improving test coverage per #22407#pullrequestreview-702077013.

  2. test: assert on the value of getblockchaininfo#time 0a9129c588
  3. test: assert on mediantime in getblockheader and getblockchaininfo 78c361086f
  4. DrahtBot added the label Tests on Jul 21, 2021
  5. jonatack force-pushed on Jul 21, 2021
  6. jonatack renamed this:
    test: assert on the values of getblockchaininfo time/mediantime
    test: improve rpc_blockchain.py tests and assert on time and mediantime
    on Jul 21, 2021
  7. in test/functional/rpc_blockchain.py:110 in dd476e7bba outdated
     105 | @@ -99,7 +106,8 @@ def _test_getblockchaininfo(self):
     106 |          ]
     107 |          res = self.nodes[0].getblockchaininfo()
     108 |  
     109 | -        assert isinstance(res['time'], int)
     110 | +        assert_equal(res['time'], TIME_RANGE_END - TIME_RANGE_STEP)
     111 | +        assert_equal(res['mediantime'], TIME_RANGE_MTP)
    


    RandyMcMillan commented at 6:26 PM on July 21, 2021:

    It would be interesting if the TIME_RANGE_STEP varied quasi-randomly by +/- 3 minutes. Wouldn't having a variation be a better test? Just a thought. :)


    jonatack commented at 12:52 AM on July 22, 2021:

    The getnetworkhashps test would need to be adapted to it, otherwise seems doable. Feel free to propose it as a follow-up!

  8. test: replace magic values by constants in rpc_blockchain.py d548dc71e4
  9. test: update logging and docstring in rpc_blockchain.py ef5e9304cd
  10. jonatack force-pushed on Jul 22, 2021
  11. jonatack commented at 12:54 AM on July 22, 2021: member

    Updated per git diff dd476e7 ef5e930 for a few more changes to be made in the third commit, "test: replace magic values by constants in rpc_blockchain.py."

  12. DrahtBot commented at 10:50 AM on July 28, 2021: member

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  13. tryphe commented at 4:26 AM on July 30, 2021: contributor

    untested ACK ef5e9304cd407adab1563f24215da1b582274c20

    Test is more robust and the documentation of which RPCs are tested is corrected. I say we wait until #22567 is merged first though :)

  14. MarcoFalke merged this on Jul 30, 2021
  15. MarcoFalke closed this on Jul 30, 2021

  16. jonatack deleted the branch on Jul 30, 2021
  17. sidhujag referenced this in commit 111592ed6c on Aug 1, 2021
  18. DrahtBot locked this on Aug 16, 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