Remove hardcoded file loader from test_rule.py #1100
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR is to remove the hardcoded file rule loader when testing with either
elastalert-test-rule
or usingelastalert.test_rule
. Currently the test will only use a file loader regardless of what you have configured for therules_loader
setting. This prevents proper testing when a custom rule loader is required for a valid rule to be loaded.Based on the original commit message, the changes done in that commit don't line up with the message.
When it actually just hardcodes it to 'file'.
I also renamed the
overwrites
parameter inconfig.py
for theload_conf
method tooverrides
. If this isn't desired, I don't mind dropping this change, it was just a bit of odd wording. Theoverwrites
parameter is not being used by the existing code-base so nothing else here needs to change. This will be a breaking change for anyone who is calling load_conf and providing the overwrites as a named parameter. It will need to be renamed to overrides. I'm okay if this change is denied.I had to modify the Makefile to account for the newer
docker compose
command while maintaining existing functionality with the olderdocker-compose
command.In removing the hardcoded value I noticed there were no unit tests for loading configurations with defaults and overrides so I added them. The tests initially failed as the original for loop on overrides used
iteritems()
rather than theiter()
method like thedefaults
for loop.Checklist
make test-docker
with my changes.Questions or Comments