CreateTestContext does not flush the response at the end of a handler,
unlike Engine.ServeHTTP. This caused confusion (issue #3443) when
ctx.Status(http.StatusCreated) was not observable in the
httptest.ResponseRecorder without calling ctx.Writer.WriteHeaderNow().
Added documentation to CreateTestContext and CreateTestContextOnly
explaining this behavior, plus a regression test verifying that
Status() buffers the code and WriteHeaderNow() flushes it.
Fixes#3443
- Implement TestRebuild404Handlers to verify 404 handler chain rebuilding
when global middleware is added via Use()
- Add waitForServerReady helper with exponential backoff to replace
unreliable time.Sleep() calls in integration tests
- Fix race conditions in TestRunEmpty, TestRunEmptyWithEnv, and
TestRunWithPort by using proper server readiness checks
- All tests now pass consistently with -race flag
This addresses the empty test function and eliminates flaky test failures
caused by insufficient wait times for server startup.
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>