Skip to content
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

Remove hardcoded file loader from test_rule.py #1100

Merged
merged 7 commits into from
Feb 2, 2023

Conversation

akusei
Copy link
Contributor

@akusei akusei commented Feb 2, 2023

Description

This PR is to remove the hardcoded file rule loader when testing with either elastalert-test-rule or using elastalert.test_rule. Currently the test will only use a file loader regardless of what you have configured for the rules_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.

Added ability for test rule to override loader to use file loader

When it actually just hardcodes it to 'file'.

I also renamed the overwrites parameter in config.py for the load_conf method to overrides. If this isn't desired, I don't mind dropping this change, it was just a bit of odd wording. The overwrites 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 older docker-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 the iter() method like the defaults for loop.

Checklist

  • I have reviewed the contributing guidelines.
  • I have included unit tests for my changes or additions.
  • I have successfully run make test-docker with my changes.
  • I have manually tested all relevant modes of the change in this PR.
  • I have updated the documentation.
  • I have updated the changelog.

Questions or Comments

jertel
jertel previously approved these changes Feb 2, 2023
Copy link
Owner

@jertel jertel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this contribution and for spending the time to get the missing unit tests added.

@jertel jertel merged commit 0d4306b into jertel:master Feb 2, 2023
@akusei akusei deleted the remove_overwrite branch February 2, 2023 19:46
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants