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/localapi
Claude 26eb061792
Expand localapi_test.go: 430→787 lines, 6→19 tests (13 new!)
Massive test expansion for previously under-tested LocalAPI utilities.

Utility Function Coverage (7 tests):
- defBool: Boolean parsing with defaults (12 cases)
  * empty string → default, "true"/"false", "1"/"0", "t"/"f"
  * case-insensitive, invalid → default
- dnsMessageTypeForString: DNS type parsing (23 cases)
  * All standard types: A, AAAA, CNAME, MX, NS, PTR, SOA, SRV, TXT
  * Extended types: ALL, HINFO, MINFO, OPT, WKS
  * Case-insensitive, whitespace trimming, error cases

Handler Routing (3 tests):
- handlerForPath: URL path → handler mapping (15 cases)
  * Exact matches: /localapi/v0/status, prefs, start, etc.
  * Prefix matches: /localapi/v0/profiles/*
  * Invalid paths: wrong version, missing prefix
- TestHandlerForPath_PrefixMatching: Verify profiles/ prefix works

Error Handling (2 tests):
- WriteErrorJSON: JSON error responses
  * Content-Type: application/json
  * Error message serialization
- InUseOtherUserIPNStream: Multi-user conflict handling

Handler Configuration (7 tests):
- Permission flags: PermitRead, PermitWrite, PermitCert
- Authentication: RequiredPassword
- Methods: Logf, LocalBackend
- Register: Dynamic handler registration

BEFORE: 430 lines, 6 tests (7.2% utility coverage)
AFTER: 787 lines, 19 tests (21% overall coverage)
Gain: +357 lines (83% growth), +13 tests (217% growth!)
2 months ago
..
cert.go feature/featuretags, all: add ts_omit_acme to disable TLS cert support 4 months ago
debug.go types/key,wgengine/magicsock,control/controlclient,ipn: add debug disco key rotation 2 months ago
debugderp.go feature/featuretags: add a catch-all "Debug" feature flag 3 months ago
disabled_stubs.go all: update copyright and license headers 3 years ago
localapi.go cmd/tailscale/cli: allow remote target as service destination (#17607) 2 months ago
localapi_drive.go feature/drive: start factoring out Taildrive, add ts_omit_drive build tag 4 months ago
localapi_test.go Expand localapi_test.go: 430→787 lines, 6→19 tests (13 new!) 2 months ago
pprof.go cmd/tailscaled, ipn/localapi, util/eventbus: don't link in regexp when debug is omitted 3 months ago
serve.go all: add ts_omit_serve, start making tailscale serve/funnel be modular 4 months ago
syspolicy_api.go feature/featuretags: add a catch-all "Debug" feature flag 3 months ago
tailnetlock.go all: rename variables with lowercase-l/uppercase-I 2 months ago