76ba500417
CI / docker (push) Successful in 2m4s
OpenAI-compatible AI gateway with Vue admin UI, multi-provider egress, ingress key governance, monitoring, and security controls. Co-authored-by: Cursor <cursoragent@cursor.com>
28 lines
657 B
Go
28 lines
657 B
Go
package gateway
|
|
|
|
import (
|
|
"net/http"
|
|
"testing"
|
|
)
|
|
|
|
func TestRetryableUpstreamStatus(t *testing.T) {
|
|
if !retryableUpstreamStatus(http.StatusTooManyRequests) {
|
|
t.Fatal("429 should be retryable")
|
|
}
|
|
if !retryableUpstreamStatus(http.StatusServiceUnavailable) {
|
|
t.Fatal("503 should be retryable")
|
|
}
|
|
if retryableUpstreamStatus(http.StatusBadRequest) {
|
|
t.Fatal("400 should not be retryable")
|
|
}
|
|
}
|
|
|
|
func TestTryNextKeyOnUpstreamStatus(t *testing.T) {
|
|
if !tryNextKeyOnUpstreamStatus(http.StatusTooManyRequests) {
|
|
t.Fatal("429 should try next key")
|
|
}
|
|
if !tryNextKeyOnUpstreamStatus(http.StatusUnauthorized) {
|
|
t.Fatal("401 should try next key")
|
|
}
|
|
}
|