-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[develop] Adding ability to disable requisites #49955
[develop] Adding ability to disable requisites #49955
Conversation
Manual tests for disabling requisites: Require State file:
Require disabled:
Normal run:
Disabled run:
Require_In State File:
Require disabled:
Normal Run:
Disabled_run:
|
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.
@garethgreenaway I would definitely start with some more unit tests in tests/unit/test_state.py
for specific functions in the state compiler. The def requisite_in(self, high):
deserves nearly a whole class of unit tests on its own due to its enormous size and complexity. And probably refactoring...
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.
Perhaps the best way to test this is to unit test some of the intermediate functions in the state compiler. tests/unit/test_state.py
does this, see test_render_error_on_invalid_requisite
for an example.
This approach would require you to provide the high data, and then then call the salt.state.State
object's requisite_in
method.
I wonder also if it would be a good idea to add a message to the error list when a disabled requisite is used, which would cause the states not to run and return an error message.
94d3767
to
62c9543
Compare
https://jenkinsci.saltstack.com/job/pr-lint/job/PR-49955/5/warnings52Result/new/ lint warning on the test |
… configuration and documentation.
fd2dcf7
to
24a80c6
Compare
@terminalmage and @isbm Re-review requested. |
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.
LGTM. I think this fits the bill.
I would still write a bit more UTs though. |
@garethgreenaway There is a merge conflict here now unfortunately. Can you rebase and resolve the conflicts? |
What does this PR do?
Adding the ability to disable requisites during State runs.
What issues does this PR fix or reference?
N/A
Tests written?
Yes.
Commits signed with GPG?
Yes
Please review Salt's Contributing Guide for best practices.
See GitHub's page on GPG signing for more information about signing commits with GPG.