(t *testing.T)
| 110 | } |
| 111 | |
| 112 | func TestIsRetryableStatusCode(t *testing.T) { |
| 113 | t.Parallel() |
| 114 | |
| 115 | tests := []struct { |
| 116 | statusCode int |
| 117 | expected bool |
| 118 | }{ |
| 119 | {500, true}, {502, true}, {503, true}, {504, true}, // Server errors |
| 120 | {408, true}, // Request timeout |
| 121 | {529, true}, // Anthropic overloaded |
| 122 | {429, false}, // Rate limit |
| 123 | {400, false}, {401, false}, {403, false}, {404, false}, // Client errors |
| 124 | {200, false}, // Not an error |
| 125 | {0, false}, // Unknown |
| 126 | } |
| 127 | |
| 128 | for _, tt := range tests { |
| 129 | t.Run(fmt.Sprintf("status_%d", tt.statusCode), func(t *testing.T) { |
| 130 | t.Parallel() |
| 131 | assert.Equal(t, tt.expected, isRetryableStatusCode(tt.statusCode), "isRetryableStatusCode(%d)", tt.statusCode) |
| 132 | }) |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | func TestIsContextOverflowError(t *testing.T) { |
| 137 | t.Parallel() |
nothing calls this directly
no test coverage detected