Repository navigation
[test] Add tests for envutil.GetEnvDuration - #14893
Merged
Merged
Conversation
Co-authored-by: Copilot <[email protected]>
Contributor
Author
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE Notes:
|
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The test-only changes exercise the intended branches and restore shared state; remaining suggestions are non-blocking.
1 open finding
What changed in this PR
Adds in-process tests for environment parsing helpers so enabled logging callbacks contribute to coverage.
Changes:
- Adds a helper that enables debug logging and restores the original logger.
- Tests duration, integer, and boolean parsing with valid and fallback inputs.
| File | Description |
|---|---|
| internal/envutil/envutil_debuglog_test.go | Adds debug-enabled parsing and fallback tests. |
🧠 Review effort: Max
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| t.Run(tt.name, func(t *testing.T) { | ||
| enableEnvUtilDebugLogger(t) | ||
| t.Setenv("TEST_DURATION_INPROC", tt.value) | ||
| assert.Equal(t, tt.expected, GetEnvDuration("TEST_DURATION_INPROC", tt.def)) |
This was referenced Oct 14, 2026
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 Coverage Improvement: GetEnvDuration
Function Analyzed
internal/envutilGetEnvDuration(and the sharedGetEnvIntlogging callback)GetEnvDuration), 85.7% (GetEnvInt)Why This Function?
After a full coverage run,
GetEnvDurationwas the lowest-covered non-trivial function in a high-coverage codebase. Its debug-log callback was only exercised in a re-exec'd subprocess, so it was never counted by coverage.Tests Added
internal/envutil/envutil_debuglog_test.goswapslogEnvUtilfor an enabled logger in-process and covers:GetEnvIntvalid/zero/negative/non-numeric with logging enabledGetEnvBooltrue/false/unrecognized with logging enabledTest Execution
go test ./internal/envutil/passes (coverage 98.6%).Generated by Test Coverage Improver
Warning
Firewall blocked 4 domains
The following domains were blocked by the firewall during workflow execution:
example.comnonexistent.localslow.example.comthishostdoesnotexist12345.comTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.