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: improve dns lookup coverage #30777

Closed
wants to merge 1 commit into from

Conversation

KeeReal
Copy link
Contributor

@KeeReal KeeReal commented Dec 3, 2019

Adding tests covering promises-related code paths.

missing coverage

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

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Dec 3, 2019
@Trott
Copy link
Member

Trott commented Dec 6, 2019

@nodejs/dns @nodejs/testing

@Trott
Copy link
Member

Trott commented Dec 6, 2019

@KeeReal Welcome and thanks for the pull request. Are you able to point to the lines of code that are currently uncovered that this will cover? Or at least what file those lines of code would be in?

@KeeReal
Copy link
Contributor Author

KeeReal commented Dec 6, 2019

Hi @Trott.
Sure, here you go - https://coverage.nodejs.org/coverage-cc3f2b386c6ee34f/lib/internal/dns/promises.js.html#L34
These two functions onlookup and onlookupall were not covered and this change covers all code paths within them

@Trott
Copy link
Member

Trott commented Dec 6, 2019

@joyeecheung (just in case you want to test on any particularly restrictive networks--I tested with the network disconnected entirely and the test worked fine, which I suppose is a good indication that the monkey-patching has the intended effect, but just in case....)

@Trott Trott added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Dec 6, 2019
@nodejs-github-bot
Copy link
Collaborator

@bcoe
Copy link
Contributor

bcoe commented Dec 9, 2019

@KeeReal were you able to run coverage locally to make sure that you hit the target lines:

NODE_V8_COVERAGE=./cov ./node test/parallel/test-dns-lookup-promises.js
./node_modules/.bin/c8 report --reporter=html \
	--temp-directory=./cov --omit-relative=false \
	--resolve=./lib --exclude="benchmark/" --exclude="deps/" --exclude="test/" --exclude="tools/" \
	--wrapper-length=0
open coverage/index.html

Copy link
Contributor

@bcoe bcoe left a comment

Choose a reason for hiding this comment

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

this looks good to me, conditional on confirming that this test exercises the expected code.

@KeeReal
Copy link
Contributor Author

KeeReal commented Dec 9, 2019

Thx, @bcoe
I double checked this and noticed that I missed one thing - when a family option is explicitly passed to getaddrinfo.
Added another case to cover this

image

Adding tests covering promises-related code paths.
Copy link
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

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

RSLGTM

Mocking is definitely not ideal but this part can probably not be tested properly otherwise.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Dec 12, 2019

CI: https://ci.nodejs.org/job/node-test-pull-request/27587/ ✅ (yellow build with two typical Windows flakes)

BridgeAR pushed a commit that referenced this pull request Dec 15, 2019
Adding tests covering promises-related code paths.

PR-URL: #30777
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Ben Coe <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
@BridgeAR
Copy link
Member

Landed in 2d13896 🎉

@BridgeAR BridgeAR closed this Dec 15, 2019
MylesBorins pushed a commit that referenced this pull request Dec 17, 2019
Adding tests covering promises-related code paths.

PR-URL: #30777
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Ben Coe <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Dec 17, 2019
targos pushed a commit that referenced this pull request Jan 14, 2020
Adding tests covering promises-related code paths.

PR-URL: #30777
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Ben Coe <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
BethGriggs pushed a commit that referenced this pull request Feb 6, 2020
Adding tests covering promises-related code paths.

PR-URL: #30777
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Ben Coe <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Feb 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants