test: fix TEST_PREVIOUS_RELEASES check #18903

pull fanquake wants to merge 1 commits into bitcoin:master from fanquake:getenv_defaults_to_None changing 1 files +1 −1
  1. fanquake commented at 3:35 AM on May 7, 2020: member

    Pythons os.getenv() returns None by default when a key isn't found. So if this test is run locally and you haven't set TEST_PREVIOUS_RELEASES or previous release binaries aren't available, it will always fail.

    Remaining jobs: [wallet_upgradewallet.py]
    1/1 - wallet_upgradewallet.py failed, Duration: 0 s
    
    stdout:
    2020-05-07T03:24:36.506000Z TestFramework (INFO): Initializing test directory /var/folders/z2/cn877pxd3czdfh47mfkmbwgm0000gn/T/test_runner_₿_🏃_20200507_112436/wallet_upgradewallet_0
    2020-05-07T03:24:36.514000Z TestFramework (ERROR): Assertion failed
    Traceback (most recent call last):
      File "bitcoin/test/functional/test_framework/test_framework.py", line 471, in start_nodes
        node.start(extra_args[i], *args, **kwargs)
      File "bitcoin/test/functional/test_framework/test_node.py", line 205, in start
        self.process = subprocess.Popen(self.args + extra_args, env=subp_env, stdout=stdout, stderr=stderr, cwd=cwd, **kwargs)
      File "/Users/x/.pyenv/versions/3.5.6/lib/python3.5/subprocess.py", line 676, in __init__
        restore_signals, start_new_session)
      File "/Users/x/.pyenv/versions/3.5.6/lib/python3.5/subprocess.py", line 1289, in _execute_child
        raise child_exception_type(errno_num, err_msg)
    FileNotFoundError: [Errno 2] No such file or directory: 'bitcoin/releases/v0.16.3/bin/bitcoind'
    
    During handling of the above exception, another exception occurred:
    
  2. fanquake added the label Tests on May 7, 2020
  3. test: fix TEST_PREVIOUS_RELEASES check
    Pythons os.getenv() returns "None" by default when a key isn't found, so
    this test seemingly wont work anywhere other than the CI right now.
    
    ```bash
    Remaining jobs: [wallet_upgradewallet.py]
    1/1 - wallet_upgradewallet.py failed, Duration: 0 s
    
    stdout:
    2020-05-07T03:24:36.506000Z TestFramework (INFO): Initializing test directory /var/folders/z2/cn877pxd3czdfh47mfkmbwgm0000gn/T/test_runner_₿_🏃_20200507_112436/wallet_upgradewallet_0
    2020-05-07T03:24:36.514000Z TestFramework (ERROR): Assertion failed
    Traceback (most recent call last):
      File "bitcoin/test/functional/test_framework/test_framework.py", line 471, in start_nodes
        node.start(extra_args[i], *args, **kwargs)
      File "bitcoin/test/functional/test_framework/test_node.py", line 205, in start
        self.process = subprocess.Popen(self.args + extra_args, env=subp_env, stdout=stdout, stderr=stderr, cwd=cwd, **kwargs)
      File "/Users/x/.pyenv/versions/3.5.6/lib/python3.5/subprocess.py", line 676, in __init__
        restore_signals, start_new_session)
      File "/Users/x/.pyenv/versions/3.5.6/lib/python3.5/subprocess.py", line 1289, in _execute_child
        raise child_exception_type(errno_num, err_msg)
    FileNotFoundError: [Errno 2] No such file or directory: 'bitcoin/releases/v0.16.3/bin/bitcoind'
    
    During handling of the above exception, another exception occurred:
    ```
    5eee648367
  4. fanquake force-pushed on May 7, 2020
  5. MarcoFalke commented at 1:08 PM on May 7, 2020: member

    Not sure why we are doing bash env var juggling here. This should be an option on the test framework like everything else. E.g. --factor

  6. fanquake commented at 1:23 PM on May 7, 2020: member

    Not sure why we are doing bash env var juggling here.

    🤷‍♂️ I just want to be able to run the full functional test suite locally without pointless failures. I don't understand how we've ended up with a test that will fail by default when run outside the CI.

  7. in test/functional/test_framework/test_framework.py:675 in 5eee648367
     671 | @@ -672,7 +672,7 @@ def skip_if_no_previous_releases(self):
     672 |  
     673 |      def has_previous_releases(self):
     674 |          """Checks whether previous releases are present and enabled."""
     675 | -        if os.getenv("TEST_PREVIOUS_RELEASES") == "false":
     676 | +        if os.getenv("TEST_PREVIOUS_RELEASES") == "false" or os.getenv("TEST_PREVIOUS_RELEASES") is None:
    


    MarcoFalke commented at 1:29 PM on May 7, 2020:
            if os.getenv("TEST_PREVIOUS_RELEASES", "false") == "false":
    

    does this pass?

  8. MarcoFalke commented at 1:32 PM on May 7, 2020: member

    A workaround could also be to remove the prev releases folder

  9. Sjors commented at 8:51 AM on May 19, 2020: member

    feature_backwards_compatibility.py and wallet_upgradewallet.py are skipped when the /releases folder is absent. That folder is not in the repo. Once the folder is present, the test assumes you intend to use it and will fail if anything is missing. Unless you explicitly turn off TEST_PREVIOUS_RELEASES.

    Having to always set TEST_PREVIOUS_RELEASES=true is annoying.

    Not sure why we are doing bash env var juggling here. This should be an option on the test framework like everything else. E.g. --factor

    It mimics the behaviour of is_wallet_compiled and is_zmq_compiled (I'm also not a fan of the config.ini juggling involved there). But maybe we can use a --previous_releases option instead of the env var, as long as the default depends on whether /releases is present.

  10. fanquake commented at 11:11 AM on May 19, 2020: member

    Closing in favour of #19014.

  11. fanquake closed this on May 19, 2020

  12. fanquake deleted the branch on May 19, 2020
  13. MarcoFalke commented at 11:41 AM on May 19, 2020: member

    Just to make sure, #19014 doesn't change any behaviour. You will still run into failures if the prev releases dir exists but is missing the binaries. The only way to fix that is to remove the dir or add the binaries.

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

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