File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -375,7 +375,7 @@ func TestTimeoutWithFullEchoStack(t *testing.T) {
375375
376376// NOTE: timeout middleware is first as it changes Response.Writer and causes data race for logger middleware if it is not first
377377e .Use (TimeoutWithConfig (TimeoutConfig {
378- Timeout : 15 * time .Millisecond ,
378+ Timeout : 100 * time .Millisecond ,
379379}))
380380e .Use (Logger ())
381381e .Use (Recover ())
@@ -403,8 +403,13 @@ func TestTimeoutWithFullEchoStack(t *testing.T) {
403403}
404404if tc .whenForceHandlerTimeout {
405405wg .Done ()
406+ // extremely short periods are not reliable for tests when it comes to goroutines. We can not guarantee in which
407+ // order scheduler decides do execute: 1) request goroutine, 2) timeout timer goroutine.
408+ // most of the time we get result we expect but Mac OS seems to be quite flaky
409+ time .Sleep (50 * time .Millisecond )
410+
406411// shutdown waits for server to shutdown. this way we wait logger mw to be executed
407- ctx , cancel := context .WithTimeout (context .Background (), 150 * time .Millisecond )
412+ ctx , cancel := context .WithTimeout (context .Background (), 200 * time .Millisecond )
408413defer cancel ()
409414server .Shutdown (ctx )
410415}
You can’t perform that action at this time.
0 commit comments