Skip to content

Conversation

@JaviEst
Copy link

@JaviEst JaviEst commented Nov 28, 2025

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.

Copilot AI review requested due to automatic review settings November 28, 2025 14:24
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copilot finished reviewing on behalf of JaviEst November 28, 2025 14:25
Copy link
Contributor

Copilot AI left a 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 the Crm class to retrieve CRM configuration
  • Implemented validation logic in low() and high() 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.

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants