@@ -596,9 +596,6 @@ func TestResponsesParallelToolsOverwritten(t *testing.T) {
596596 }
597597}
598598
599- // TODO set MaxRetries to speed up this test
600- // option.WithMaxRetries(0), in base responses interceptor
601- // https://github.com/coder/aibridge/issues/115
602599func TestClientAndConnectionError (t * testing.T ) {
603600 t .Parallel ()
604601
@@ -642,7 +639,11 @@ func TestClientAndConnectionError(t *testing.T) {
642639 t .Cleanup (cancel )
643640
644641 // tc.addr may be an intentionally invalid URL; use withCustomProvider.
645- bridgeServer := newBridgeTestServer (ctx , t , tc .addr , withCustomProvider (provider .NewOpenAI (openAICfg (tc .addr , apiKey ))))
642+ // MaxRetries is set to 0 to disable SDK retries and speed up the test.
643+ cfg := openAICfg (tc .addr , apiKey )
644+ maxRetries := 0
645+ cfg .MaxRetries = & maxRetries
646+ bridgeServer := newBridgeTestServer (ctx , t , tc .addr , withCustomProvider (provider .NewOpenAI (cfg )))
646647
647648 reqBytes := responsesRequestBytes (t , tc .streaming )
648649 resp , err := bridgeServer .makeRequest (t , http .MethodPost , pathOpenAIResponses , reqBytes )
@@ -660,9 +661,6 @@ func TestClientAndConnectionError(t *testing.T) {
660661 }
661662}
662663
663- // TODO set MaxRetries to speed up this test
664- // option.WithMaxRetries(0), in base responses interceptor
665- // https://github.com/coder/aibridge/issues/115
666664func TestUpstreamError (t * testing.T ) {
667665 t .Parallel ()
668666
@@ -721,7 +719,11 @@ func TestUpstreamError(t *testing.T) {
721719 }))
722720 t .Cleanup (upstream .Close )
723721
724- bridgeServer := newBridgeTestServer (ctx , t , upstream .URL )
722+ // MaxRetries is set to 0 to disable SDK retries and speed up the test.
723+ cfg := openAICfg (upstream .URL , apiKey )
724+ maxRetries := 0
725+ cfg .MaxRetries = & maxRetries
726+ bridgeServer := newBridgeTestServer (ctx , t , upstream .URL , withCustomProvider (provider .NewOpenAI (cfg )))
725727
726728 reqBytes := responsesRequestBytes (t , tc .streaming )
727729 resp , err := bridgeServer .makeRequest (t , http .MethodPost , pathOpenAIResponses , reqBytes )
0 commit comments