-
Notifications
You must be signed in to change notification settings - Fork 37.7k
test: update tool_wallet coverage for unexpected writes to wallet #28116
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
test: update tool_wallet coverage for unexpected writes to wallet #28116
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee the guideline for information on the review process. ConflictsReviewers, 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. |
d6c11d4
to
079337c
Compare
079337c
to
4a5c004
Compare
Pulled in 2 commits from #27850 by @pinheadmz that this is now based on. Will rebase once that PR is merged. |
Mark as draft for now then, if based on another PR? |
Will rebase and update once #27850 is merged. |
171a82e
to
209142f
Compare
1a99a9e
to
7534d69
Compare
6bba596
to
5e0445c
Compare
5e0445c
to
3ac8635
Compare
3ac8635
to
d801f46
Compare
Rebased following the merge of #28545. |
self.log.warning("Return early on Linux under root, because chattr failed.") | ||
self.log.warning("This should only happen due to missing capabilities in a container.") | ||
self.log.warning("Make sure to --cap-add LINUX_IMMUTABLE if you want to run this test.") | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removing this return will just re-introduce the bug that was fixed when adding it, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for having a look! Is this better now? git range-diff 04265ba d801f46 571eb17
(rebased for an unrelated CI failure now fixed in master).
An alternative would be to fail loudly by raising.
ccf2bfd
to
571eb17
Compare
Rebased for an unrelated CI failure normally now fixed in master. |
PR 15687 added test coverage in test/functional/tool_wallet.py to reproduce unexpected writes to the wallet file, as described in issue 15608: - wallet tool info unexpectedly writes to the wallet file if the wallet file permissions are read/write - wallet tool info raises if the wallet file permissions are read-only Update these tests for two changes since PR 15687: - the CI migration away from Appveyor - the addition of descriptor wallets Instead of describing the error messages for legacy BDB wallets and descriptor SQLite wallets in a comment, check that the error message is thrown at runtime and document that it shouldn't throw.
which enables the test to work on linux and provides the logging and error handling contained in the utils. Also add a log entry for the test.
571eb17
to
6b20d56
Compare
Rebased and updated a line due to a python linter conflict following the merge of #28392. @pinheadmz, @maflcko, @achow101, @ns-xvrn you might be interested in the changes here. |
🐙 This pull request conflicts with the target branch and needs rebase. |
if platform.system() == "Linux": | ||
attr = "+i" if readonly else "-i" | ||
try: | ||
subprocess.run(["chattr", attr, filename], capture_output=readonly, check=readonly) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to address this feedback while updating and rebasing for the merge of that pull: #28660 (comment)
⌛ There hasn't been much activity lately and the patch still needs rebase. What is the status here?
|
Closing to be able to re-open it. |
Create file permission utilities in the functional test framework based on test: Add unit & functional test coverage for blockstore #27850 and test: tool wallet test coverage for unexpected writes to wallet #15687.
PR test: tool wallet test coverage for unexpected writes to wallet #15687 added test coverage in
test/functional/tool_wallet.py
to reproduce unexpected writes to the wallet file, as described in issue Feature request: bitcoin-wallet tool: don't modify files unless requested #15608:Update these tests/docs for the following changes:
Instead of describing the error messages for legacy BDB wallets and descriptor SQLite wallets in a comment, check that the error message is thrown at runtime and document that it shouldn't throw.
Update
feature_reindex_readonly.py
to use the file permission utilities.Improve
wallet_multiwallet.py
coverage, while updating to use the file permission utilities, which enables the test to work on Linux and provides logging and error handling. Also add a log entry for the test.