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

Function TestShowTheCorrectThreadDebugStatus

caddy/admin_test.go:51–84  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

49}
50
51func TestShowTheCorrectThreadDebugStatus(t *testing.T) {
52 tester := caddytest.NewTester(t)
53 tester.InitServer(`
54 {
55 skip_install_trust
56 admin localhost:2999
57 http_port `+testPort+`
58
59 frankenphp {
60 num_threads 3
61 max_threads 6
62 worker ../testdata/worker-with-counter.php 1
63 worker ../testdata/index.php 1
64 }
65 }
66
67 localhost:`+testPort+` {
68 route {
69 root ../testdata
70 rewrite worker-with-counter.php
71 php
72 }
73 }
74 `, "caddyfile")
75
76 debugState := getDebugState(t, tester)
77
78 // assert that the correct threads are present in the thread info
79 assert.Equal(t, debugState.ThreadDebugStates[0].State, "ready")
80 assert.Contains(t, debugState.ThreadDebugStates[1].Name, "worker-with-counter.php")
81 assert.Contains(t, debugState.ThreadDebugStates[2].Name, "index.php")
82 assert.Equal(t, debugState.ReservedThreadCount, 3)
83 assert.Len(t, debugState.ThreadDebugStates, 3)
84}
85
86func TestThreadDebugStateMetricsAfterRequests(t *testing.T) {
87 tester := caddytest.NewTester(t)

Callers

nothing calls this directly

Calls 1

getDebugStateFunction · 0.85

Tested by

no test coverage detected