test: Avoid test failure on Linux root without cap-add LINUX_IMMUTABLE #28545

pull MarcoFalke wants to merge 1 commits into bitcoin:master from MarcoFalke:2309-test-fix-root-cap- changing 1 files +6 −0
  1. MarcoFalke commented at 2:49 pm on September 27, 2023: member
    This turns a test failure on Linux when running the test as root, but without the LINUX_IMMUTABLE capability, into an early return, with a suggestion to turn on LINUX_IMMUTABLE next time (if possible).
  2. test: Avoid test failure on Linux root without cap-add LINUX_IMMUTABLE fa40b3ee22
  3. DrahtBot commented at 2:49 pm on September 27, 2023: contributor

    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
    ACK pinheadmz, jonatack

    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:

    • #28116 (test: update tool_wallet coverage for unexpected writes to wallet by jonatack)

    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.

  4. DrahtBot added the label Tests on Sep 27, 2023
  5. pinheadmz approved
  6. pinheadmz commented at 2:53 pm on September 27, 2023: member
    utACK fa40b3ee22e78f58d7426dbc4343472ba40081e3
  7. MarcoFalke added this to the milestone 26.0 on Sep 28, 2023
  8. MarcoFalke commented at 11:00 am on September 29, 2023: member
    rfm or is anything left to be done here?
  9. in test/functional/feature_reindex_readonly.py:49 in fa40b3ee22
    45@@ -45,6 +46,11 @@ def reindex_readonly(self):
    46                     self.log.warning(f"stdout: {e.stdout}")
    47                 if e.stderr:
    48                     self.log.warning(f"stderr: {e.stderr}")
    49+                if os.getuid() == 0:
    


    jonatack commented at 4:31 pm on September 30, 2023:

    if you retouch, maybe

    0                if os.getuid() == 0:  # 0 implies user is root (Unix/Linux)
    
  10. jonatack commented at 4:37 pm on September 30, 2023: contributor
    ACK fa40b3ee22e78f58d7426dbc4343472ba40081e3
  11. in test/functional/feature_reindex_readonly.py:53 in fa40b3ee22
    45@@ -45,6 +46,11 @@ def reindex_readonly(self):
    46                     self.log.warning(f"stdout: {e.stdout}")
    47                 if e.stderr:
    48                     self.log.warning(f"stderr: {e.stderr}")
    49+                if os.getuid() == 0:
    50+                    self.log.warning("Return early on Linux under root, because chattr failed.")
    51+                    self.log.warning("This should only happen due to missing capabilities in a container.")
    52+                    self.log.warning("Make sure to --cap-add LINUX_IMMUTABLE if you want to run this test.")
    53+                    return
    


    jonatack commented at 4:53 pm on September 30, 2023:
    Question: what does the return here add?

    MarcoFalke commented at 7:44 am on October 2, 2023:

    return means that the function terminates and returns its return value.

    As explained in the pull request title, the return is required to avoid the test failure.

  12. fanquake merged this on Oct 2, 2023
  13. fanquake closed this on Oct 2, 2023

  14. MarcoFalke deleted the branch on Oct 5, 2023

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: 2024-09-29 01:12 UTC

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