test: fix flaky HTTP server tests
These two tests have been causing lots of CI failures, both in Jenkins and GitHub actions. They incorrectly use common.platformTimeout()
, which scales a given amount of time by a factor that depends on the platform. However, these tests compute some times as common.platformTimeout(x * common.platformTimeout(y))
, effectively squaring the platform-dependent factor.
I also increased the base timeout from 1000ms to 2000ms. As a reference, I ran one of the tests (test-http-server-headers-timeout-keepalive.js
) with different base timeouts, 8000 times each, using 200 concurrent processes across 16 cores.
base timeout | successful | success rate |
---|---|---|
500ms | 7676 | 95.95 % |
600ms | 7911 | 98.89 % |
800ms | 7944 | 99.30 % |
1000ms | 7989 | 99.86 % |
2000ms | 7999 | 99.99 % |
Refs: https://github.com/nodejs/node/pull/41263 Fixes: https://github.com/nodejs/node/issues/42741