-
Notifications
You must be signed in to change notification settings - Fork 37
Refactoring of function Zonemaster::Engine::Test::run_one() #1294
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
Conversation
f238bad to
38c03a9
Compare
4b6aaec to
ea29ea3
Compare
matsduf
left a comment
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.
I disagree with the change.
I do not understand why it should be impossible to run a specific test if it is not listed in the current profile. What problem does that solve?
To better understand your position, do you disagree with all the changes in this PR or only with the part that is described as "Add conditional check for Test Case - trying to run a Test Case disabled by the profile will now return an error." in the PR's description? |
I responded in #1284 (comment). We can continue the discussion in the issue if you want. Other opinions are welcome - to me it is logical to make that change, the configuration (profile) should take precedence in all cases. |
ea29ea3 to
2fef783
Compare
Yes, the change that I am against is
I have seen no explanation of the problem that it would solve so I do not understand why the flexibility should be removed. The following sounds fine:
The following I do not know what it changes. I probably affects the output, but I do not understand how. Could be fine.
|
What problem do you see by allowing the user to run an unlisted test case? Why is this a change to the better? |
On one hand we can see it as a feature. On the other hand, if you deploy Zonemaster with a custom profile, it allows to bypass it and run a specific test. Then you would expect your user to only be able to run testcase |
The limitation is not harder than you can create your own profile without any superuser privileges: I see no reason to remove the flexibility that we have today. You can test a test case not included in the profile without having to include it. |
I agree. And I think this would be a good practice to do so (and not rely on a potential hidden feature).
I think that for the time being I disagree with your point of view. |
Firstly, it means that your argument above is not valid. Secondly, it is not a hidden feature. I still do not see what problem it would solve to introduce to limit the flexibility. |
When a user changes the profile in Engine it does so with a specific intent. In this case, such an intent is to explicitly disable a Test Case from being run by Engine. From my perspective, an interface (such as Zonemaster-CLI) to Engine should not be permitted to bypass the default configuration, at least not in nominal conditions. It is surprising to me that the same user, using Zonemaster-CLI, can run a test module which will not run one or several specific test cases (as expected), and then consequently be able to run such a disabled test case, all using the same interface argument (i.e. It also complexifies the documentation. So the main problems I see here are consistency and predictability. |
|
This is the current documentation:
If we change the behavior we also need to update the documentation. Since this behavior is stated so explicitly I'd say it's a breaking change. I don't think the current behavior has a lot of merit other than the fact that it's documented. I don't believe anyone consciously designed it that way. It's just a weird design. When we wrote the documentation for the profile properties our intention was just to document whatever the current behavior happened to be, and then possibly improve it later once the interface was well understood. I think the change suggested in this PR is an improvement. It's a simple clean model that a test case is either available in a profile or not. I guess it would be helpful to have different error messages when attempting to run a completely unrecognized test case and when attempting to run a test case that's disabled in the effective profile. While we're on the topic of changing the semantics of |
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.
Looks fine. One might as well update or improve the documentation a bit for the affected code.
Decided to move the functionality to CLI, this PR is postponed while the change in CLI is proposed. |
The current behavior of |
I'm going with this option. I started doing it in #1308, so it will be finalized there. |
That is not acceptable. We must be able to run every test case when we troubleshooting something, or when we develop test zones. |
|
If the issues in zonemaster/zonemaster-cli#361 are fixed, and it is merged in combination with this, it will be fine. |
2a3848e to
598075b
Compare
I rebased on latest develop and it should now work properly. @matsduf @PNAX @mattias-p please re-review. |
Harmonize input arguments (with respect to 'run_all_for()' and 'run_module()') Remove message tag 'TEST_ARGS' Add conditional check for Test Case - trying to run a Test Case disabled by the profile will now return an error.
Update documentation of Zonemaster::Engine::test_method() Co-authored-by: Marc van der Wal <103426270+marc-vanderwal@users.noreply.github.com>
598075b to
62c4cd1
Compare
|
@matsduf I fixed one forgotten mention of basic00 in this PR, please re-approve. |
v2023.2 release testingTested with the "How to test" section and works as expected. |
Purpose
This PR proposes an update of function
Zonemaster::Engine::Test::run_one(). See the Changes section below.Context
Fixes #1278 and #1284
Changes
Zonemaster::Engine::Test::run_all_for()andZonemaster::Engine::Test::run_module())TEST_ARGS--> note that this was a feature only used in CLI and is now moved there: Retain the possibility to start a Test Case disabled in the profile zonemaster-cli#361
basic{01,02}to the default profileHow to test this PR
Tests should pass.
Also, attempting to run a Test Case disabled by the current profile will now return an error instead of running the test: