Repository navigation
Fix unit tests failing on macOS - #70601
sudipto674 wants to merge 1 commit into
Conversation
|
Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here's some information that may help as you continue your Salt journey. There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar. |
- test_roots: check sys.platform.startswith("win"); "win" in "darwin" is
true, so macOS expected the Windows path separator.
- test_scripts: skip the fork start method pin tests on macOS, where
salt.scripts deliberately does not pin it.
- test_pam: compare against os.path.realpath(); /var is a symlink to
/private/var on macOS.
- test_salt_call: give SaltCall a minimal config with a temporary
root_dir. It previously used the default /etc/salt and /var/log/salt
paths, failing as a non-root user and leaving global logging options
that made later tests fail with "No permissions to access
/var/log/salt/minion".
Fixes saltstack#70599
9397da4 to
f514bc4
Compare
|
re-targeted this one to 3008.x. |
What does this PR do?
Fixes unit tests that fail on macOS when run as a non-root user:
test_roots.py::test_serve_file_not_in_rootchecked"win" in sys.platform, which is also true for"darwin". It now usessys.platform.startswith("win").test_scripts.pyfork start method pin tests are skipped on macOS, wheresalt.scriptsdeliberately does not pinfork.test_pam.pycompares againstos.path.realpath()because/varis a symlink to/private/varon macOS.test_salt_call.py::test_passing_cachedir_to_extension_modulesnow uses a minimal config with a temporaryroot_dirinstead of the default/etc/saltand/var/log/saltpaths. It used to fail withSystemExit: 13and leave global logging options that made later tests (test_master,test_reactor,test_engines) fail withNo permissions to access "/var/log/salt/minion".What issues does this PR fix or reference?
Fixes #70599
Previous Behavior
These tests failed on macOS when run as a non-root user (they pass on Linux CI, where tests run as root).
New Behavior
The affected test files pass on macOS, and the
/var/log/saltfailures no longer occur whentests/pytests/unit/cliruns before them.Merge requirements satisfied?
[NOTICE] Bug fixes or features added to Salt require tests.
changelog/70599.fixed.mdCommits signed with GPG?
No