-
Notifications
You must be signed in to change notification settings - Fork 24
Make age for reused test configurable #692
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
Make age for reused test configurable #692
Conversation
* Rearranges all methods connected to the [ZONEMASTER] section in the ini file so that they come after each other. * Adds POD documentation to all methods connected to the [ZONEMASTER] section. * No changes in code or logic.
Adds a new key, "age_reuse_previous_test", to the ini file that sets the time before a new test is executed, instead of reusing the previous test (of the same domain and with the same parameters). It replaces a hard coded value.
| Positiv integer (in seconds) for how old a previous test of the same | ||
| zone name and parameters must be before we start a new test. Internally | ||
| the value is converted to whole minutes. If the conversion results in | ||
| zero minutes, then the default value (600 seconds) is used. |
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.
Why is the unit seconds here, rather than minutes?
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 felt that seconds was a better unit, especially since other keys take seconds. I would rather turn it around and make it seconds all the way through. In the MySQL adapter it is converted to seconds before use.
If this is merged I will create a second PR where the time unit is seconds all the way through.
But I will not insist. If minutes is better I can take that.
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 see. Uniform units sure is a nice feature. Seconds it is. If we could also get rid of the rounding, that would be great!
lib/Zonemaster/Backend/Config.pm
Outdated
| =head3 INPUT | ||
| 'max_zonemaster_execution_time' from [ZONEMASTER] section in ini file. |
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.
Maybe link to the property in Configuration.md?
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.
Good suggestion, but those links will be broken until the updated Configuration.pm has been merged to master branch. I guess that is OK.
|
@mattias-p and @PNAX, can you review? |
ghost
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.
See my comments.
I also ran some tests, and this seems to work.
lib/Zonemaster/Backend/Config.pm
Outdated
| my $val = $self->{cfg}->val( 'ZONEMASTER', 'age_reuse_previous_test' ); | ||
| $val = ($val > 0) ? $val : 0; | ||
| $val = int ( ($val / 60) + 0.5); # in minutes | ||
| return ($val)? $val : 10; |
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.
A style remark: there is a missing space before the ?.
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.
Fixed. Some other PR can make it consistent in the module.
share/backend_config.ini
Outdated
| number_of_processes_for_batch_testing = 20 | ||
|
|
||
| #age_reuse_previous_test=600 | ||
| # |
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 think the line 23 should be blank to make a clear separation with the following WARNING clause that is related to maximal_number_of_retries.
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.
Fixed and made the warning clearer. For how long should maximal_number_of_retries be considered to be experimental?
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.
No idea... I found PR #544 where this parameter has been added. I understand that this option has not been fully tested (as the warning says) and that there might be issues with parallelism.
|
@PNAX, please re-review. |
lib/Zonemaster/Backend/Config.pm
Outdated
| =head3 RETURNS | ||
| Integer (number of seconds) |
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.
Do you consider validation to be out of scope for this PR? Otherwise it would make sense to add validation for this to the load_config method.
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.
It is out of scope for this PR to add validation for anything execept age_reuse_previous_test, but that is a good suggestion. For age_reuse_previous_test the validation is done such as if the value is not numeric and positive, it will be ignored. Should it croak instead?
I do not understand how to used load_config method for validation.
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.
On second thought it's probably better to leave the validation out for now and deal with it in #685.
lib/Zonemaster/Backend/Config.pm
Outdated
| =head3 RETURNS | ||
| Positive integer (default 600). |
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.
This default doesn't look right. Maybe you meant to add it to MaxZonemasterExecutionTime?
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.
Good catch. I will fix.
Release testing for v2021.1I verified this using the commands below on CentOS 7 and CentOS 8. sudo sed -i '/\bage_reuse_previous_test\b/ s/=.*/= 20/' /etc/zonemaster/backend_config.ini
sudo systemctl restart zm-rpcapi
sudo systemctl restart zm-testagent
zmtest example > /dev/null
sleep 10
zmtest example > /dev/null
sleep 20
zmtest example > /dev/null
# Verify that the two first zmtest commands report the same testid, but the third one reports a different one |
When creating a new test through RPCAPI it will first check if there is a recent test with the same test parameters. If so, and that test is not too old, a new test will not be created, instead the test result for that recent test will be reused.
As it is now, "not too old" is hard-coded to 10 minutes. That is probably a good choice in most cases, but sometimes that is too short and sometimes too long. This PR makes that configurable.
As a side effect, this PR sorts the methods in the "[ZONEMASTER]" section from the ini file in
lib/Zonemaster/Backend/Config.pmand also adds POD documentation to those methods.Updated 2021-05-17:
How to test this PR
age_reuse_testin backend_config.ini