diff options
Diffstat (limited to 'internal/executor/ratelimit_test.go')
| -rw-r--r-- | internal/executor/ratelimit_test.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/internal/executor/ratelimit_test.go b/internal/executor/ratelimit_test.go index f45216f..1434810 100644 --- a/internal/executor/ratelimit_test.go +++ b/internal/executor/ratelimit_test.go @@ -77,6 +77,36 @@ func TestParseRetryAfter_NoRetryInfo(t *testing.T) { } } +// --- isQuotaExhausted tests --- + +func TestIsQuotaExhausted_GeminiDailyQuota(t *testing.T) { + err := errors.New("container execution failed: exit status 1\nTerminalQuotaError: You have exhausted your daily quota on this model.") + if !isQuotaExhausted(err) { + t.Error("want true for Gemini TerminalQuotaError, got false") + } +} + +func TestIsQuotaExhausted_GeminiExhaustedMessage(t *testing.T) { + err := errors.New("container execution failed: exit status 1\nyou have exhausted your daily quota") + if !isQuotaExhausted(err) { + t.Error("want true for 'exhausted your daily quota', got false") + } +} + +func TestIsQuotaExhausted_GeminiQuotaExceeded(t *testing.T) { + err := errors.New("container execution failed: exit status 1\nQuota exceeded for metric: generativelanguage.googleapis.com/generate_content_free_tier_requests") + if !isQuotaExhausted(err) { + t.Error("want true for Gemini free tier quota exceeded, got false") + } +} + +func TestIsQuotaExhausted_NotQuota(t *testing.T) { + err := errors.New("container execution failed: exit status 1") + if isQuotaExhausted(err) { + t.Error("want false for generic exit status 1, got true") + } +} + // --- runWithBackoff tests --- func TestRunWithBackoff_SuccessOnFirstTry(t *testing.T) { |
