From 2418a81a9e287c1fb28f70731cc62cffb2f8edc7 Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Fri, 9 Oct 2026 12:27:45 +1100 Subject: [PATCH] fix(egress): use context-aware dial and request in the token-endpoint test net.Dial and httptest.NewRequest fail the noctx linter, so the gate was red on the commit that added the test. --- internal/infrastructure/egress/proxy_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/infrastructure/egress/proxy_test.go b/internal/infrastructure/egress/proxy_test.go index 6f1e989c4..a9f042b20 100644 --- a/internal/infrastructure/egress/proxy_test.go +++ b/internal/infrastructure/egress/proxy_test.go @@ -49,8 +49,8 @@ func TestTokenEndpointRefusedWhenNotGranted(t *testing.T) { proxy := NewProxy(nil, ProxyOptions{ Resolver: ResolverFunc(func(context.Context, string, string) (string, error) { return "", ErrUnbound }), OAuthStore: stubOAuthStore{}, - Dial: func(context.Context, string, string) (net.Conn, error) { - return net.Dial("tcp", upstream.Listener.Addr().String()) + Dial: func(ctx context.Context, _, _ string) (net.Conn, error) { + return (&net.Dialer{}).DialContext(ctx, "tcp", upstream.Listener.Addr().String()) }, }) session := &Session{ @@ -63,7 +63,7 @@ func TestTokenEndpointRefusedWhenNotGranted(t *testing.T) { } session.atRun.Store(true) - req := httptest.NewRequest(http.MethodPost, "http://token.example/token", strings.NewReader("grant_type=authorization_code")) + req := httptest.NewRequestWithContext(context.Background(), http.MethodPost, "http://token.example/token", strings.NewReader("grant_type=authorization_code")) rec := httptest.NewRecorder() proxy.forward(context.Background(), rec, req, session, "http", "token.example", 80)