diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-29 16:43:24 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-29 16:43:24 +0300 |
| commit | 1125cdcda9590c81308ca82e6b0eb9fcb10e7a6e (patch) | |
| tree | c2001a019868b3a9447f0fc6b750fa4f787d90e4 | |
| parent | 367ccc473347959cb7edff5dbd1fc36977cf9f67 (diff) | |
test(httpclient): strengthen transport assertions (pq)
| -rw-r--r-- | internal/httpclient/client_test.go | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/internal/httpclient/client_test.go b/internal/httpclient/client_test.go index 787cc46..73de26a 100644 --- a/internal/httpclient/client_test.go +++ b/internal/httpclient/client_test.go @@ -49,16 +49,17 @@ func TestDo_UsesConfiguredTransportSettings(t *testing.T) { t.Fatalf("expected *http.Transport, got %T", defaultClient.Transport) } - if transport.TLSHandshakeTimeout != defaultTLSHandshakeTimeout { - t.Fatalf("expected TLS handshake timeout %v, got %v", defaultTLSHandshakeTimeout, transport.TLSHandshakeTimeout) + // Use explicit values so this test catches accidental policy drift in transport defaults. + if transport.TLSHandshakeTimeout != 10*time.Second { + t.Fatalf("expected TLS handshake timeout %v, got %v", 10*time.Second, transport.TLSHandshakeTimeout) } - if transport.ResponseHeaderTimeout != defaultResponseHeaderTimeout { - t.Fatalf("expected response header timeout %v, got %v", defaultResponseHeaderTimeout, transport.ResponseHeaderTimeout) + if transport.ResponseHeaderTimeout != 15*time.Second { + t.Fatalf("expected response header timeout %v, got %v", 15*time.Second, transport.ResponseHeaderTimeout) } - if transport.IdleConnTimeout != defaultIdleConnTimeout { - t.Fatalf("expected idle connection timeout %v, got %v", defaultIdleConnTimeout, transport.IdleConnTimeout) + if transport.IdleConnTimeout != 90*time.Second { + t.Fatalf("expected idle connection timeout %v, got %v", 90*time.Second, transport.IdleConnTimeout) } - if transport.MaxIdleConnsPerHost != defaultMaxIdleConnsPerHost { - t.Fatalf("expected max idle conns per host %d, got %d", defaultMaxIdleConnsPerHost, transport.MaxIdleConnsPerHost) + if transport.MaxIdleConnsPerHost != 10 { + t.Fatalf("expected max idle conns per host %d, got %d", 10, transport.MaxIdleConnsPerHost) } } |
