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

Function TestMetrics_DisabledMessage

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

Source from the content-addressed store, hash-verified

847}
848
849func TestMetrics_DisabledMessage(t *testing.T) {
850 cfg := testConfig(100, true)
851 cfg.Telemetry.MetricsEnabled = false
852 srv := New(cfg)
853 ts := httptest.NewServer(srv.Routes())
854 defer ts.Close()
855
856 resp, err := http.Get(ts.URL + "/metrics")
857 if err != nil {
858 t.Fatalf("metrics request failed: %v", err)
859 }
860 defer resp.Body.Close()
861
862 raw, _ := io.ReadAll(resp.Body)
863 if !strings.Contains(string(raw), "metrics disabled") {
864 t.Fatalf("expected metrics disabled message")
865 }
866}
867
868func postInfer(t *testing.T, baseURL string, payload map[string]any) (int, []byte) {
869 t.Helper()

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected