summaryrefslogtreecommitdiff
path: root/test/parallel/test-timers-same-timeout-wrong-list-deleted.js
AgeCommit message (Collapse)Author
2018-05-22timers: use only a single TimerWrap instanceAnatoli Papirovski
Hang all timer lists off a single TimerWrap and use the PriorityQueue to manage expiration priorities. This makes the Timers code clearer, consumes significantly less resources and improves performance. PR-URL: https://github.com/nodejs/node/pull/20555 Fixes: https://github.com/nodejs/node/issues/16105 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-02-06test: add common.mustNotCall()cjihrig
This commit adds a mustNotCall() helper for testing. This provides an alternative to using common.fail() as a callback, or creating a callback function for the sole purpose of calling common.fail(). PR-URL: https://github.com/nodejs/node/pull/11152 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
2016-12-22test: fix timers-same-timeout-wrong-list-deletedRich Trott
test-timers-same-timeout-wrong-list-deleted was flaky under load because there is no guarantee that a timer will fire within a given period of time. It had an exit handler that checked that the process was finishing in less than twice as much as a timer was set for. Under load, the timer could take over 200ms to fire even if it was set for 100ms, so this was causing the test to be flaky on CI from time to time. However, that timing check is unnecessary to identify the regression that the test was written for. When run with a version of Node.js that does not contain the fix that accompanied the test in its initial commit, an assertion indicating that there were still timers in the active timer list fired. So, this commit removes the exit handler timing check and relies on the existing robust active timers list length check. This allows us to move the test back to parallel because it does not seem to fail under load anymore. The test was refactored slightly, removing duplicated code to a function, using `assert.strictEqual()` instead of `assert.equal()`, changing a 10ms timer to 1ms, and improving the messages provided by assertions. Fixes: https://github.com/nodejs/node/issues/8459 PR-URL: https://github.com/nodejs/node/pull/10362 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2016-10-29test: fix freebsd10-64 CI failuresRich Trott
Remove unneeded timers from some tests and move others from parallel testing to sequential testing. This is to resolve test failures on freebsd10-64 on CI. The failures are all due to timers firing later than expected. Timers firing later than they are set for can happen on resource-constrained hosts and is not a bug. In general, it may be wise to put tests that depend on timing into sequential testing rather than parallel testing, as the timing can be affected by other simultaneously-running test processes. Fixes: https://github.com/nodejs/node/issues/8041 Fixes: https://github.com/nodejs/node/issues/9227 PR-URL: https://github.com/nodejs/node/pull/9317 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Julien Gilli <jgilli@nodejs.org> Reviewed-By: Johan Bergstrom <bugs@bergstroem.nu> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2016-07-29timers: fix cleanup of nested same-timeout timersErin Spiceland
For nested timers with the same timeout, we can get into a situation where we have recreated a timer list immediately before we need to clean up an old timer list with the same key. Fix: make sure the list to be deleted is the same instance as the list whose reference was used to determine that a cleanup is necessary. If it's not the same instance, a new list with the same key has been created, and it should not be deleted. Fixes: https://github.com/nodejs/node/issues/7722 PR-URL: https://github.com/nodejs/node/pull/7827 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Julien Gilli <jgilli@fastmail.fm>