Skip to content

test: adjust flaky test which relies on filesystem permissions#481

Merged
nathanwn merged 2 commits into
stagingfrom
remove-flaky-test
Sep 22, 2023
Merged

test: adjust flaky test which relies on filesystem permissions#481
nathanwn merged 2 commits into
stagingfrom
remove-flaky-test

Conversation

@nathanwn

Copy link
Copy Markdown
Member

I am removing a test that fails in environments where the user running the test actually has write access to the / directory.
This may happen in, for example, a test environment inside a container where the user is root, which is quite common in CI systems (e.g. GitLab Runner with docker executor, or Jenkins docker pipelines).

@oracle-contributor-agreement oracle-contributor-agreement Bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Sep 21, 2023
@nathanwn nathanwn self-assigned this Sep 21, 2023
"""Test dumping the default values."""
output_dir = os.path.dirname(os.path.abspath(__file__))
assert create_defaults(output_dir, global_config.macaron_path) is True
assert create_defaults("/", "/") is False

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This particular test has been helpful in finding bugs related to permission issues in the past. Instead of removing it, please replace it by a testcase that raises OSError here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Do you have any suggestions for improving this test?
One solution I can think of now is to detect if the current user running tests is root, and disable the test if it is the case.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I fixed the test in 2688398.
I set it to expect to fail in case the user is root.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The adjustment to the test looks good.

Signed-off-by: Nathan Nguyen <nathan.nguyen@oracle.com>
"""Test dumping the default values."""
output_dir = os.path.dirname(os.path.abspath(__file__))
assert create_defaults(output_dir, global_config.macaron_path) is True
assert create_defaults("/", "/") is False

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The adjustment to the test looks good.

@nathanwn nathanwn changed the title test: remove flaky test which relies on filesystem permissions test: adjust flaky test which relies on filesystem permissions Sep 22, 2023
@nathanwn nathanwn merged commit fb302eb into staging Sep 22, 2023
@nathanwn nathanwn deleted the remove-flaky-test branch September 22, 2023 04:00
art1f1c3R pushed a commit that referenced this pull request Nov 29, 2024
Signed-off-by: Nathan Nguyen <nathan.nguyen@oracle.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants