Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test: fix flaky test-regress-GH-897
Even after being moved to `sequential` in
1ce05ad, `test-regress-GH-897` still
was occasionally flaky on Raspberry Pi devices on CI.

The test is especially sensitive to resource constraints. It failed
reliably on my laptop if I moved it to `parallel` and ran 32 competing
node test processes. Even for a flaky test, that's unusually low. I
typically don't see problems, even for flaky tests, until I get up to
around four times that number.

On a Raspberry Pi, of course, that sensitivity to resource constraints
will manifest much sooner.

This change checks the order of timers firing, rather than the duration
before a timer is fired. This eliminates the sensitivity to resource
constraints. The test can now be moved back to `parallel`. I am able to
run many copies of the test simultaneously without seeing test failures.

Fixes: #10073
  • Loading branch information
Trott committed Jan 19, 2017
commit 65d0489ca03f7d69a16b8b9b438aefeca49bbfed
20 changes: 20 additions & 0 deletions test/parallel/test-regress-GH-897.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

// Test for bug where a timer duration greater than 0 ms but less than 1 ms
// resulted in the duration being set for 1000 ms. The expected behavior is
// that the timeout would be set for 1 ms, and thus fire before timers set
// with values greater than 1ms.
//
// Ref: https://github.com/nodejs/node-v0.x-archive/pull/897

const common = require('../common');

let timer;

setTimeout(function() {
clearTimeout(timer);
}, 0.1); // 0.1 should be treated the same as 1, not 1000...

timer = setTimeout(function() {
common.fail('timers fired out of order');
}, 2); // ...so this timer should fire second.
17 changes: 0 additions & 17 deletions test/sequential/test-regress-GH-897.js

This file was deleted.