yyqdbngt opened a new pull request, #3579:
URL: https://github.com/apache/rocketmq-dashboard/pull/3579
### Summary
Adds the first dedicated unit test suite for `NativeAlertRulePolicy`, the
package-private validator that constrains rules targeting built-in native
metrics.
The policy enforces the metric-to-domain map, mandatory instance id, the
UNAVAILABLE-only rule for availability metrics, group/topic scoping and the
notification channel whitelist. The tests cover every rejection branch plus the
happy paths.
### Changes
-
`server/src/test/java/org/apache/rocketmq/studio/ops/alert/NativeAlertRulePolicyTest.java`
- `acceptsValidNativeAvailabilityRule` / `unknownMetricSkipsNativeChecks`:
happy paths.
- `rejectsUnsupportedChannel`: channel whitelist enforcement.
- `rejectsDomainMismatchForNativeMetric`: metric-to-domain enforcement.
- `rejectsMissingInstanceIdForNativeMetric`: instance id requirement.
- `rejectsUnavailableOperatorOnNonAvailabilityMetric`: UNAVAILABLE
restriction.
- `rejectsConsumerGroupOnNonGroupScopedMetric` /
`rejectsTopicOnNonTopicScopedMetric`: scoping guards.
- `acceptsConsumerLagRuleWithGroupScopedChecks`: valid group-scoped rule.
- `rejectsMalformedDuration`: duration parsing failure surfaces as 400.
### Testing
- `mvn -B test -Dtest=NativeAlertRulePolicyTest` passes (10 tests, all
green).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]