Skip to content

test: improve test coverage of internal/blob - #41513

Merged
nodejs-github-bot merged 7 commits into
nodejs:masterfrom
kuriyosh:test-blob-coverage
Apr 14, 2022
Merged

test: improve test coverage of internal/blob#41513
nodejs-github-bot merged 7 commits into
nodejs:masterfrom
kuriyosh:test-blob-coverage

Conversation

@kuriyosh

Copy link
Copy Markdown
Contributor

This improves a test coverage in lib/internal/blob
ref: https://coverage.nodejs.org/coverage-74b9baa4265a8f0d/lib/internal/blob.js.html

This added following tests.

  • executing inspect to Blob with depth option
  • creating new Blob instance with over size argument
  • causing ERR_INVALID_THIS errors in some methods

@nodejs-github-botnodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels Jan 14, 2022
jasnell
jasnell previously approved these changes Jan 17, 2022
@Ayase-252Ayase-252 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Jan 18, 2022
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jan 18, 2022
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@aduh95

aduh95 commented Jan 18, 2022

Copy link
Copy Markdown
Contributor

There are several related failures in the CI test results:

AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
+ actual - expected
+ Comparison {}
- Comparison {
- code: 'ERR_BUFFER_TOO_LARGE'
- }
at Object.<anonymous> (/home/iojs/build/workspace/node-test-commit-linux/test/parallel/test-blob.js:234:10)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
generatedMessage: true,
code: 'ERR_ASSERTION',
actual: RangeError: Array buffer allocation failed
at new ArrayBuffer (<anonymous>)
at new Uint8Array (<anonymous>)
at assert.throws.code (/home/iojs/build/workspace/node-test-commit-linux/test/parallel/test-blob.js:234:33)
at getActual (node:assert:756:5)
at Function.throws (node:assert:902:24)
at Object.<anonymous> (/home/iojs/build/workspace/node-test-commit-linux/test/parallel/test-blob.js:234:10)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12),
expected: { code: 'ERR_BUFFER_TOO_LARGE' },
operator: 'throws'
}

Can you take a look please?

@aduh95aduh95 removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jan 18, 2022
@aduh95

Copy link
Copy Markdown
Contributor

I'm not sure this is a correct fix, the error was RangeError: Array buffer allocation failed, increasing the size would probably not help! A "workaround" would be to skip the test if the memory constraints on the platform doesn't let us run the test, as it's done in some other tests, e.g.

try{
buf=Buffer.allocUnsafe(kStringMaxLength);
}catch(e){
// If the exception is not due to memory confinement then rethrow it.
if(e.message!=='Array buffer allocation failed')throw(e);
common.skip(skipMessage);
}

@kuriyosh

Copy link
Copy Markdown
ContributorAuthor

@aduh95
I'm sorry to reply late.
Thank you! I didn't know the correct handling in this case, so I took an approach to avoid it by reducing the length of each array passed to the Buffer argument.
I will fix it by the method you suggested!

Comment threadtest/parallel/test-blob.js Outdated
@aduh95aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Jan 30, 2022
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jan 30, 2022
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Apr 8, 2022
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@aduh95aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label Apr 14, 2022
@nodejs-github-botnodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Apr 14, 2022
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator
Commit Queue failed
- Loading data for nodejs/node/pull/41513
✔ Done loading data for nodejs/node/pull/41513
----------------------------------- PR info ------------------------------------
Title test: improve test coverage of internal/blob (#41513)
⚠ Could not retrieve the email or name of the PR author's from user's GitHub profile!
Branch kuriyosh:test-blob-coverage -> nodejs:master
Labels test, author ready, needs-ci, commit-queue-squash
Commits 7
- test: improve test coverage of internal/blob
- test: over size array in some platforms
- fix: skip oversized buffer test for memory limitation
- fix: remove parens in throw statement
- test: fix mustcall error
- test: skip invalid array length
- test: skip this test in freeBSD env
Committers 1
- Yoshiki Kurihara PR-URL: https://github.com/nodejs/node/pull/41513
Refs: https://coverage.nodejs.org/coverage-74b9baa4265a8f0d/lib/internal/blob.js.html
Reviewed-By: Colin Ihrig Reviewed-By: Antoine du Hamel Reviewed-By: James M Snell Reviewed-By: Daijiro Wachi ------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/41513
Refs: https://coverage.nodejs.org/coverage-74b9baa4265a8f0d/lib/internal/blob.js.html
Reviewed-By: Colin Ihrig Reviewed-By: Antoine du Hamel Reviewed-By: James M Snell Reviewed-By: Daijiro Wachi --------------------------------------------------------------------------------
⚠ Commits were pushed since the last review:
⚠ - test: skip this test in freeBSD env
ℹ This PR was created on Fri, 14 Jan 2022 07:38:07 GMT
✔ Approvals: 4
✔ - Colin Ihrig (@cjihrig) (TSC): https://github.com/nodejs/node/pull/41513#pullrequestreview-853117382
✔ - Antoine du Hamel (@aduh95) (TSC): https://github.com/nodejs/node/pull/41513#pullrequestreview-907913460
✔ - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/41513#pullrequestreview-907915108
✔ - Daijiro Wachi (@watilde): https://github.com/nodejs/node/pull/41513#pullrequestreview-912533681
✔ Last GitHub CI successful
ℹ Last Full PR CI on 2022-04-08T13:38:13Z: https://ci.nodejs.org/job/node-test-pull-request/43395/
- Querying data for job/node-test-pull-request/43395/
✔ Last Jenkins CI successful
--------------------------------------------------------------------------------
✔ Aborted `git node land` session in /home/runner/work/node/node/.ncu
https://github.com/nodejs/node/actions/runs/2169804667

@aduh95aduh95 added commit-queue Add this label to land a pull request using GitHub Actions. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Apr 14, 2022
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Apr 14, 2022
@nodejs-github-bot
nodejs-github-bot merged commit 1285ac1 into nodejs:masterApr 14, 2022
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 1285ac1

xtx1130 pushed a commit to xtx1130/node that referenced this pull request Apr 25, 2022
PR-URL: nodejs#41513
Refs: https://coverage.nodejs.org/coverage-74b9baa4265a8f0d/lib/internal/blob.js.html
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
targos pushed a commit that referenced this pull request Apr 28, 2022
PR-URL: #41513
Refs: https://coverage.nodejs.org/coverage-74b9baa4265a8f0d/lib/internal/blob.js.html
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
@targostargos mentioned this pull request May 2, 2022
juanarbol pushed a commit that referenced this pull request May 31, 2022
PR-URL: #41513
Refs: https://coverage.nodejs.org/coverage-74b9baa4265a8f0d/lib/internal/blob.js.html
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
danielleadams pushed a commit that referenced this pull request Jun 27, 2022
PR-URL: #41513
Refs: https://coverage.nodejs.org/coverage-74b9baa4265a8f0d/lib/internal/blob.js.html
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
targos pushed a commit that referenced this pull request Jul 11, 2022
PR-URL: #41513
Refs: https://coverage.nodejs.org/coverage-74b9baa4265a8f0d/lib/internal/blob.js.html
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
targos pushed a commit that referenced this pull request Jul 31, 2022
PR-URL: #41513
Refs: https://coverage.nodejs.org/coverage-74b9baa4265a8f0d/lib/internal/blob.js.html
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
@targostargos mentioned this pull request Aug 3, 2022
guangwong pushed a commit to noslate-project/node that referenced this pull request Oct 10, 2022
PR-URL: nodejs/node#41513
Refs: https://coverage.nodejs.org/coverage-74b9baa4265a8f0d/lib/internal/blob.js.html
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
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.needs-ciPRs that need a full CI run.testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@kuriyosh@nodejs-github-bot@aduh95@jasnell@watilde@cjihrig@Ayase-252