TestModuleMaxRequestsConcurrent verifies max_requests works under concurrent load in module mode. All requests must succeed despite threads restarting.
(t *testing.T)
| 44 | // TestModuleMaxRequestsConcurrent verifies max_requests works under concurrent load |
| 45 | // in module mode. All requests must succeed despite threads restarting. |
| 46 | func TestModuleMaxRequestsConcurrent(t *testing.T) { |
| 47 | const maxRequests = 10 |
| 48 | const totalRequests = 200 |
| 49 | |
| 50 | runTest(t, func(handler func(http.ResponseWriter, *http.Request), _ *httptest.Server, _ int) { |
| 51 | var wg sync.WaitGroup |
| 52 | |
| 53 | for i := 0; i < totalRequests; i++ { |
| 54 | wg.Add(1) |
| 55 | go func() { |
| 56 | defer wg.Done() |
| 57 | body, resp := testGet("http://example.com/index.php", handler, t) |
| 58 | assert.Equal(t, 200, resp.StatusCode) |
| 59 | assert.Contains(t, body, "I am by birth a Genevese") |
| 60 | }() |
| 61 | } |
| 62 | wg.Wait() |
| 63 | }, &testOptions{ |
| 64 | initOpts: []frankenphp.Option{ |
| 65 | frankenphp.WithNumThreads(8), |
| 66 | frankenphp.WithMaxRequests(maxRequests), |
| 67 | }, |
| 68 | }) |
| 69 | } |
nothing calls this directly
no test coverage detected