File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -948,6 +948,8 @@ func TestMaxWaitTime(t *testing.T) {
948948 }
949949 ` , "caddyfile" )
950950
951+ ctx := caddy .ActiveContext ()
952+
951953 // send 10 requests simultaneously, at least one request should be stalled longer than 1ns
952954 // since we only have 1 thread, this will cause a 504 Gateway Timeout
953955 wg := sync.WaitGroup {}
@@ -965,6 +967,20 @@ func TestMaxWaitTime(t *testing.T) {
965967 wg .Wait ()
966968
967969 require .True (t , success .Load (), "At least one request should have failed with a 504 Gateway Timeout status" )
970+ // Check metrics
971+ expectedMetrics := `
972+ # HELP frankenphp_queue_depth Number of regular queued requests
973+ # TYPE frankenphp_queue_depth gauge
974+ frankenphp_queue_depth{worker="service"} 0
975+ `
976+
977+ require .NoError (t ,
978+ testutil .GatherAndCompare (
979+ ctx .GetMetricsRegistry (),
980+ strings .NewReader (expectedMetrics ),
981+ "frankenphp_total_workers" ,
982+ "frankenphp_ready_workers" ,
983+ ))
968984}
969985
970986func getStatusCode (url string , t * testing.T ) int {
You can’t perform that action at this time.
0 commit comments