GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: refactor test-http-information-processing by Trott · Pull Request #32547 · nodejs/node

Conversation

@Trott

@Trott Trott commented Mar 29, 2020

Copy link
Copy Markdown
Member

Replace magic numbers with constant.
Use for loop for repeated code.
Reduce console logging.
Remove unneeded countdown module use.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to Node.js core tests and test infrastructure. label Mar 29, 2020
addaleax
addaleax approved these changes Mar 29, 2020
View reviewed changes
Comment thread test/parallel/test-http-information-processing.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@Trott Trott added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Mar 29, 2020
@nodejs-github-bot

nodejs-github-bot commented Mar 29, 2020

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/30168/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jasnell
jasnell reviewed Mar 29, 2020
View reviewed changes
Comment thread test/parallel/test-http-information-processing.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

jasnell
jasnell reviewed Mar 29, 2020
View reviewed changes
Comment thread test/parallel/test-http-information-processing.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@Trott
Trott force-pushed the info-proc branch from fc1cc6c to 695e12b Compare March 29, 2020 16:01
@nodejs-github-bot

nodejs-github-bot commented Mar 29, 2020 •
edited by Trott
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/30175/ ⭐️

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

HarshithaKP
HarshithaKP reviewed Mar 30, 2020
View reviewed changes
Comment thread test/parallel/test-http-information-processing.js Outdated

@HarshithaKP HarshithaKP Mar 30, 2020

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

common.mustCall variant can be used here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@Trott Trott Mar 30, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

We could, but I'm not sure we should. This test isn't checking to see if res.end() fires its callback or not. If the response isn't sent, the test will fail. We don't need the extra check. Adding checks that are unrelated to the test case makes it harder for someone reading the code to understand what the test is actually supposed to be testing.

This makes it sound like I'm much more opposed to the idea than I actually am. I'm on the fence, around a -0 or so.

I was a -1 about 10 minutes ago, so 10 minutes from now, I'll probably be an enthusiastic +1.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@HarshithaKP HarshithaKP Mar 30, 2020

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This test isn't checking to see if res.end() fires its callback or not

correct me if I am wrong, but isn't that the case with most of 100+ http test cases?

  • intent of the test does not cover explicit checking on res.end
  • but as a matter of practice, they do that check
    if you can generalize a statement around whether http tests should check life cycle events are met or not I can also work towards implementing this across other tests too.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@Trott Trott Mar 30, 2020

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

  • intent of the test does not cover explicit checking on res.end
  • but as a matter of practice, they do that check

I'm not seeing that with res.end() calls. I'm using grep and doing a naive/superficial check, so results may be imperfect but close enough to draw reasonable conclusions:

  • Almost none of the 200+ calls to res.end() in parallel/test-http* have a callback wrapped in mustCall(). The majority of them are like the call here where res.endI() is called and no callback is provided.
  • Of those that do wrap a callback in muscCall(), only one file checks empty callback: test-http-outgoing-end-multiple.js. That makes sense for that test because it is literally checking that calling res.end() multiple times will work as expected.

I don't think we should add a check for a callback here that we're not using. Again, I'm not strongly opposed, but I am mildly resistant. 😀

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@HarshithaKP HarshithaKP Mar 30, 2020

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I used this command grep -e "res.on('end" -e "response.on('end" test-http*.js | grep "mustCall" | wc -l and got around 50 instances. Unfortunately I don't have the insight to validate their context. so I will leave it at that. Thank you!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
lpinca
lpinca approved these changes Mar 30, 2020
View reviewed changes
@Trott
test: refactor test-http-information-processing
8905be2
Replace magic numbers with constant.
Use for loop for repeated code.
Reduce console logging.
Remove unneeded countdown module use.

PR-URL: nodejs#32547
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
@Trott
Trott force-pushed the info-proc branch from 695e12b to 8905be2 Compare March 31, 2020 20:12
@Trott

Trott commented Mar 31, 2020

Copy link
Copy Markdown
Member Author

Landed in 8905be2

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott
Trott merged commit 8905be2 into nodejs:master Mar 31, 2020
@Trott
Trott deleted the info-proc branch March 31, 2020 20:12
@Trott

Trott commented Mar 31, 2020

Copy link
Copy Markdown
Member Author

I honestly have no idea what happened. I did make that change, but yeah, clearly I didn't push it up or something....

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott

Trott commented Mar 31, 2020

Copy link
Copy Markdown
Member Author

I wonder if I did it on some other PR but left the comment and clicked "Resolve" in this one....

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell

jasnell commented Mar 31, 2020

Copy link
Copy Markdown
Member

No worries, I'll mark it as a todo for a future round of edits.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott

Trott commented Mar 31, 2020

Copy link
Copy Markdown
Member Author

No worries, I'll mark it as a todo for a future round of edits.

#32588

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

MylesBorins pushed a commit that referenced this pull request Mar 31, 2020
@Trott @MylesBorins
test: refactor test-http-information-processing
8bcbb8d
Replace magic numbers with constant.
Use for loop for repeated code.
Reduce console logging.
Remove unneeded countdown module use.

PR-URL: #32547
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
@targos targos mentioned this pull request Apr 13, 2020
v13.13.0 release proposal #32813
Merged
targos pushed a commit that referenced this pull request Apr 22, 2020
@Trott @targos
test: refactor test-http-information-processing
d6f6623
Replace magic numbers with constant.
Use for loop for repeated code.
Reduce console logging.
Remove unneeded countdown module use.

PR-URL: #32547
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
@targos targos mentioned this pull request Apr 22, 2020
v12.16.3 release proposal #33009
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jasnell jasnell jasnell left review comments
@HarshithaKP HarshithaKP HarshithaKP left review comments
@addaleax addaleax addaleax approved these changes
@lpinca lpinca lpinca approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. test Issues and PRs related to Node.js core tests and test infrastructure.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@Trott @nodejs-github-bot @jasnell @addaleax @lpinca @HarshithaKP
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.