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

Function TestHealth_Success200

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

Source from the content-addressed store, hash-verified

708}
709
710func TestHealth_Success200(t *testing.T) {
711 srv := New(testConfig(100, true))
712 ts := httptest.NewServer(srv.Routes())
713 defer ts.Close()
714
715 resp, err := http.Get(ts.URL + "/health")
716 if err != nil {
717 t.Fatalf("health request failed: %v", err)
718 }
719 defer resp.Body.Close()
720
721 if resp.StatusCode != http.StatusOK {
722 t.Fatalf("expected 200, got %d", resp.StatusCode)
723 }
724
725 raw, err := io.ReadAll(resp.Body)
726 if err != nil {
727 t.Fatalf("read health body: %v", err)
728 }
729 var parsed map[string]any
730 if err := json.Unmarshal(raw, &parsed); err != nil {
731 t.Fatalf("health response invalid json: %v", err)
732 }
733 if parsed["status"] != "ok" {
734 t.Fatalf("expected status ok, got %v", parsed["status"])
735 }
736}
737
738func TestMetrics_Success200(t *testing.T) {
739 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