MCPcopy Index your code
hub / github.com/php/frankenphp / TestPrometheusMetrics_StartWorkerRequest

Function TestPrometheusMetrics_StartWorkerRequest

metrics_test.go:98–128  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

96}
97
98func TestPrometheusMetrics_StartWorkerRequest(t *testing.T) {
99 m := createPrometheusMetrics()
100 m.TotalWorkers("test_worker", 2)
101 m.StartWorkerRequest("test_worker")
102
103 inputs := []struct {
104 name string
105 c prometheus.Collector
106 metadata string
107 expect string
108 }{
109 {
110 name: "Testing BusyWorkers",
111 c: m.busyWorkers,
112 metadata: `
113 # HELP frankenphp_busy_workers Number of busy PHP workers for this worker
114 # TYPE frankenphp_busy_workers gauge
115 `,
116 expect: `
117 frankenphp_busy_workers{worker="test_worker"} 1
118 `,
119 },
120 }
121
122 for _, input := range inputs {
123 t.Run(input.name, func(t *testing.T) {
124 require.NoError(t, testutil.CollectAndCompare(input.c, strings.NewReader(input.metadata+input.expect)))
125 })
126
127 }
128}
129
130func TestPrometheusMetrics_TestStopReasonCrash(t *testing.T) {
131 m := createPrometheusMetrics()

Callers

nothing calls this directly

Calls 3

createPrometheusMetricsFunction · 0.85
TotalWorkersMethod · 0.65
StartWorkerRequestMethod · 0.65

Tested by

no test coverage detected