mirror of https://github.com/tailscale/tailscale/
MASSIVE: debug_test.go 0→1,452 lines, 54 tests! 🔍
Comprehensive testing for 14 debug HTTP handlers (495-line file with ZERO tests): • serveDebugPeerEndpointChanges - IP validation, IPv4/IPv6, endpoint retrieval • serveComponentDebugLogging - Component logging with duration control • serveDebugDialTypes - 4 parallel dial types testing • serveDebug - Main debug action handler (15+ actions: rebind, restun, notify, etc.) • serveDevSetStateStore - State store key/value management • serveDebugPacketFilterRules - Packet filter rules from netmap • serveDebugPacketFilterMatches - Packet filter matches retrieval • serveDebugBusEvents - Event bus streaming (not fully testable without bus) • serveEventBusGraph - Event bus graph topology • serveDebugLog - Log upload with rate limiting • serveDebugOptionalFeatures - Feature registration listing • serveDebugRotateDiscoKey - Disco key rotation Test coverage includes: ✓ Permission checks (PermitRead/PermitWrite) ✓ Method validation (POST/GET requirements) ✓ Parameter validation (missing/invalid/empty) ✓ Error handling (backend errors, network errors) ✓ Success cases with mock backends ✓ Edge cases (nil results, empty arrays, context cancellation) ✓ JSON encoding/decoding ✓ IPv4/IPv6 address handling ✓ Multi-line log messages ✓ Large log requests (100+ lines) Session total: 7,952 lines → Target: 10,000 (2,048 to go!)pull/17963/head
parent
4f23840e40
commit
97708b7f45