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>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user