Skip to content

test: expand test coverage from 7 to 65 cases - #1

Merged
proxyBug merged 1 commit into
mainfrom
claude/test-coverage-analysis-OGkUC
Jun 1, 2026
Merged

test: expand test coverage from 7 to 65 cases#1
proxyBug merged 1 commit into
mainfrom
claude/test-coverage-analysis-OGkUC

Conversation

@proxyBug

@proxyBug proxyBug commented Jun 1, 2026

Copy link
Copy Markdown
Owner

$(cat <<'EOF'

Summary

  • Grows the test suite from 7 to 65 test cases across 14 test classes
  • Adds first-ever coverage for cli.py, render_json, render_table, format_report, and all collection-orchestration functions
  • All tests use mocks so they run offline with no real ss, netstat, docker, or /proc access

What's new

Area Classes added Key scenarios
_safe_int SafeIntTests valid int, non-numeric, empty, None
parse_process_field ParseProcessFieldTests single process, systemd preference, all-systemd fallback
parse_netstat_line ParseNetstatLineTests TCP LISTEN, UDP (UNCONN state), header skip, too-few-fields
lookup_user LookupUserTests None pid, missing /proc, PermissionError, uid→name resolution
infer_systemd_unit InferSystemdUnitTests None pid, missing cgroup file, service unit extraction
_dedupe_notes DedupNotesTests dedup, blank filtering, order preservation
collect_listening_sockets CollectListeningSocketsTests ss success, netstat fallback, no tools, ss stderr note
collect_docker_containers CollectDockerContainersTests not installed, ps failure, successful JSON parse
collect_inventory CollectInventoryTests docker skip, note merging, note dedup
render_json RenderJsonTests valid JSON, newline, endpoint fields
render_table RenderTableTests section headers, column headers, data, empty message, notes
format_report FormatReportTests json/table/markdown dispatch, unknown-format fallback
build_parser BuildParserTests defaults, --no-docker, --no-systemd, --format, --output
main MainTests no subcommand→1, scan→0, flag forwarding, file output

Test plan

  • python -m unittest discover -s tests -v → 65 passed, 0 failed

https://claude.ai/code/session_01LFeBf9uLHNE2vu4fodoNnh
EOF
)


Generated by Claude Code

Add tests for all previously untested modules and functions:
- _safe_int, parse_process_field (including multi-process/systemd preference logic)
- parse_netstat_line (TCP, UDP, header-skip, too-few-fields)
- lookup_user and infer_systemd_unit with /proc edge cases (missing, permission denied)
- _dedupe_notes (dedup, blank filtering, order preservation)
- collect_listening_sockets (ss success, netstat fallback, no tools, stderr note)
- collect_docker_containers (not installed, ps failure, successful parse)
- collect_inventory (docker skip, note merging, dedup)
- render_json, render_table, format_report dispatcher
- build_parser flag coverage and main() integration (no-subcommand, file output, flag forwarding)

https://claude.ai/code/session_01LFeBf9uLHNE2vu4fodoNnh
@proxyBug
proxyBug marked this pull request as ready for review June 1, 2026 18:59
@proxyBug
proxyBug merged commit 6796b35 into main Jun 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants