skip rotating-file test on node 0.8; warn about rotating-file issues
This commit is contained in:
parent
1ad4a7596f
commit
4670906256
3 changed files with 29 additions and 10 deletions
|
@ -10,7 +10,8 @@ Known issues:
|
||||||
|
|
||||||
- [pull #125, pull #97, issue #73] Unref rotating-file timeout which was
|
- [pull #125, pull #97, issue #73] Unref rotating-file timeout which was
|
||||||
preventing processes from exiting (by https://github.com/chakrit and
|
preventing processes from exiting (by https://github.com/chakrit and
|
||||||
https://github.com/glenn-murray-bse).
|
https://github.com/glenn-murray-bse). Note: this only fixes the issue
|
||||||
|
for node 0.10 and above.
|
||||||
|
|
||||||
|
|
||||||
## bunyan 0.23.0
|
## bunyan 0.23.0
|
||||||
|
|
|
@ -643,6 +643,14 @@ used for anything else.</td>
|
||||||
|
|
||||||
## stream type: `rotating-file`
|
## stream type: `rotating-file`
|
||||||
|
|
||||||
|
**WARNING:** Users of Bunyan's `rotating-file` should (a) be using at least
|
||||||
|
bunyan 0.23.1 (with the fix for [this
|
||||||
|
issue](https://github.com/trentm/node-bunyan/pull/97)), and (b) should use at
|
||||||
|
least node 0.10 (node 0.8 does not support the `unref()` method on
|
||||||
|
`setTimeout(...)` needed for the mentioned fix). The symptom is that process
|
||||||
|
termination will hang for up to a full rotation period.
|
||||||
|
|
||||||
|
|
||||||
A `type === 'rotating-file'` is a file stream that handles file automatic
|
A `type === 'rotating-file'` is a file stream that handles file automatic
|
||||||
rotation.
|
rotation.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
/*
|
/*
|
||||||
* Test that bunyan process will terminate
|
* Test that bunyan process will terminate.
|
||||||
|
*
|
||||||
|
* Note: Currently (bunyan 0.23.1) this fails on node 0.8, because there is
|
||||||
|
* no `unref` in node 0.8 and bunyan doesn't yet have `Logger.prototype.close()`
|
||||||
|
* support.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var exec = require('child_process').exec;
|
var exec = require('child_process').exec;
|
||||||
|
@ -11,7 +15,12 @@ if (require.cache[__dirname + '/tap4nodeunit.js'])
|
||||||
var tap4nodeunit = require('./tap4nodeunit.js');
|
var tap4nodeunit = require('./tap4nodeunit.js');
|
||||||
var test = tap4nodeunit.test;
|
var test = tap4nodeunit.test;
|
||||||
|
|
||||||
test('log with rotating file stream will terminate gracefully', function (t) {
|
var nodeVer = process.versions.node.split('.').map(Number);
|
||||||
|
|
||||||
|
if (nodeVer[0] <= 0 && nodeVer[1] <= 8) {
|
||||||
|
console.warn('skip test (node <= 0.8)');
|
||||||
|
} else {
|
||||||
|
test('log with rotating file stream will terminate gracefully', function (t) {
|
||||||
exec('node ' +__dirname + '/process-exit.js', {timeout: 1000},
|
exec('node ' +__dirname + '/process-exit.js', {timeout: 1000},
|
||||||
function (err, stdout, stderr) {
|
function (err, stdout, stderr) {
|
||||||
t.ifError(err);
|
t.ifError(err);
|
||||||
|
@ -19,4 +28,5 @@ test('log with rotating file stream will terminate gracefully', function (t) {
|
||||||
t.equal(stderr, '');
|
t.equal(stderr, '');
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue