feat: close v3 governance evidence and slo metrics wiring
This commit is contained in:
@@ -3,11 +3,14 @@ package app
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"sub2api-cn-relay-manager/internal/metrics"
|
||||
"sub2api-cn-relay-manager/internal/routing"
|
||||
)
|
||||
|
||||
@@ -205,12 +208,20 @@ func TestNewActionSetResolveRouteFlow(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("ListRouteFailoverEvents() error = %v", err)
|
||||
}
|
||||
if len(failovers) != 1 {
|
||||
t.Fatalf("ListRouteFailoverEvents() len = %d, want 1", len(failovers))
|
||||
}
|
||||
if failovers[0].FromRouteID != "codex2api" || failovers[0].ToRouteID != "asxs" || failovers[0].FailureCount != 2 {
|
||||
t.Fatalf("ListRouteFailoverEvents()[0] = %+v, want codex2api -> asxs failure_count 2", failovers[0])
|
||||
}
|
||||
|
||||
req := httptest.NewRequest(http.MethodGet, "/metrics", nil)
|
||||
rr := httptest.NewRecorder()
|
||||
metrics.Handler().ServeHTTP(rr, req)
|
||||
body := rr.Body.String()
|
||||
if !strings.Contains(body, "route_decisions_total") {
|
||||
t.Fatal("metrics missing route_decisions_total after resolve flow")
|
||||
}
|
||||
if !strings.Contains(body, "route_failovers_total") {
|
||||
t.Fatal("metrics missing route_failovers_total after fallback flow")
|
||||
}
|
||||
}
|
||||
|
||||
func TestResolveRouteHelpers(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user