Skip to content
This repository has been archived by the owner on Oct 16, 2021. It is now read-only.

Commit

Permalink
test: move timer-dependent test to sequential
Browse files Browse the repository at this point in the history
`test-regress-nodejsGH-897` is dependent on a timer firing within a period of
time. Especially on some of the FreeBSD hosts on CI, we have seen tests
like that fail when run in parallel. (This may have nothing to do with
FreeBSD and may just mean that the hosts are resource-constrained.) Move
this test to sequential as we have done with several other
timer-dependent tests recently.

The test has also been refactored and documented via comments.

PR-URL: nodejs/node#9487
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Santiago Gimeno <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
  • Loading branch information
Trott authored and addaleax committed Dec 8, 2016
1 parent e97c610 commit 9808985
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
15 changes: 0 additions & 15 deletions test/parallel/test-regress-GH-897.js

This file was deleted.

17 changes: 17 additions & 0 deletions test/sequential/test-regress-GH-897.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'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 more-or-less
// immediately.
//
// Ref: https://github.com/nodejs/node-v0.x-archive/pull/897

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

const t = Date.now();
setTimeout(common.mustCall(function() {
const diff = Date.now() - t;
assert.ok(diff < 100, `timer fired after ${diff} ms`);
}), 0.1);

0 comments on commit 9808985

Please sign in to comment.