Repository navigation
test(netstat): cover parseAddr edge cases - #1045
Merged
Merged
Conversation
Add table tests for parseAddr covering IPv4/IPv6 parsing and edge cases (missing port, bad IP length, invalid hex). The lower-level parser was only exercised indirectly through the full doNetstat file/proc path, leaving port-conflict edge cases without focused regression coverage.
✅ Deploy Preview for images-devsy-sh canceled.
|
✅ Deploy Preview for devsydev canceled.
|
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 5 |
| Duplication | 0 |
AI Reviewer: run a review on demand. To trigger the first review automatically, go to your organization or repository integration settings. AI can make mistakes. Always validate suggestions.
TIP This summary will be updated as you push new changes.
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.
Package reviewed
pkg/netstat(tunneling/networking category)Issue found
parseAddr— the lower-level socket-address parser that splits/proc/net/tcp*IP:porthex fields into aSockAddr— was only exercised indirectly through the fulldoNetstatpath. That path couples parsing with file I/O and/procprocess-info extraction, so the parser's own edge cases (port-conflict parsing: missing port, malformed IP length, invalid hex) had no focused regression coverage. A regression inparseAddr(e.g. a change to the field-split or length switch) would only surface as a broaddoNetstatfailure rather than a precise, localized test failure.Change
Add
TestParseAddrtable tests topkg/netstat/netstat_util_test.gocovering:0100007F:0050→127.0.0.1:80)0000...0000:0016→:::22):) → errorZZ:0050) → error0100007G:0050) → error0100007F:zzzz) → errorPure test addition — no behavioral or production code changes.
Verification
task cli:format— clean.task cli:lint:ci— 0 issues.task cli:test— passes. The only failing suite ispkg/git(TestRepoCloneArgsThroughRunner,TestRepoCloneFromInfoBranch,TestRepoCloneFromInfoHelper), the documented known pre-existing failure onorigin/main; this change does not touchpkg/git.task cli:build:grpcnot required.This PR was created by an AI agent as part of an automated daily package review job.