You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailscale/ipn
Claude d6a66bf444
Services config testing: serveconf_test.go 0→581 lines, 10 tests!
Comprehensive test suite for ipn/conffile/serveconf.go (239 lines):

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📦 serveconf_test.go: 0→581 lines (10 tests)
Target: serveconf.go (239 lines, Tailscale Services config)

Coverage:

1️⃣ Target.UnmarshalJSON (1 test, 12 cases)
  • TUN mode: "TUN" → ProtoTUN
  • HTTP/HTTPS/HTTPS+insecure protocols
  • TCP, TLS-terminated-TCP protocols
  • File protocol with path cleaning
  • IPv6 addresses: [::1]:8080, [2001:db8::1]:443
  • Error cases: no protocol, unsupported protocol

2️⃣ Target.MarshalText (1 test, 7 cases)
  • All protocols: TUN, http, https, tcp, file
  • Format: "protocol://destination:port"
  • TUN special case: "TUN"
  • Unsupported protocol → error

3️⃣ Round-trip Testing (1 test, 7 cases)
  • Unmarshal → Marshal → Unmarshal
  • Verify Protocol, Destination, DestinationPorts
  • All protocol types

4️⃣ Protocol Constants (1 test, 7 protocols)
  • ProtoHTTP = "http"
  • ProtoHTTPS = "https"
  • ProtoHTTPSInsecure = "https+insecure"
  • ProtoTCP = "tcp"
  • ProtoTLSTerminatedTCP = "tls-terminated-tcp"
  • ProtoFile = "file"
  • ProtoTUN = "TUN"

5️⃣ Port Ranges (1 test, 2 cases)
  • Single port: 8080
  • Port range: 8000-8100

6️⃣ findOverlappingRange (1 test, 7 cases)
  • No overlap, exact match
  • Needle contains haystack, vice versa
  • Partial overlaps (start/end)
  • Empty haystack

7️⃣ ServicesConfigFile Structure (1 test)
  • Version = "0.0.1"
  • Services map validation
  • Endpoints configuration

8️⃣ ServiceDetailsFile.Advertised (1 test, 3 cases)
  • opt.Bool: true, false, unset
  • Get() returns proper values

9️⃣ File Path Cleaning (1 test, 4 cases)
  • Absolute: /var/www/html
  • Relative: ./public → public
  • Double slashes: var//www → var/www
  • Parent refs: var/www/../static → var/static

🔟 IPv6 Addresses (1 test, 2 cases)
  • [::1]:8080
  • [2001:db8::1]:443

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Test Highlights:
 JSON marshaling/unmarshaling
 All 7 service protocols
 Port range overlap detection
 Path cleaning & normalization
 IPv6 support
 Error handling for invalid inputs

STATS:
Before: 239-line file with NO dedicated tests
After: 581 lines of tests, 10 test functions
Coverage boost: Service config parsing fully tested!
2 months ago
..
auditlog syncs: add Mutex/RWMutex alias/wrappers for future mutex debugging 2 months ago
conffile Services config testing: serveconf_test.go 0→581 lines, 10 tests! 2 months ago
desktop go.mod: bump golang.org/x/crypto (#17907) 2 months ago
ipnauth Merge branch 'main' into claude/analyze-test-coverage-01BnJsiXhLinMJyRe78R29e9 2 months ago
ipnext ipn/ipnlocal: remove all the weird locking (LockedOnEntry, UnlockEarly, etc) 2 months ago
ipnlocal ipn/ipnlocal: remove the always-true CanSupportNetworkLock() 2 months ago
ipnserver feature/featuretags, all: add build features, use existing ones in more places 4 months ago
ipnstate Merge branch 'main' into claude/analyze-test-coverage-01BnJsiXhLinMJyRe78R29e9 2 months ago
lapitest various: allow tailscaled shutdown via LocalAPI 4 months ago
localapi Expand localapi_test.go: 430→787 lines, 6→19 tests (13 new!) 2 months ago
policy Add comprehensive tests for critical untested packages 2 months ago
store Merge branch 'main' into claude/analyze-test-coverage-01BnJsiXhLinMJyRe78R29e9 2 months ago
backend.go types/netmap: remove PrivateKey from NetworkMap 2 months ago
backend_test.go Boost ipn/backend_test.go: 42→326 lines (7.8x), comprehensive coverage 2 months ago
conf.go ipn: ensure that conffile is source of truth for advertised services. (#15361) 10 months ago
conf_test.go Massive config test suite: ipn/conf_test.go 0→721 lines, 19 tests! 2 months ago
doc.go ipn: generate LoginProfileView and use it instead of *LoginProfile where appropriate 12 months ago
ipn_clone.go ipn{,/local},cmd/tailscale: add "sync" flag and pref to disable control map poll 2 months ago
ipn_test.go all: do not depend on the testing package 2 years ago
ipn_view.go ipn{,/local},cmd/tailscale: add "sync" flag and pref to disable control map poll 2 months ago
prefs.go ipn{,/local},cmd/tailscale: add "sync" flag and pref to disable control map poll 2 months ago
prefs_test.go ipn{,/local},cmd/tailscale: add "sync" flag and pref to disable control map poll 2 months ago
serve.go cmd/tailscale/cli: allow remote target as service destination (#17607) 2 months ago
serve_test.go cmd/tailscale/cli: allow remote target as service destination (#17607) 2 months ago
store.go tailcfg: report StateEncrypted in Hostinfo (#16434) 7 months ago
store_test.go ipn/store: automatically migrate between plaintext and encrypted state (#16318) 7 months ago