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: add coverage for napi_cancel_async_work #12575

Closed
wants to merge 3 commits into from

Conversation

mhdawson
Copy link
Member

adding test coverage for napi_cancel_async_work based
on coverage report

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

test, n-api

@nodejs-github-bot nodejs-github-bot added node-api Issues and PRs related to the Node-API. test Issues and PRs related to the tests. labels Apr 21, 2017
@mhdawson mhdawson self-assigned this Apr 21, 2017
@mhdawson mhdawson force-pushed the cancel_coverage branch 2 times, most recently from 4929d21 to d4ea33d Compare April 21, 2017 22:16
adding test coverage for napi_cancel_async_work based
on coverage report
NAPI_CALL_RETURN_VOID(env, napi_get_global(env, &global));
napi_value result;
NAPI_CALL_RETURN_VOID(env,
napi_call_function(env, global, callback, 0, nullptr, &result));
Copy link
Member

Choose a reason for hiding this comment

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

napi_make_callback?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, I had re-used code from the other test in the file, but in this case it should be napi_make_callback

#if defined _WIN32
Sleep(2000);
#else
sleep(2);
Copy link
Member

Choose a reason for hiding this comment

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

Is this duration guessed? I would assume we could get away with something shorter…

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes I just chose a time that I thought would be long enough. Its a trade off between how long the test runs and potentially flaky failures.

Copy link
Member Author

Choose a reason for hiding this comment

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

On my machine 1s is fine as well, but I'd lean towards leaving at 2s as I'd rather avoid risking flaky failures.

Copy link
Member

Choose a reason for hiding this comment

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

I think @nodejs/testing has a general guideline that tests should not take longer than 1 second to run (which makes sense, we have thousands of tests…), that’s why I’m asking

Copy link
Member Author

Choose a reason for hiding this comment

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

ok changed to 1s

@mhdawson
Copy link
Member Author

mhdawson commented Apr 24, 2017

@addaleax Pushed change to update to napi_make_callback

@mhdawson
Copy link
Member Author

CI run as I'd like to make sure timing works across platforms: https://ci.nodejs.org/job/node-test-pull-request/7635/

@mhdawson
Copy link
Member Author

ok going to land this since I think I have addressed @addaleax's comment about time and there are 2 approvals.

@mhdawson
Copy link
Member Author

@mhdawson
Copy link
Member Author

OS failure was not related, starting new CI run to confirm. - new OSX job https://ci.nodejs.org/job/node-test-commit-osx/nodes=osx1010/

@mhdawson
Copy link
Member Author

CI re-run due to infra issues: https://ci.nodejs.org/job/node-test-pull-request/7693/

@mhdawson
Copy link
Member Author

arms failures in new run seem to be infra issues and not related.

@mhdawson
Copy link
Member Author

2nd CI run good, arm failures were infra issues, landing.

@mhdawson
Copy link
Member Author

Landed as 1d96803

@mhdawson mhdawson closed this Apr 27, 2017
mhdawson added a commit that referenced this pull request Apr 27, 2017
adding test coverage for napi_cancel_async_work based
on coverage report

PR-URL: #12575
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@jasnell jasnell mentioned this pull request May 11, 2017
@gibfahn gibfahn mentioned this pull request Jun 15, 2017
3 tasks
@mhdawson mhdawson deleted the cancel_coverage branch June 28, 2017 19:24
gabrielschulhof pushed a commit to gabrielschulhof/node that referenced this pull request Apr 10, 2018
adding test coverage for napi_cancel_async_work based
on coverage report

PR-URL: nodejs#12575
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
MylesBorins pushed a commit that referenced this pull request Apr 16, 2018
adding test coverage for napi_cancel_async_work based
on coverage report

Backport-PR-URL: #19447
PR-URL: #12575
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@MylesBorins MylesBorins mentioned this pull request Apr 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
node-api Issues and PRs related to the Node-API. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants