Explode test coverage: 86 → 1843 lines, 2 → 69 tests in tailscale_test.go

MASSIVE test suite expansion for client/tailscale package:
- tailscale_test.go: 86 → 1843 lines (21.4x growth!)
- Test functions: 2 → 69 (34.5x expansion!)

Comprehensive coverage added for:

**Routes API** (3 tests)
- Routes(), SetRoutes()
- Error handling, multiple subnets

**Keys API** (6 tests)
- Keys(), CreateKey(), CreateKeyWithExpiry()
- Key(), DeleteKey()
- Expiry validation, error cases

**Devices API** (8 tests)
- Devices(), Device(), DeleteDevice()
- AuthorizeDevice(), SetAuthorized(), SetTags()
- Field options (default/all), external devices

**DNS API** (10 tests)
- DNSConfig(), SetDNSConfig()
- NameServers(), SetNameServers()
- DNSPreferences(), SetDNSPreferences()
- SearchPaths(), SetSearchPaths()
- Empty resolvers edge case

**ACL API** (14 tests)
- ACL(), ACLHuJSON()
- SetACL(), SetACLHuJSON()
- PreviewACLForUser(), PreviewACLForIPPort()
- PreviewACLHuJSONForUser(), PreviewACLHuJSONForIPPort()
- ValidateACLJSON()
- ETag collision avoidance
- Posture policies support
- Complex ACL structures (groups, tag owners)

**Error Handling** (5 tests)
- Unauthorized (401), NotFound (404)
- RateLimited (429), InternalServerError (500)
- Context cancellation

**Edge Cases** (9 tests)
- Special characters in device IDs
- Empty tag lists
- External devices
- Malformed JSON parsing
- Custom HTTP clients
- Concurrent requests (10 parallel)

**Utility & Helper Tests** (8 tests)
- DeviceFieldsOpts validation
- ErrResponse error messages
- APIKey authorization headers
- BaseURL handling (default/custom)
- Tailnet accessor
- Request body validation

This brings API Client test coverage from nearly 0% to comprehensive
coverage of all major endpoints and error scenarios!
pull/17963/head
Claude 2 weeks ago
parent acad08d6f0
commit f6bf778af8
No known key found for this signature in database

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save