Skip to content

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-botnodejs-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
@mhdawsonmhdawson self-assigned this Apr 21, 2017
@mhdawsonmhdawsonforce-pushed the cancel_coverage branch 2 times, most recently from 4929d21 to d4ea33dCompareApril 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
MemberAuthor

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
MemberAuthor

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
MemberAuthor

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
MemberAuthor

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
MemberAuthor

mhdawson commented Apr 24, 2017

@addaleax Pushed change to update to napi_make_callback

@mhdawson
Copy link
MemberAuthor

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
MemberAuthor

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

@mhdawson
Copy link
MemberAuthor

@mhdawson
Copy link
MemberAuthor

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
MemberAuthor

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

@mhdawson
Copy link
MemberAuthor

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

@mhdawson
Copy link
MemberAuthor

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

@mhdawson
Copy link
MemberAuthor

Landed as 1d96803

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 <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
@jasnelljasnell mentioned this pull request May 11, 2017
@gibfahngibfahn mentioned this pull request Jun 15, 2017
3 tasks
@mhdawsonmhdawson 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 <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
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 <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
@MylesBorinsMylesBorins mentioned this pull request Apr 16, 2018
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

node-apiIssues and PRs related to the Node-API.testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@mhdawson@jasnell@addaleax@cjihrig@gibfahn@nodejs-github-bot