-
Notifications
You must be signed in to change notification settings - Fork 8
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
Adding test for a valid config update after an invalid config #750
base: main
Are you sure you want to change the base?
Conversation
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 does not reproduces the failure. Please have a look deeper.
unittests for the refresh interval can be found in tests/unit/test_runner.py
. Consider starting there to go deeper into testing and bug reproduction.
wait_for_output(proc, "Config refresh interval is set to: 5 seconds", test_timeout=5) | ||
|
||
config.config_refresh_interval = None | ||
config.version = "invalid" |
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.
as described in
Logprep/logprep/util/configuration.py
Lines 434 to 435 in 0068804
version: str = field( | |
validator=validators.instance_of(str), converter=str, default="unset", eq=True |
config.version = "valid_again" | ||
config_path.write_text(config.as_json()) | ||
wait_for_output(proc, "Successfully reloaded configuration", test_timeout=10) | ||
wait_for_output(proc, "Config refresh interval is set to: 4 seconds", test_timeout=5) |
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.
as defined here
Lines 120 to 129 in 0068804
@_config_refresh_interval.setter | |
def _config_refresh_interval(self, value: int | None) -> None: | |
"""Set the configuration refresh interval in seconds.""" | |
if value is None: | |
self._configuration.config_refresh_interval = None | |
elif value <= 5: | |
self._configuration.config_refresh_interval = 5 | |
else: | |
self._configuration.config_refresh_interval = value | |
config.config_refresh_interval = None | ||
config.version = "invalid" | ||
config_path.write_text(config.as_json()) | ||
time.sleep(3) |
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.
sleep actions in test leads to flaking tests because you never know if a test run on a slower system does not needs some seconds more. It is better to wait for some condition in the logs for example.
No description provided.