fix(mcp): use result in error message instead of nil err in create test#3763
fix(mcp): use result in error message instead of nil err in create test#3763Ankitsinghsisodya wants to merge 1 commit into
Conversation
Updated the error handling in the TestTool_Create_Args test to provide a more descriptive message when an unexpected error result occurs. This enhances the clarity of test failures and aids in debugging.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Ankitsinghsisodya The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @Ankitsinghsisodya. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Fixes an incorrect test failure path in TestTool_Create_Args by reporting the actual tool execution result rather than reusing a stale err value.
Changes:
- Replace
t.Fatal(err)with a more informativet.Fatalf(...)whenresult.IsErroris true.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| if result.IsError { | ||
| t.Fatal(err) | ||
| t.Fatalf("unexpected error result: %v", result) |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3763 +/- ##
==========================================
- Coverage 57.06% 56.95% -0.12%
==========================================
Files 181 181
Lines 21145 21145
==========================================
- Hits 12067 12043 -24
- Misses 7855 7882 +27
+ Partials 1223 1220 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Problem
In
TestTool_Create_Args, after a successfulclient.CallToolcall, theerror branch reads:
CallToolreturned(result, nil)—erris guaranteed nil at this pointsince it was already checked on the lines above. If
result.IsErrorevertriggers,
t.Fatal(nil)prints<nil>, giving zero diagnostic informationabout what actually failed.
Fix
Replace with the pattern used consistently across every other tool test in
this package:
No behaviour change — this only affects the failure message when the test
fails.