8000 tests: Run both descriptor and legacy tests within a single test invocation by achow101 · Pull Request #20892 · bitcoin/bitcoin · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

tests: Run both descriptor and legacy tests within a single test invocation #20892

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from

Conversation

achow101
Copy link
Member
@achow101 achow101 commented Jan 9, 2021

Instead of having the tests only do one type or the other, depending on command line arguments, these tests should be running with both types of wallets. Any test that calls add_wallet_options will be run for each wallet type that it specifies a wallet option for if none are give in the command line. If a particular wallet is specified with --legacy-wallet or --descriptors, the options are still respected.

@fanquake fanquake added the Tests label Jan 9, 2021
@DrahtBot
Copy link
Contributor
DrahtBot commented Jan 9, 2021

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

Reviews

See the guideline for information on the review process.

Type Reviewers
Concept ACK promag, josibake
Stale ACK rajarshimaitra, aureleoules

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #28528 (test: Use test framework utils in functional tests by osagie98)
  • #28454 (wallet: allowing walletpassphrase timeout to be MAX_SLEEP_TIME if set to -1 by kevkevinpal)
  • #28403 (test: Bump walletpassphrase timeouts to avoid intermittent issues by MarcoFalke)
  • #28392 (test: Use pathlib over os path by ns-xvrn)
  • #28142 (wallet: Allow users to create a wallet that encrypts all database records by achow101)
  • #28027 (test: Fixes and updates to wallet_backwards_compatibility.py for 25.0 and descriptor wallets by achow101)
  • #27231 (Fix logging RPC and -debugexclude with 0/none values, add test coverage, improve docs by jonatack)
  • #27216 (wallet: Add wallet method to detect if a key is "active" by pinheadmz)
  • #27034 (rpc: make importaddress compatible with descriptors wallet by furszy)
  • #25038 (policy: nVersion=3 and Package RBF by glozow)

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.

Copy link
Contributor
@promag promag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK.

@achow101 achow101 force-pushed the better-descriptor-tests branch from 857c61e to b827c13 Compare January 12, 2021 22:57
@DrahtBot
Copy link
Contributor

🕵️ @sipa @jonatack have been requested to review this pull request as specified in the REVIEWERS file.

@achow101 achow101 force-pushed the better-descriptor-tests branch from b827c13 to 76fd40d Compare January 26, 2021 01:15
@achow101 achow101 force-pushed the better-descriptor-tests branch 2 times, most recently from c54bcd0 to 7dbd3fd Compare January 28, 2021 19:03
@achow101 achow101 force-pushed the better-descriptor-tests branch from 7dbd3fd to bed643b Compare February 5, 2021 18:49
@aureleoules
Copy link
Contributor
aureleoules commented Sep 25, 2023

I have the following error when running the test_runner with BDB compiled using depends:

Details
1695642351381,"4/288 - wallet_backup.py --legacy-wallet failed, Duration: 43 s"
1695642351381,stdout:
1695642351381,2023-09-25T11:39:01.368000Z TestFramework (INFO): PRNG seed is: 8911868130033750645
1695642351381,2023-09-25T11:39:01.381000Z TestFramework (INFO): Initializing test directory /tmp/test_runner_₿_🏃_20230925_113853/wallet_backup_272_3wjtcweb
1695642351381,2023-09-25T11:39:05.172000Z TestFramework (INFO): Generating initial blockchain
1695642351381,2023-09-25T11:39:09.767000Z TestFramework (INFO): Creating transactions
1695642351381,2023-09-25T11:39:25.216000Z TestFramework (INFO): Backing up
1695642351381,2023-09-25T11:39:25.622000Z TestFramework (INFO): More transactions
1695642351381,2023-09-25T11:39:39.536000Z TestFramework (INFO): Restoring wallets on node 3 using backup files
1695642351381,2023-09-25T11:39:40.434000Z TestFramework (INFO): Restoring using dumped wallet
1695642351381,2023-09-25T11:39:43.078000Z TestFramework (ERROR): Unexpected exception caught during testing
1695642351381,Traceback (most recent call last):
1695642351381,"  File ""/tmp/bitcoin/test/functional/test_framework/test_framework.py"", line 148, in main"
1695642351381,    self.run_test()
1695642351381,"  File ""/tmp/bitcoin/test/functional/wallet_backup.py"", line 231, in run_test"
1695642351381,"    self.nodes[node_num].createwallet(wallet_name=self.default_wallet_name, descriptors=self.use_descriptors, load_on_startup=True)"
1695642351381,"  File ""/tmp/bitcoin/test/functional/test_framework/test_node.py"", line 818, in createwallet"
1695642351381,"    return self.__getattr__('createwallet')(wallet_name, disable_private_keys, blank, passphrase, avoid_reuse, descriptors, load_on_startup, external_signer)"
1695642351381,"  File ""/tmp/bitcoin/test/functional/test_framework/coverage.py"", line 50, in __call__"
1695642351381,"    return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)"
1695642351381,"  File ""/tmp/bitcoin/test/functional/test_framework/authproxy.py"", line 126, in __call__"
1695642351381,"    postdata = json.dumps(self.get_request(*args, **argsn), default=serialization_fallback, ensure_ascii=self.ensure_ascii)"
1695642351381,"  File ""/tmp/bitcoin/test/functional/test_framework/authproxy.py"", line 114, in get_request"
1695642351381,"    json.dumps(args or argsn, default=serialization_fallback, ensure_ascii=self.ensure_ascii),"
1695642351381,"  File ""/usr/lib/python3.10/json/__init__.py"", line 238, in dumps"
1695642351381,    **kw).encode(obj)
1695642351381,"  File ""/usr/lib/python3.10/json/encoder.py"", line 199, in encode"
1695642351381,"    chunks = self.iterencode(o, _one_shot=True)"
1695642351381,"  File ""/usr/lib/python3.10/json/encoder.py"", line 257, in iterencode"
1695642351381,"    return _iterencode(o, 0)"
1695642351381,"  File ""/tmp/bitcoin/test/functional/test_framework/authproxy.py"", line 68, in serialization_fallback"
1695642351381,"    raise TypeError(repr(o) + "" is not JSON serializable"")"
1695642351381,TypeError: <test_framework.test_framework.OptionalBool object at 0x7fbcf6e055a0> is not JSON serializable
1695642351381,2023-09-25T11:39:43.130000Z TestFramework (INFO): Stopping nodes
1695642351381,2023-09-25T11:39:43.507000Z TestFramework (WARNING): Not cleaning up dir /tmp/test_runner_₿_🏃_20230925_113853/wallet_backup_272_3wjtcweb
1695642351381,2023-09-25T11:39:43.507000Z TestFramework (ERROR): Test failed. Test logging available at /tmp/test_runner_₿_🏃_20230925_113853/wallet_backup_272_3wjtcweb/test_framework.log
1695642351381,2023-09-25T11:39:43.508000Z TestFramework (ERROR): 
1695642351381,2023-09-25T11:39:43.508000Z TestFramework (ERROR): Hint: Call /tmp/bitcoin/test/functional/combine_logs.py '/tmp/test_runner_₿_🏃_20230925_113853/wallet_backup_272_3wjtcweb' to consolidate all logs
1695642351381,2023-09-25T11:39:4
8000
3.508000Z TestFramework (ERROR): 
1695642351381,"2023-09-25T11:39:43.508000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log."
1695642351381,2023-09-25T11:39:43.508000Z TestFramework (ERROR): https://github.com/bitcoin/bitcoin/issues
1695642351381,2023-09-25T11:39:43.508000Z TestFramework (ERROR): 

@maflcko
Copy link
Member
maflcko commented Sep 25, 2023

Not sure if this is worth it at this point.

If there are independent test framework improvements, they can be submitted and reviewed and tested independently. However, I don't think the whole test framework should be rewritten for a temporary need.

IIRC it should be possible to just remove the feature to create new bdb wallets after the branch-off. It bdb wallet support is going to be removed in the future, there shouldn't be any need for new wallets to be created in this format, especially with the 27.0 release next year. If someone (or the tests) really need to create a bdb wallet, they can just use the previous release (for example 25.0).

Happy to review a pull request that removes the feature to create bdb wallets.

achow101 and others added 11 commits October 3, 2023 16:50
Instead of manually making the tmpdir depending on whether --tmpdir is
provided, we can always us tempfile.mkdtemp and provide the dir option
with self.options.tmpdir. This behaves the same as previously except
that the tmpdirs created when --tmpdir is passed will have additional
randomness on the directory names.

In order to get the correct tmpdir prefixes from the test runner, a
--tmpdir-prefix option is added.

Lastly, the tmpdir location is stored in a dedicated self.tmpdir
variable. We wll remove usage of self.options.tmpdir for that path in
later commits.
--tmpdirprefix is now unnecessary and potentially confusing.
Instead of retrieving the actual tmpdir path from self.options.tmpdir,
retrieve it from self.tmpdir.

-BEGIN VERIFY SCRIPT-
sed -i "s/self.options.tmpdir/self.tmpdir/" $(git grep -l "self.options.tmpdir" -- ":!test/functional/test_framework/test_framework.py")
sed -i "264,271b;s/self.options.tmpdir/self.tmpdir/" test/functional/test_framework/test_framework.py
-END VERIFY SCRIPT-
Some new wallet functional tests were added, these need to
--legacy-wallet and --descriptors variants in test_runner.py
self.use_descriptors tracks whether the test should be using a
descriptor. However, to avoid the fact that None evaluates to False, it
is a newly introduced OptionalBool class that will assert if it is None
when used as a bool rather than returning False.

test_framework.py is updated to use self.use_descriptors throughout
rather than self.options.descriptors. The next commit will update the
rest of the tests.
Instead of using the options parser to hold whether we are doing
descriptor wallets, have a member in the test framework class to handle
it.

-BEGIN VERIFY SCRIPT-
sed -i -E "s/self.options.descriptors/self.use_descriptors/" $(git grep -l "self.options.descriptors" -- ":(exclude)*/test_framework.py")
-END VERIFY SCRIPT-
self.options.descriptors is no longer used by the tests directly, so we
don't need to be assigning it.
Determining the default wallet name based on the wallet type the test is
running with requires being in `setup()`, so move the setting of
`self.default_wallet_name` there. This requires changing a couple of
tests in the way that they can specify that the default wallet name
should be used in `self.wallet_names`.
Be able to run tests that can run in both descriptor and legacy wallet
modes with a single invocation of the test script. In order to
facilitate this, self.options.descriptors is changed to be a list. When
neither option is provided, but both are available, it is set to [False,
True] which will run the test twice, the first in legacy wallet mode,
the second in descriptor wallet mode.

For the tests that can only have one mode, add_wallet_options will set
self.options.descriptors to either [False] or [True] which will make the
correct type run.
Most wallet tests need to be run with both wallet types. Instead of
requiring developers to manually specify this, the test_runner can find
the wallet tests that do not have a wallet type specified and
automatically run the test with both types.
@achow101 achow101 force-pushed the better-descriptor-tests branch from ce7fa01 to 99d7e2c Compare October 3, 2023 21:03
@DrahtBot
Copy link
Contributor
DrahtBot commented Oct 5, 2023

🐙 This pull request conflicts with the target branch and needs rebase.

@achow101
Copy link
Member Author
achow101 commented Oct 5, 2023

The intention is to remove the legacy wallet soon(tm), so I guess this isn't worth merging and then reverting in a few months.

@achow101 achow101 closed this Oct 5, 2023
@bitcoin bitcoin locked and limited conversation to collaborators Oct 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants
0