MCPcopy Create free account
hub / github.com/InferCore/InferCore / TestStatus_Success200

Function TestStatus_Success200

internal/server/server_test.go:671–708  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

669}
670
671func TestStatus_Success200(t *testing.T) {
672 srv := New(testConfig(100, true))
673 ts := httptest.NewServer(srv.Routes())
674 defer ts.Close()
675
676 resp, err := http.Get(ts.URL + "/status")
677 if err != nil {
678 t.Fatalf("status request failed: %v", err)
679 }
680 defer resp.Body.Close()
681
682 if resp.StatusCode != http.StatusOK {
683 t.Fatalf("expected 200, got %d", resp.StatusCode)
684 }
685
686 raw, err := io.ReadAll(resp.Body)
687 if err != nil {
688 t.Fatalf("read status body: %v", err)
689 }
690 var parsed map[string]any
691 if err := json.Unmarshal(raw, &parsed); err != nil {
692 t.Fatalf("status response invalid json: %v", err)
693 }
694
695 if parsed["service"] != "infercore" {
696 t.Fatalf("unexpected service value: %v", parsed["service"])
697 }
698 if _, ok := parsed["telemetry"]; !ok {
699 t.Fatalf("expected telemetry status summary")
700 }
701 if _, ok := parsed["scaling_signals"]; !ok {
702 t.Fatalf("expected scaling_signals in status payload")
703 }
704 backends, ok := parsed["backends"].([]any)
705 if !ok || len(backends) == 0 {
706 t.Fatalf("expected non-empty backends list")
707 }
708}
709
710func TestHealth_Success200(t *testing.T) {
711 srv := New(testConfig(100, true))

Callers

nothing calls this directly

Calls 4

RoutesMethod · 0.80
NewFunction · 0.70
testConfigFunction · 0.70
CloseMethod · 0.65

Tested by

no test coverage detected