test: Fix intermittent failure in wallet_encryption #19429

pull MarcoFalke wants to merge 1 commits into bitcoin:master from MarcoFalke:2007-testFixInt changing 1 files +11 −5
  1. MarcoFalke commented at 12:02 AM on July 2, 2020: member

    Iterating all crypted keys might take time.

    E.g.

     node0 2020-07-01T14:41:19.227367Z [httpworker.0] ThreadRPCServer method=walletpassphrase user=__cookie__ 
     node0 2020-07-01T14:41:24.377142Z [httpworker.0] queue run of timer lockwallet() in 100000000 seconds (using HTTP) 
    ...
     test  2020-07-01T14:41:24.379000Z TestFramework (ERROR): Assertion failed 
                                       Traceback (most recent call last):
                                         File "/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/test_framework.py", line 117, in main
                                           self.run_test()
                                         File "/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/wallet_encryption.py", line 88, in run_test
                                           assert_greater_than(expected_time + 5, actual_time) # 5 second buffer
                                         File "/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/util.py", line 54, in assert_greater_than
                                           raise AssertionError("%s <= %s" % (str(thing1), str(thing2)))
                                       AssertionError: 1693614483 <= 1693614484
    

    https://cirrus-ci.com/task/5322429885054976?command=ci#L4517

  2. fanquake added the label Tests on Jul 2, 2020
  3. test: Fix intermittent failure in wallet_encryption fabd33b541
  4. MarcoFalke force-pushed on Jul 2, 2020
  5. MarcoFalke commented at 12:11 AM on July 2, 2020: member
  6. in test/functional/wallet_encryption.py:82 in fabd33b541
      79 | +        self.log.info('Check a timeout less than the limit')
      80 |          MAX_VALUE = 100000000
      81 |          expected_time = int(time.time()) + MAX_VALUE - 600
      82 |          self.nodes[0].walletpassphrase(passphrase2, MAX_VALUE - 600)
      83 | +        # give buffer for walletpassphrase, since it iterates over all crypted keys
      84 | +        expected_time_with_buffer = time.time() + MAX_VALUE - 600
    


    jonatack commented at 4:06 AM on July 8, 2020:

    While touching this test, mind renaming MAX_VALUE to MAX_SLEEP_TIME (per src/wallet/rpcwallet.cpp:1884) and moving the definition up to the top of the file or using local variable naming, e.g. max_sleep_time.


    jonatack commented at 4:08 AM on July 8, 2020:

    There are several of both int(time.time()) and time.time() in the test. Standardize on one of the two?


    MarcoFalke commented at 10:25 AM on July 9, 2020:

    They rounding needs to be exactly the way it is, otherwise the test wouldn't pass

  7. jonatack commented at 4:09 AM on July 8, 2020: member

    Concept ACK

  8. MarcoFalke commented at 7:48 AM on July 14, 2020: member

    @achow101 Mind taking a look here?

  9. achow101 commented at 3:06 PM on July 14, 2020: member

    ACK fabd33b5416f2a2cd635d02b85d5bc2681cfaf17

  10. MarcoFalke merged this on Jul 14, 2020
  11. MarcoFalke closed this on Jul 14, 2020

  12. MarcoFalke deleted the branch on Jul 14, 2020
  13. sidhujag referenced this in commit 01ceb4370f on Jul 16, 2020
  14. DrahtBot locked this on Feb 15, 2022
Labels

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-17 06:14 UTC

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