-
Notifications
You must be signed in to change notification settings - Fork 758
feat: validate crm high and low threshold input #4142
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
base: master
Are you sure you want to change the base?
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: JaviEst <[email protected]>
7783868 to
d8aa405
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
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.
Pull request overview
This PR adds validation for CRM (Critical Resource Monitoring) high and low threshold configuration values to address issue #2931. The changes ensure that percentage thresholds are between 0 and 100, and that low thresholds are less than high thresholds.
Key changes:
- Added
get_crm_config()helper method to theCrmclass to retrieve CRM configuration - Implemented validation logic in
low()andhigh()functions to check percentage bounds and threshold ordering - Added comprehensive test cases covering edge cases: values over 100, low >= high, high <= low, and valid configurations
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| crm/main.py | Added validation logic to low() and high() threshold configuration functions, and refactored config retrieval into a helper method |
| tests/crm_test.py | Added four new test methods to verify threshold validation for percentage bounds and ordering constraints |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: JaviEst <[email protected]>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: JaviEst <[email protected]>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: JaviEst <[email protected]>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
What I did
Resolved issue #2931 by validating the high and low threshold input values.
How I did it
Updated the high and low threshold config functions to validate both thresholds are between 0 and 100 for percentage type as well as validate the low threshold if smaller than the high threshold.
How to verify it
Run new implemented tests to verify the validation logic is enforced.