From 5fe4ee1da11039dd229ee8d30ed137a3e2a1f155 Mon Sep 17 00:00:00 2001 From: zy6p Date: Thu, 2 Jul 2026 14:33:55 +0800 Subject: [PATCH] style(test): gofmt oauth passthrough tests --- .../service/openai_oauth_passthrough_test.go | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/backend/internal/service/openai_oauth_passthrough_test.go b/backend/internal/service/openai_oauth_passthrough_test.go index c56856faab..3fbdbf8534 100644 --- a/backend/internal/service/openai_oauth_passthrough_test.go +++ b/backend/internal/service/openai_oauth_passthrough_test.go @@ -841,12 +841,12 @@ func TestOpenAIGatewayService_OpenAIPassthrough_RetryableStatusesTriggerFailover } testCases := []struct { - name string - accountType string - statusCode int - body string + name string + accountType string + statusCode int + body string expectFailover bool - assertRepo func(t *testing.T, repo *openAIPassthroughFailoverRepo, start time.Time) + assertRepo func(t *testing.T, repo *openAIPassthroughFailoverRepo, start time.Time) }{ { name: "oauth_429_rate_limit", @@ -864,10 +864,10 @@ func TestOpenAIGatewayService_OpenAIPassthrough_RetryableStatusesTriggerFailover }, }, { - name: "oauth_529_overload", - accountType: AccountTypeOAuth, - statusCode: 529, - body: `{"error":{"message":"server overloaded","type":"server_error"}}`, + name: "oauth_529_overload", + accountType: AccountTypeOAuth, + statusCode: 529, + body: `{"error":{"message":"server overloaded","type":"server_error"}}`, expectFailover: true, assertRepo: func(t *testing.T, repo *openAIPassthroughFailoverRepo, start time.Time) { require.Empty(t, repo.rateLimitCalls) @@ -876,10 +876,10 @@ func TestOpenAIGatewayService_OpenAIPassthrough_RetryableStatusesTriggerFailover }, }, { - name: "oauth_502_bad_gateway", - accountType: AccountTypeOAuth, - statusCode: http.StatusBadGateway, - body: `{"error":{"message":"bad gateway","type":"server_error"}}`, + name: "oauth_502_bad_gateway", + accountType: AccountTypeOAuth, + statusCode: http.StatusBadGateway, + body: `{"error":{"message":"bad gateway","type":"server_error"}}`, expectFailover: false, assertRepo: func(t *testing.T, repo *openAIPassthroughFailoverRepo, _ time.Time) { require.Empty(t, repo.rateLimitCalls) @@ -887,10 +887,10 @@ func TestOpenAIGatewayService_OpenAIPassthrough_RetryableStatusesTriggerFailover }, }, { - name: "oauth_503_unavailable", - accountType: AccountTypeOAuth, - statusCode: http.StatusServiceUnavailable, - body: `{"error":{"message":"service unavailable","type":"server_error"}}`, + name: "oauth_503_unavailable", + accountType: AccountTypeOAuth, + statusCode: http.StatusServiceUnavailable, + body: `{"error":{"message":"service unavailable","type":"server_error"}}`, expectFailover: false, assertRepo: func(t *testing.T, repo *openAIPassthroughFailoverRepo, _ time.Time) { require.Empty(t, repo.rateLimitCalls) @@ -898,10 +898,10 @@ func TestOpenAIGatewayService_OpenAIPassthrough_RetryableStatusesTriggerFailover }, }, { - name: "oauth_504_gateway_timeout", - accountType: AccountTypeOAuth, - statusCode: http.StatusGatewayTimeout, - body: `{"error":{"message":"gateway timeout","type":"server_error"}}`, + name: "oauth_504_gateway_timeout", + accountType: AccountTypeOAuth, + statusCode: http.StatusGatewayTimeout, + body: `{"error":{"message":"gateway timeout","type":"server_error"}}`, expectFailover: false, assertRepo: func(t *testing.T, repo *openAIPassthroughFailoverRepo, _ time.Time) { require.Empty(t, repo.rateLimitCalls) @@ -924,10 +924,10 @@ func TestOpenAIGatewayService_OpenAIPassthrough_RetryableStatusesTriggerFailover }, }, { - name: "apikey_529_overload", - accountType: AccountTypeAPIKey, - statusCode: 529, - body: `{"error":{"message":"server overloaded","type":"server_error"}}`, + name: "apikey_529_overload", + accountType: AccountTypeAPIKey, + statusCode: 529, + body: `{"error":{"message":"server overloaded","type":"server_error"}}`, expectFailover: true, assertRepo: func(t *testing.T, repo *openAIPassthroughFailoverRepo, start time.Time) { require.Empty(t, repo.rateLimitCalls) @@ -1016,7 +1016,7 @@ func TestOpenAIGatewayService_OpenAIPassthrough_CompactNetworkErrorsTriggerFailo expectFailover: true, }, { - name: "read_error", + name: "read_error", resp: &http.Response{ StatusCode: http.StatusOK, Header: http.Header{"Content-Type": []string{"application/json"}, "x-request-id": []string{"rid-compact"}},