Skip to content

test: improve http-client coverage - #33633

Merged
nodejs-github-bot merged 6 commits into
nodejs:mainfrom
KuthorX:http-client-coverage
Dec 19, 2023
Merged

test: improve http-client coverage#33633
nodejs-github-bot merged 6 commits into
nodejs:mainfrom
KuthorX:http-client-coverage

Conversation

@KuthorX

Copy link
Copy Markdown
Contributor

Based on https://coverage.nodejs.org/coverage-d12d5ef3ef8e5d9f/lib/_http_client.js.html, I try to improve coverage to line 120 (http-client-input-function), 194-197 (http-client-insecure-http-parser-error)

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

@nodejs-github-botnodejs-github-bot added the test Issues and PRs related to the tests. label May 29, 2020

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
code: /ERR_INVALID_ARG_TYPE/
code: 'ERR_INVALID_ARG_TYPE',
message: /insecureHTTPParser/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The test should definitely hit the mentioned code line but it would be great to write a test that actually verifies that the callback is also called and ideally, this test case would not cause any errors, since it's a legit code path.

@KuthorXKuthorXMay 30, 2020

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@BridgeAR Here is a rewrote version, which can make cb be called, but it's a little longer than previous version, so I am not sure whether it's ok, could you help me to check?

'use strict';constcommon=require('../common');consthttp=require('http');constassert=require('assert');constClientRequest=require('http').ClientRequest;{constserver=http.createServer(common.mustCall((req,res)=>{res.writeHead(200);res.end('hello world');})).listen(80,'127.0.0.1');constreq=newClientRequest(common.mustCall((response)=>{letbody='';response.setEncoding('utf8');response.on('data',(chunk)=>{body+=chunk;});response.on('end',common.mustCall(()=>{assert.strictEqual(body,'hello world');server.close();}));}));req.end();}

@BridgeAR

Copy link
Copy Markdown
Member

@KuthorX thank you very much for your contribution! This is already looking pretty good, just left two minor comments.

@KuthorX
KuthorX requested a review from BridgeARMay 30, 2020 09:37
@BridgeAR
BridgeARforce-pushed the master branch 2 times, most recently from 8ae28ff to 2935f72CompareMay 31, 2020 12:18
@KuthorX

Copy link
Copy Markdown
ContributorAuthor

Could someone help me to review lastest commit? Any suggestion will be appreciated.

@PoojaDurgadPoojaDurgad added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 24, 2020
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 24, 2020
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@aduh95

Copy link
Copy Markdown
Contributor

Ping @nodejs/http for reviews.

@aduh95
aduh95force-pushed the http-client-coverage branch from d64869d to 289444eCompareSeptember 19, 2023 14:58
@ShogunPanda

Copy link
Copy Markdown
Contributor

The changes look fine to me. There is only one test failing as you're using port 80. Can you use another port?

@KuthorX

Copy link
Copy Markdown
ContributorAuthor

The changes look fine to me. There is only one test failing as you're using port 80. Can you use another port?

thanks, has changed to 8080

Comment threadtest/parallel/test-http-client-input-function.js Outdated
@KuthorX
KuthorX requested a review from mcollinaOctober 10, 2023 09:39

@ShogunPandaShogunPanda left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@ShogunPandaShogunPanda added the request-ci Add this label to start a Jenkins CI on a PR. label Oct 10, 2023
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 10, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@KuthorX

Copy link
Copy Markdown
ContributorAuthor

looks like some ci fail, maybe I should merge main branch? @ShogunPanda

@mcollinamcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@mcollinamcollina added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 4, 2023
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 4, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@aduh95aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Dec 19, 2023
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 19, 2023
@nodejs-github-bot
nodejs-github-bot merged commit c925039 into nodejs:mainDec 19, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in c925039

ionicmc-js pushed a commit to ionicmc-js/node that referenced this pull request Dec 19, 2023
PR-URL: nodejs#33633
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: James M Snell <jasnell@gmail.com>
@KuthorX

KuthorX commented Dec 19, 2023

Copy link
Copy Markdown
ContributorAuthor

After 3 years, it merged, thank you guys 😌

RafaelGSS pushed a commit that referenced this pull request Jan 2, 2024
PR-URL: #33633
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: James M Snell <jasnell@gmail.com>
@RafaelGSSRafaelGSS mentioned this pull request Jan 2, 2024
richardlau pushed a commit that referenced this pull request Mar 25, 2024
PR-URL: #33633
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: James M Snell <jasnell@gmail.com>
@richardlaurichardlau mentioned this pull request Mar 25, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.commit-queue-squashAdd this label to instruct the Commit Queue to squash all the PR commits into the first one.testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@KuthorX@BridgeAR@nodejs-github-bot@aduh95@ShogunPanda@mcollina@jasnell@PoojaDurgad