Skip to content

Commit 44cfa79

Browse files
committed
Fix test
1 parent 24784c7 commit 44cfa79

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

circuitbreaker/circuitbreaker_test.go

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,35 @@ func TestDefaultIsFailure(t *testing.T) {
137137
{http.StatusInternalServerError, false},
138138
{http.StatusBadGateway, false},
139139
{http.StatusServiceUnavailable, true}, // 503
140-
{529, true}, // Anthropic Overloaded
141140
}
142141

143142
for _, tt := range tests {
144143
assert.Equal(t, tt.isFailure, DefaultIsFailure(tt.statusCode), "status code %d", tt.statusCode)
145144
}
146145
}
147146

147+
func TestAnthropicIsFailure(t *testing.T) {
148+
t.Parallel()
149+
150+
tests := []struct {
151+
statusCode int
152+
isFailure bool
153+
}{
154+
{http.StatusOK, false},
155+
{http.StatusBadRequest, false},
156+
{http.StatusUnauthorized, false},
157+
{http.StatusTooManyRequests, true}, // 429
158+
{http.StatusInternalServerError, false},
159+
{http.StatusBadGateway, false},
160+
{http.StatusServiceUnavailable, true}, // 503
161+
{529, true}, // Anthropic Overloaded
162+
}
163+
164+
for _, tt := range tests {
165+
assert.Equal(t, tt.isFailure, AnthropicIsFailure(tt.statusCode), "status code %d", tt.statusCode)
166+
}
167+
}
168+
148169
func TestStateToGaugeValue(t *testing.T) {
149170
t.Parallel()
150171

0 commit comments

Comments
 (0)