yyqdbngt opened a new pull request, #3830: URL: https://github.com/apache/rocketmq-dashboard/pull/3830
### Motivation The existing `MetricSampleTest` covers the value/availability cross-checks only. The remaining record invariants — the unavailable-reason guard, required field validation and defensive label copying — were untested. ### Changes - `availableSamplesCannotCarryAnUnavailableReason`: an available sample with a reason is rejected. - `unavailableSamplesMayCarryAnUnavailableReason`: unavailable samples accept and expose a reason with empty labels by default. - `requiredFieldsAreValidated`: blank metricKey/instanceId raise `IllegalArgumentException` and a null domain raises a `NullPointerException` with its message. - `labelsAreDefensivelyCopied`: later mutation of the source map does not leak into the sample, and the sample's label map is immutable. ### Verification ``` mvn -B test -Dtest=MetricSampleTest [INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0 [INFO] BUILD SUCCESS ``` -- 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]
