test(antigravity): add missing unit tests for upstream and custom model_mapping
- Add GetAccessToken upstream branch tests (success/failure/empty/nil) - Add mapAntigravityModel wildcard-target-equals-request edge case tests - Add upstream account smart retry test case - Add GeminiMessagesCompatService custom model_mapping and empty model tests
This commit is contained in:
@@ -526,6 +526,7 @@ func TestParseAntigravitySmartRetryInfo(t *testing.T) {
|
||||
func TestShouldTriggerAntigravitySmartRetry(t *testing.T) {
|
||||
oauthAccount := &Account{Type: AccountTypeOAuth, Platform: PlatformAntigravity}
|
||||
setupTokenAccount := &Account{Type: AccountTypeSetupToken, Platform: PlatformAntigravity}
|
||||
upstreamAccount := &Account{Type: AccountTypeUpstream, Platform: PlatformAntigravity}
|
||||
apiKeyAccount := &Account{Type: AccountTypeAPIKey}
|
||||
|
||||
tests := []struct {
|
||||
@@ -587,6 +588,23 @@ func TestShouldTriggerAntigravitySmartRetry(t *testing.T) {
|
||||
expectedShouldRateLimit: true,
|
||||
modelName: "claude-sonnet-4-5",
|
||||
},
|
||||
{
|
||||
name: "Upstream account with short delay - smart retry",
|
||||
account: upstreamAccount,
|
||||
body: `{
|
||||
"error": {
|
||||
"status": "RESOURCE_EXHAUSTED",
|
||||
"details": [
|
||||
{"@type": "type.googleapis.com/google.rpc.ErrorInfo", "metadata": {"model": "claude-sonnet-4-5"}, "reason": "RATE_LIMIT_EXCEEDED"},
|
||||
{"@type": "type.googleapis.com/google.rpc.RetryInfo", "retryDelay": "2s"}
|
||||
]
|
||||
}
|
||||
}`,
|
||||
expectedShouldRetry: true,
|
||||
expectedShouldRateLimit: false,
|
||||
minWait: 2 * time.Second,
|
||||
modelName: "claude-sonnet-4-5",
|
||||
},
|
||||
{
|
||||
name: "API Key account - should not trigger",
|
||||
account: apiKeyAccount,
|
||||
|
||||
Reference in New Issue
Block a user