fix: update tests for group fallback
This commit is contained in:
@@ -409,6 +409,7 @@ func (h *AuthHandler) ValidateInvitationCode(c *gin.Context) {
|
|||||||
Valid: true,
|
Valid: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// ForgotPasswordRequest 忘记密码请求
|
// ForgotPasswordRequest 忘记密码请求
|
||||||
type ForgotPasswordRequest struct {
|
type ForgotPasswordRequest struct {
|
||||||
Email string `json:"email" binding:"required,email"`
|
Email string `json:"email" binding:"required,email"`
|
||||||
|
|||||||
@@ -180,6 +180,7 @@ func TestAPIContracts(t *testing.T) {
|
|||||||
"image_price_4k": null,
|
"image_price_4k": null,
|
||||||
"claude_code_only": false,
|
"claude_code_only": false,
|
||||||
"fallback_group_id": null,
|
"fallback_group_id": null,
|
||||||
|
"fallback_group_id_on_invalid_request": null,
|
||||||
"created_at": "2025-01-02T03:04:05Z",
|
"created_at": "2025-01-02T03:04:05Z",
|
||||||
"updated_at": "2025-01-02T03:04:05Z"
|
"updated_at": "2025-01-02T03:04:05Z"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -458,6 +458,14 @@ func (s *groupRepoStubForInvalidRequestFallback) DeleteAccountGroupsByGroupID(_
|
|||||||
panic("unexpected DeleteAccountGroupsByGroupID call")
|
panic("unexpected DeleteAccountGroupsByGroupID call")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *groupRepoStubForInvalidRequestFallback) GetAccountIDsByGroupIDs(_ context.Context, _ []int64) ([]int64, error) {
|
||||||
|
panic("unexpected GetAccountIDsByGroupIDs call")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *groupRepoStubForInvalidRequestFallback) BindAccountsToGroup(_ context.Context, _ int64, _ []int64) error {
|
||||||
|
panic("unexpected BindAccountsToGroup call")
|
||||||
|
}
|
||||||
|
|
||||||
func TestAdminService_CreateGroup_InvalidRequestFallbackRejectsUnsupportedPlatform(t *testing.T) {
|
func TestAdminService_CreateGroup_InvalidRequestFallbackRejectsUnsupportedPlatform(t *testing.T) {
|
||||||
fallbackID := int64(10)
|
fallbackID := int64(10)
|
||||||
repo := &groupRepoStubForInvalidRequestFallback{
|
repo := &groupRepoStubForInvalidRequestFallback{
|
||||||
|
|||||||
@@ -2046,6 +2046,9 @@ func (s *AntigravityGatewayService) handleUpstreamError(ctx context.Context, pre
|
|||||||
fallbackMinutes = s.settingService.cfg.Gateway.AntigravityFallbackCooldownMinutes
|
fallbackMinutes = s.settingService.cfg.Gateway.AntigravityFallbackCooldownMinutes
|
||||||
}
|
}
|
||||||
defaultDur := time.Duration(fallbackMinutes) * time.Minute
|
defaultDur := time.Duration(fallbackMinutes) * time.Minute
|
||||||
|
if fallbackDur, ok := antigravityFallbackCooldownSeconds(); ok {
|
||||||
|
defaultDur = fallbackDur
|
||||||
|
}
|
||||||
ra := time.Now().Add(defaultDur)
|
ra := time.Now().Add(defaultDur)
|
||||||
if useScopeLimit {
|
if useScopeLimit {
|
||||||
log.Printf("%s status=429 rate_limited scope=%s reset_in=%v (fallback)", prefix, quotaScope, defaultDur)
|
log.Printf("%s status=429 rate_limited scope=%s reset_in=%v (fallback)", prefix, quotaScope, defaultDur)
|
||||||
|
|||||||
Reference in New Issue
Block a user