chore: updated AGENTS.md with more testing guidelines - #16328
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates .agents/AGENTS.md to add guidelines recommending declarative container matchers over imperative loops and custom matchers for complex objects in tests. The review feedback correctly identifies that the provided example uses an undefined matcher HasTimeSeries and suggests a correction to make the example self-contained.
| EXPECT_THAT(recorded_metrics, Contains(HasTimeSeries(AllOf( | ||
| MetricType(HasSubstr("outstanding_rpcs")), | ||
| HasMetricLabel("channel_pool_lb_policy", Eq("RANDOM_TWO_LEAST_USED")))))); |
There was a problem hiding this comment.
The matcher HasTimeSeries is used in the example assertion but is not defined in the code snippet. Since MetricType and HasMetricLabel already inspect arg.metric(), we can remove the undefined HasTimeSeries wrapper to make the example self-contained and correct.
| EXPECT_THAT(recorded_metrics, Contains(HasTimeSeries(AllOf( | |
| MetricType(HasSubstr("outstanding_rpcs")), | |
| HasMetricLabel("channel_pool_lb_policy", Eq("RANDOM_TWO_LEAST_USED")))))); | |
| EXPECT_THAT(recorded_metrics, Contains(AllOf( | |
| MetricType(HasSubstr("outstanding_rpcs")), | |
| HasMetricLabel("channel_pool_lb_policy", Eq("RANDOM_TWO_LEAST_USED"))))); |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16328 +/- ##
=======================================
Coverage 92.23% 92.23%
=======================================
Files 2227 2227
Lines 209169 209169
=======================================
+ Hits 192929 192932 +3
+ Misses 16240 16237 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
colinmoy
left a comment
There was a problem hiding this comment.
See gemini bot's suggestion
No description provided.