[test-improver] Improve tests for tracing package#7497
Merged
lpcox merged 1 commit intoJun 14, 2026
Conversation
…JSON endpoints Add missing test cases to resolve_endpoint_test.go that cover the previously-uncovered 'continue' statement in resolveJSONExtraEndpoints when a JSON array entry has an empty or whitespace-only URL field. Also add a missing 'empty string returns empty' case to TestNormalizeExtraEndpoint to make the table complete. Coverage: 97.2% → 97.5% Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Jun 14, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves test coverage in internal/tracing by exercising previously-uncovered defensive behavior in resolveJSONExtraEndpoints and by making the normalizeExtraEndpoint table test more exhaustive.
Changes:
- Added a table-case asserting
normalizeExtraEndpoint("")returns"". - Added three tests for JSON-array
GH_AW_OTLP_ENDPOINTSentries where"url"is empty/whitespace, ensuring those entries are skipped and that “all invalid” returnsnil.
Show a summary per file
| File | Description |
|---|---|
| internal/tracing/resolve_endpoint_test.go | Adds targeted test cases to cover empty/whitespace JSON url entries and expands normalizeExtraEndpoint test table coverage. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test Improvements:
resolve_endpoint_test.goFile Analyzed
internal/tracing/resolve_endpoint_test.gointernal/tracingImprovements Made
1. Increased Coverage
TestResolveExtraEndpoints_JSONArray_EmptyURL— verifies that a JSON-formatGH_AW_OTLP_ENDPOINTSentry with an emptyurlfield is silently skipped while valid entries are still returnedTestResolveExtraEndpoints_JSONArray_WhitespaceURL— verifies that a whitespace-onlyurlfield is also skippedTestResolveExtraEndpoints_JSONArray_AllEmptyURLsReturnsNil— verifies that when all entries have empty/whitespace URLs,nilis returned (no valid endpoints)Previous Coverage: 97.2%
New Coverage: 97.5%
Improvement: +0.3%
The previously uncovered statement was the
continueatconfig_resolver.go:217–218insideresolveJSONExtraEndpoints:This path is triggered when a JSON array entry like
{"url":""}or{"url":" "}normalizes to an empty string.2. Better Testing Patterns
"empty string returns empty"case toTestNormalizeExtraEndpointtable, making the table exhaustive (empty string and whitespace-only are now both explicit cases)t.Setenv+resolveExtraEndpoints(nil)+require.Len/assert.Equal/assert.Nil)Test Execution
All tests pass:
All 25 Go packages pass (
make agent-finishedGo tests OK; Rust tests skipped due to Cargo registry network restriction in CI environment).Why These Changes?
resolveJSONExtraEndpointsdefensively skips endpoints that normalize to an empty string, but this guard was never exercised by the test suite. The three new tests close that gap using the samet.Setenv+ direct function call pattern already established in the file, making the defensive code provably correct and covered.Generated by Test Improver Workflow
Focuses on better patterns, increased coverage, and more stable tests
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
index.crates.ioSee Network Configuration for more information.