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 revisions #10551

Closed
wants to merge 4 commits into from
Closed

Conversation

DavidGoussev
Copy link
Contributor

test: implement callback wrapper common.mustCall

In test/parallel/test-stream2-readable-wrap.js:

  • replace process.on('exit', ...) block by wrapping all callbacks with common.mustCall
  • replace assert.equal() with assert.strictEqual()
  • add a duration of 1 second to setTimeout() on line 61
  • replace var with const or let

@nodejs-github-bot nodejs-github-bot added test Issues and PRs related to the tests. lts-watch-v6.x labels Dec 31, 2016
@mscdex mscdex added the stream Issues and PRs related to the stream subsystem. label Dec 31, 2016
@mscdex
Copy link
Contributor

mscdex commented Dec 31, 2016

First line of commit messages must be <= 50 characters.

var old = new EE();
var r = new Readable({ highWaterMark: highWaterMark,
const old = new EE();
const r = new Readable({ highWaterMark: highWaterMark,
objectMode: objectMode });
Copy link
Contributor

Choose a reason for hiding this comment

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

The indentation needs to be adjusted here to re-align with the first 'h'.


var ended = false;
r.on('end', function() {
let ended = false;
Copy link
Contributor

@mscdex mscdex Dec 31, 2016

Choose a reason for hiding this comment

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

This can be removed completely, along with any references since we're already ensuring 'end' is seen via common.mustCall() right below.

function flow() {
flowing = true;
while (flowing && chunks-- > 0) {
var item = produce();
const item = produce();
expected.push(item);
console.log('old.emit', chunks, flowing);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove all of these console.* statements.

@@ -52,19 +49,18 @@ function runTest(highWaterMark, objectMode, produce) {
}
}

var w = new Writable({ highWaterMark: highWaterMark * 2,
const w = new Writable({ highWaterMark: highWaterMark * 2,
objectMode: objectMode });
Copy link
Contributor

Choose a reason for hiding this comment

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

Indentation here needs to be adjusted as well.

w._write = function(chunk, encoding, cb) {
console.log('_write', chunk);
written.push(chunk);
setTimeout(cb);
setTimeout(cb, 1000);
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be 1 instead of 1000.

w._write = function(chunk, encoding, cb) {
console.log('_write', chunk);
written.push(chunk);
setTimeout(cb);
setTimeout(cb, 1000);
Copy link
Member

Choose a reason for hiding this comment

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

Can you change this to 1 instead of 1000? No duration specified defaults to 1ms, so using 1 keeps the behavior identical but makes things more explicit.

runTest(100, false, function() { return Buffer.allocUnsafe(100); });
runTest(10, false, function() { return Buffer.from('xxxxxxxxxx'); });
runTest(1, true, function() { return { foo: 'bar' }; });
runTest(100, false, common.mustCall(function() { return Buffer.allocUnsafe(100); });
Copy link
Member

Choose a reason for hiding this comment

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

There's a missing ) at the end of this line. This is a syntax error. This file won't run. (It looks the pull request template was deleted. It asks that make -j4 test before submitting the pull request.)

@@ -1,24 +1,21 @@
'use strict';
require('../common');
Copy link
Member

Choose a reason for hiding this comment

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

common is undefined because this line has not been changed to const common = require('../common'); So again, there's no way this test can actually run as is.

@mscdex
Copy link
Contributor

mscdex commented Dec 31, 2016

@Trott
Copy link
Member

Trott commented Dec 31, 2016

Single host failing on CI is an unrelated build infrastructure issue. CI looks good.

@Trott
Copy link
Member

Trott commented Dec 31, 2016

LGTM. Thanks for doing this!

@gibfahn
Copy link
Member

gibfahn commented Dec 31, 2016

FYI, your name for this commit is set as dpg5000, people normally use their full name. If you want to change it the commands are:

# To change it everywhere:
git config --global user.name "David Goussev"

# To change it for a single commit:
git commit --amend --no-edit  --author="David Goussev <dgoussev@gmail.com>"

Whoever lands this Pull Request can do it for you as part of the landing process instead if you'd like. If you don't want to change it that's totally fine too!

Trott pushed a commit to Trott/io.js that referenced this pull request Jan 3, 2017
Use common.mustCall() where appropriate, var to const/let,
assert.equal() -> assert.strictEqual(), explicit time provided to
setTimeout()

PR-URL: nodejs#10551
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
@Trott
Copy link
Member

Trott commented Jan 3, 2017

Landed in e1fedfb.
Thanks for the contribution! 🎉

@Trott Trott closed this Jan 3, 2017
@evanlucas
Copy link
Contributor

This is not landing cleanly on v7.x-staging. If you would like to see it there, a backport pull request would need to be opened.

@Trott
Copy link
Member

Trott commented Jan 4, 2017

@evanlucas curl -L https://github.com/nodejs/node/pull/10551.patch | git am -3 is landing cleanly for me on v7.x-staging.

@Trott
Copy link
Member

Trott commented Jan 4, 2017

@evanlucas (Is the key that a cherry-pick has to land cleanly?)

@Trott
Copy link
Member

Trott commented Jan 6, 2017

@evanlucas You can use this, then? Or would you prefer @dpg5000 create a second PR with these changes against the v7.x-staging branch?

I suppose another possibility is don't worry about it at all and just let these changes stick around in master and only hit a release branch come v8.0.0 in April. These changes don't affect users.

italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 18, 2017
Use common.mustCall() where appropriate, var to const/let,
assert.equal() -> assert.strictEqual(), explicit time provided to
setTimeout()

PR-URL: nodejs#10551
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 19, 2017
Use common.mustCall() where appropriate, var to const/let,
assert.equal() -> assert.strictEqual(), explicit time provided to
setTimeout()

PR-URL: nodejs#10551
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 26, 2017
Use common.mustCall() where appropriate, var to const/let,
assert.equal() -> assert.strictEqual(), explicit time provided to
setTimeout()

PR-URL: nodejs#10551
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 27, 2017
Use common.mustCall() where appropriate, var to const/let,
assert.equal() -> assert.strictEqual(), explicit time provided to
setTimeout()

PR-URL: nodejs#10551
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
@italoacasas italoacasas mentioned this pull request Jan 29, 2017
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 30, 2017
Use common.mustCall() where appropriate, var to const/let,
assert.equal() -> assert.strictEqual(), explicit time provided to
setTimeout()

PR-URL: nodejs#10551
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 30, 2017
Use common.mustCall() where appropriate, var to const/let,
assert.equal() -> assert.strictEqual(), explicit time provided to
setTimeout()

PR-URL: nodejs#10551
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
@MylesBorins
Copy link
Contributor

would someone be open to backporting this?

@DavidGoussev
Copy link
Contributor Author

DavidGoussev commented Mar 8, 2017 via email

@gibfahn
Copy link
Member

gibfahn commented Mar 8, 2017

@dpg5000 There's a howto in #11099. It's still under review, but the process for submitting the backport PR should be okay to follow.

@DavidGoussev
Copy link
Contributor Author

@gibfahn Hi Gibson, thanks! Running into a slight issue with git checkout v7.x-staging

I receive error: pathspec 'v7.x-staging' did not match any file(s) known to git.

To confirm, my origin remote points to my node fork, and my upstream remote points to https://github.com/nodejs/node.git

@bnoordhuis
Copy link
Member

@dpg5000 Does it work when you run git branch v7.x-staging origin/v7.x-staging first?

@gibfahn
Copy link
Member

gibfahn commented Mar 9, 2017

@dpg5000 yep, see discussion in that PR from #11099 (comment) onwards.

You want to do what @bnoordhuis suggests, although I'm pretty sure it should be git branch v7.x-staging upstream/v7.x-staging

@DavidGoussev
Copy link
Contributor Author

@gibfahn Hi Gibson, apparently this PR has been backported to v7.x already (successfully). Is there a previous version that it still needs to be backported to (as @MylesBorins mentioned earlier above)?

@gibfahn
Copy link
Member

gibfahn commented Mar 11, 2017

@dpg5000 the other release lines are v6.x and v4.x. Node v4 is about to go into maintenance, so I don't think it's worth trying to backport to it. Backporting to v6 would be good though.

MylesBorins pushed a commit that referenced this pull request Apr 15, 2017
Use common.mustCall() where appropriate, var to const/let,
assert.equal() -> assert.strictEqual(), explicit time provided to
setTimeout()

Backport-PR-URL: #11797
PR-URL: #10551
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
MylesBorins pushed a commit that referenced this pull request Apr 19, 2017
Use common.mustCall() where appropriate, var to const/let,
assert.equal() -> assert.strictEqual(), explicit time provided to
setTimeout()

Backport-PR-URL: #11797
PR-URL: #10551
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Apr 19, 2017
andrew749 pushed a commit to michielbaird/node that referenced this pull request Jul 19, 2017
Use common.mustCall() where appropriate, var to const/let,
assert.equal() -> assert.strictEqual(), explicit time provided to
setTimeout()

Backport-PR-URL: nodejs/node#11797
PR-URL: nodejs/node#10551
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stream Issues and PRs related to the stream subsystem. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants