File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -840,6 +840,8 @@ func TestMaxWaitTime(t *testing.T) {
840840 }
841841 ` , "caddyfile" )
842842
843+ ctx := caddy .ActiveContext ()
844+
843845 // send 10 requests simultaneously, at least one request should be stalled longer than 1ns
844846 // since we only have 1 thread, this will cause a 504 Gateway Timeout
845847 wg := sync.WaitGroup {}
@@ -857,6 +859,20 @@ func TestMaxWaitTime(t *testing.T) {
857859 wg .Wait ()
858860
859861 require .True (t , success .Load (), "At least one request should have failed with a 504 Gateway Timeout status" )
862+ // Check metrics
863+ expectedMetrics := `
864+ # HELP frankenphp_queue_depth Number of regular queued requests
865+ # TYPE frankenphp_queue_depth gauge
866+ frankenphp_queue_depth{worker="service"} 0
867+ `
868+
869+ require .NoError (t ,
870+ testutil .GatherAndCompare (
871+ ctx .GetMetricsRegistry (),
872+ strings .NewReader (expectedMetrics ),
873+ "frankenphp_total_workers" ,
874+ "frankenphp_ready_workers" ,
875+ ))
860876}
861877
862878func getStatusCode (url string , t * testing.T ) int {
You can’t perform that action at this time.
0 commit comments