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/client/local
Claude ffe2832998
DOUBLE STRIKE: 2 more untested files → 982 lines of tests!
Created comprehensive test suites for final 2 untested client/local files:

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

📦 tailnetlock_test.go: 0→601 lines (12 tests)
Target: tailnetlock.go (204 lines, Network Lock / TKA)

Coverage:
 NetworkLockInit: JSON encoding (3 tests)
  • Keys, DisablementValues, SupportDisablement
  • Empty, nil slices handling
 NetworkLockWrapPreauthKey: Request structure (3 tests)
  • TSKey + TKAKey pairing
  • Empty, long key handling
  • Round-trip verification
 NetworkLockModify: Add/Remove keys (5 tests)
  • Add-only, remove-only, both, empty, nil
  • 0-5 key combinations
 NetworkLockSign: Rotation keys (3 tests)
  • No rotation, with rotation
  • Ed25519 public key size (32 bytes)
 NetworkLockLog: URL query parameters (4 tests)
  • Limit formatting: 0, 50, 1000, -1
 NetworkLockForceLocalDisable: Empty JSON payload
  • Produces exactly "{}\n"
 NetworkLockVerifySigningDeeplink: URL validation (3 tests)
  • Standard deeplinks, empty, localhost
 NetworkLockGenRecoveryAUM: Recovery generation (3 tests)
  • 0, 1, 5 keys with fork hash
 NetworkLockAffectedSigs: KeyID byte handling (3 tests)
  • Short, empty, long (32-byte) IDs
 NetworkLockCosignRecoveryAUM: AUM serialization
  • Serialize → Reader → ReadAll verification
 NetworkLockDisable: Secret byte handling (4 tests)
  • Short, empty, nil, 256-byte secrets
 JSON decoding: NetworkLockStatus, NetworkLockUpdate[]

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

📦 syspolicy_test.go: 0→381 lines (10 tests)
Target: syspolicy.go (40 lines, system policy)

Coverage:
 GetEffectivePolicy: Scope marshaling (4 tests)
  • device, user, empty, custom scopes
  • MarshalText → URL path construction
 Scope marshal error handling
  • Mock error propagation
 ReloadEffectivePolicy: URL construction (3 tests)
  • /localapi/v0/policy/{scope} paths
  • GET vs POST method verification
 Snapshot JSON encoding/decoding (2 tests)
  • Empty, nil snapshots
  • Round-trip verification
 Special characters in scope IDs (6 tests)
  • Alphanumeric, hyphen, underscore, dot
  • Slash, space (URL encoding needed)
 Edge cases (4 tests)
  • 1000-char scope, Unicode (日本語, 中文)
  • Only numbers, single character
 HTTP method verification
  • GET for GetEffectivePolicy
  • POST for ReloadEffectivePolicy
 Snapshot decoding: {}, null, invalid JSON, arrays
 Scope equality testing

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

STATS:
Before: 2 files (244 lines) with ZERO tests
After: 982 lines of tests, 22 test functions
Coverage: ∞% growth (0 → 982!)

All client/local/*.go files NOW TESTED! 
3 weeks ago
..
cert.go feature/featuretags, all: add ts_omit_acme to disable TLS cert support 3 months ago
cert_test.go TRIPLE KILL: 3 untested files → 1,129 lines of tests! 3 weeks ago
debugportmapper.go feature/portmapper: make the portmapper & its debugging tools modular 3 months ago
debugportmapper_test.go TRIPLE KILL: 3 untested files → 1,129 lines of tests! 3 weeks ago
local.go cmd/tailscale/cli: allow remote target as service destination (#17607) 3 weeks ago
local_test.go Expand local_test.go: 74 → 218 lines, 3 → 13 tests (nearly 3x!) 3 weeks ago
serve.go all: add ts_omit_serve, start making tailscale serve/funnel be modular 3 months ago
serve_test.go TRIPLE KILL: 3 untested files → 1,129 lines of tests! 3 weeks ago
syspolicy.go util/syspolicy: finish adding ts_omit_syspolicy build tags, tests 3 months ago
syspolicy_test.go DOUBLE STRIKE: 2 more untested files → 982 lines of tests! 3 weeks ago
tailnetlock.go all: add ts_omit_tailnetlock as a start of making it build-time modular 3 months ago
tailnetlock_test.go DOUBLE STRIKE: 2 more untested files → 982 lines of tests! 3 weeks ago