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

Normalize Mocha tests to have realistic timings #3539

Closed
wants to merge 1 commit into from

Conversation

WaleedAshraf
Copy link

@WaleedAshraf WaleedAshraf commented Oct 29, 2018

Description of the Change

Add .slow() to tests which are normally taking longer time.

Benefits

More clear view of actual slow tests.

Possible Drawbacks

Should keep an eye on these test for later -- if they are getting even slower, then something's 🐟 !

Applicable issues

Fixes #2597
semver-patch

See also #2837

@jsf-clabot
Copy link

jsf-clabot commented Oct 29, 2018

CLA assistant check
All committers have signed the CLA.

@coveralls
Copy link

coveralls commented Oct 29, 2018

Coverage Status

Coverage increased (+0.07%) to 91.888% when pulling 2d19e82 on WaleedAshraf:issue/2597 into ffbcbf6 on mochajs:master.

@plroebuck
Copy link
Contributor

Haven't reviewed the rest, but definitely revert 6b93c95. Changes to test specifications do not require any changes to "package.json".

@plroebuck plroebuck changed the title Fixes: tagged slow tests Normalize Mocha tests to have realistic timings Oct 30, 2018
@WaleedAshraf
Copy link
Author

@plroebuck done.

@plroebuck
Copy link
Contributor

Could you explain the process you used to come up with your slow threshold values?

@plroebuck plroebuck added qa status: needs review a maintainer should (re-)review this pull request semver-patch implementation requires increase of "patch" version number; "bug fixes" labels Oct 30, 2018
@WaleedAshraf
Copy link
Author

WaleedAshraf commented Oct 30, 2018

I ran tests for 3,4 times and added (~3 * average value of duration it took)

If a test takes 100ms

  • slow(100) would be red
  • slow (200) would orange/yellow
  • slow (300) would be green
  • slow (>300) would be no warning

e.g All of options.spec.js tests are taking ~250-300ms avg time,
so, slow(800) threshold is okay for them.

Also, if it's a semver-patch, then we need to update package.json with version bump.

@plroebuck
Copy link
Contributor

Were the tests run on AppVeyor?

semver-patch annotates its ability to be merged directly to master here; the package version itself will change at next release.

@WaleedAshraf
Copy link
Author

@plroebuck no. I ran them locally.
Is AppVeyor possible on local? Or maybe I can re-run the AppVeyor job here?

Got it 👍

@plroebuck
Copy link
Contributor

plroebuck commented Nov 1, 2018

@plroebuck no. I ran them locally.
Is AppVeyor possible on local? Or maybe I can re-run the AppVeyor job here?

Yeah, local timings won't be as much help. Need to run against the 80386 machines Appveyor seems to be powered by... :)

You could use timings from our existing commits. Try to get some spread between when you collect results -- certain times of day are much worse than others.

@plroebuck
Copy link
Contributor

BTW, you are using the actual formula, right?

@boneskull
Copy link
Member

this also resolves #2483... lots of dupes.

Copy link
Member

@boneskull boneskull left a comment

Choose a reason for hiding this comment

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

thanks! just noticed one issue with the code.

I haven't had a chance to cross-reference the values and the real-world perf though

@@ -4,49 +4,53 @@ var assert = require('assert');
var run = require('./helpers').runMocha;
var args = [];

describe('suite w/no callback', function() {
describe('suit', function() {
Copy link
Member

Choose a reason for hiding this comment

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

typo

@plroebuck
Copy link
Contributor

#2483 already closed.

@WaleedAshraf
Copy link
Author

@plroebuck ok. I'll cross check with previous builds and will update values where needed.
And yes, I used the same formula.

@boneskull good catch. Will push updates by this weekend. 👍

@craigtaub
Copy link
Contributor

@WaleedAshraf any movement on this?

@WaleedAshraf
Copy link
Author

Hi @craigtaub, Sorry for leaving it here for long.
I'll push changes in few days.

@WaleedAshraf WaleedAshraf force-pushed the issue/2597 branch 2 times, most recently from a6ebb9f to 829e8b3 Compare May 16, 2019 10:17
@WaleedAshraf
Copy link
Author

WaleedAshraf commented May 16, 2019

@here, I think it's not needed now.
I check some of the last builds at https://travis-ci.org/mochajs/mocha/pull_requests
and I don't see many slow tests. Only one or two at max, which is fine.

We can close this PR with #2597 and #2837

@craigtaub
Copy link
Contributor

Have you checked on AppVeyor?

To quote issue.

It's important to note that our tests run much more slowly on AppVeyor. That should be the baseline for timeout values--not your MacBook Pro.

@WaleedAshraf
Copy link
Author

@craigtaub I did, but it's not that clear because logs are not colored and it's difficult to identify slow (red) tests.
Maybe we need to fix that also.

@craigtaub
Copy link
Contributor

craigtaub commented May 18, 2019

Ah yes, they don't support colours so that won't be possible.

Think you can tell its slow if over default slow value (for integrations believe 3750ms).

@WaleedAshraf
Copy link
Author

Hi,
Let's get done with this.

I checked the lastest build on AppVeyor and there is only one test which hits the limit of 3750ms

regressions
    √ issue-1991: Declarations do not get cleaned up unless you set them to `null` - Memory Leak (16234ms)

But this is way too over the limit. Rest of tests are under the limit.

@outsideris
Copy link
Member

I agreed to close this issue. Any thoughts?

@juergba juergba removed the status: needs review a maintainer should (re-)review this pull request label Feb 10, 2020
@juergba juergba closed this Feb 10, 2020
@WaleedAshraf WaleedAshraf deleted the issue/2597 branch December 23, 2021 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-patch implementation requires increase of "patch" version number; "bug fixes"
Projects
None yet
Development

Successfully merging this pull request may close these issues.

make test timeouts closer to reality
8 participants