Add comprehensive test infrastructure for retry/response-validation tests
in proxy package. Provides httptest-based mock upstream server, test
helpers for request/response handling, and test-mode configuration for
fast test execution.
New file: proxy/helpers_test.go
- MockUpstream: Configurable HTTP server simulating Z.AI upstream
- Test scenarios: 429 with/without Retry-After, empty/invalid JSON body,
empty streaming, 422/500/404 responses, network errors, success
- Request builders: CreateProxyRequest, CreateMessagesRequest,
CreateStreaming/NonStreaming* helpers
- Response assertions: AssertStatusCode, AssertJSONBody, AssertResponseField,
AssertEmptyBody, AssertHeader, AssertContentType
- Proxy handler factory: CreateTestProxyHandler for configured test handlers
- Test execution helpers: ExecuteProxyRequest, ExecuteMessagesRequest
- Test-mode config: ConfigureTestEnv, GetTestMaxRetries (defaults to 1 for fast tests)
- Backoff delay helpers: CalculateBackoffDelay, CalculateTotalMaxDelay
Acceptance criteria met:
✅ New test helpers with httptest servers
✅ Helper functions for requests and assertions
✅ Test-mode env var for fast tests (MAX_RETRIES=1 default)
✅ go test ./proxy/ -run TestHelper passes
Co-Authored-By: Claude <noreply@anthropic.com>