Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: expand error message #15991

Closed
wants to merge 3 commits into from
Closed

Conversation

sharpstef
Copy link
Contributor

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

test

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Oct 6, 2017
@mscdex mscdex added the cluster Issues and PRs related to the cluster subsystem. label Oct 6, 2017
@@ -7,11 +7,11 @@ if (cluster.isMaster) {
const worker = cluster.fork();
assert.ok(
!worker.isDead(),
'isDead() should return false right after the worker has been created.');
`isDead() returned ${worker.isDead()}. isDead() should return false right after the worker has been created.`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line length exceeds 80 characters. To make sure the function is only called a single time it would also be better to use a extra variable as in const workerState = !worker.isDead() and check for that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sharpstef ... woo! first PR! This is super close but as @BridgeAR indicates there are some style nits that can be addressed by the person landing the PR but definitely feel free to address. Specifically what @BridgeAR is asking for would be a change to make it look like:

const workerDead = worker.isDead;
assert.ok(!workerDead,
          `isDead() returned ${workerDead}. isDead() should return `  +
          'false right after the worker has been created.');

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On it

@Trott Trott added the code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. label Oct 7, 2017
@joyeecheung
Copy link
Member


worker.on('exit', function() {
assert.ok(worker.isDead(),
'After an event has been emitted, isDead should return true');
assert.ok(workerDead,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests have failed:

not ok 282 parallel/test-cluster-worker-isdead
  ---
  duration_ms: 0.460
  severity: fail
  stack: |-
    assert.js:45
      throw new errors.AssertionError({
      ^
    
    AssertionError [ERR_ASSERTION]: isDead() returned false. After an event has been emitted, isDead should return true
        at Worker.<anonymous> (/usr/home/iojs/build/workspace/node-test-commit-freebsd/nodes/freebsd11-x64/test/parallel/test-cluster-worker-isdead.js:14:12)
        at emitTwo (events.js:136:13)
        at Worker.emit (events.js:227:7)
        at ChildProcess.worker.process.once (internal/cluster/master.js:184:12)
        at Object.onceWrapper (events.js:335:30)
        at emitTwo (events.js:136:13)
        at ChildProcess.emit (events.js:227:7)
        at Process.ChildProcess._handle.onexit (internal/child_process.js:210:12)
  ...
ok 283 parallel/test-cluster-worker-kill

We cannot use the cached variable here. Please restore this to worker.isDead()

@joyeecheung
Copy link
Member

@BridgeAR BridgeAR self-assigned this Oct 18, 2017
BridgeAR pushed a commit that referenced this pull request Oct 19, 2017
PR-URL: #15991
Reviewed-By: Yosuke Furukawa <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@BridgeAR
Copy link
Member

Landed in b07aa92

Thanks for the PR, and congratulations on becoming a Node.js Contributor 🎉 !

@BridgeAR BridgeAR closed this Oct 19, 2017
MylesBorins pushed a commit that referenced this pull request Oct 23, 2017
PR-URL: #15991
Reviewed-By: Yosuke Furukawa <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: James M Snell <[email protected]>
addaleax pushed a commit to ayojs/ayo that referenced this pull request Oct 26, 2017
PR-URL: nodejs/node#15991
Reviewed-By: Yosuke Furukawa <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Nov 16, 2017
PR-URL: #15991
Reviewed-By: Yosuke Furukawa <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Nov 21, 2017
MylesBorins pushed a commit that referenced this pull request Nov 21, 2017
PR-URL: #15991
Reviewed-By: Yosuke Furukawa <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Nov 28, 2017
PR-URL: #15991
Reviewed-By: Yosuke Furukawa <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: James M Snell <[email protected]>
addaleax pushed a commit to ayojs/ayo that referenced this pull request Dec 7, 2017
PR-URL: nodejs/node#15991
Reviewed-By: Yosuke Furukawa <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cluster Issues and PRs related to the cluster subsystem. code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants