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.
This commit is contained in:
sam committed 2026-10-09 12:27:45 +11:00
1 parent c4a441d1c3
commit 2418a81a9e
1 file changed
+3 -3
+3 -3
View File
@@ -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)