mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
737 B
28 lines
737 B
'use strict';
|
|
// test-cluster-worker-constructor.js
|
|
// validates correct behavior of the cluster.Worker constructor
|
|
|
|
require('../common');
|
|
var assert = require('assert');
|
|
var cluster = require('cluster');
|
|
var worker;
|
|
|
|
worker = new cluster.Worker();
|
|
assert.equal(worker.suicide, undefined);
|
|
assert.equal(worker.state, 'none');
|
|
assert.equal(worker.id, 0);
|
|
assert.equal(worker.process, undefined);
|
|
|
|
worker = new cluster.Worker({
|
|
id: 3,
|
|
state: 'online',
|
|
process: process
|
|
});
|
|
assert.equal(worker.suicide, undefined);
|
|
assert.equal(worker.state, 'online');
|
|
assert.equal(worker.id, 3);
|
|
assert.equal(worker.process, process);
|
|
|
|
worker = cluster.Worker.call({}, {id: 5});
|
|
assert(worker instanceof cluster.Worker);
|
|
assert.equal(worker.id, 5);
|
|
|