Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@garyrvaz
Copy link

@garyrvaz garyrvaz commented Nov 4, 2019

Resolves #5779
Impact: minor
Type: performance|test

Issue

maxWorkers for jest integration test was set to 3 which increased the CPU and RAM consumption of CI container

Solution

bring back --runInBand and reduce node memory limit for jest integration script to 4000 MB so that there some memory for other processes.
Refer:

Breaking changes

none

@garyrvaz garyrvaz force-pushed the fix-5779-yuuwaku-ci-integration-test branch from e7b5792 to 0e73355 Compare November 4, 2019 21:57
@garyrvaz garyrvaz changed the title fix: integration test in circle ci [WIP] fix: integration test in circle ci Nov 4, 2019
@garyrvaz garyrvaz force-pushed the fix-5779-yuuwaku-ci-integration-test branch 2 times, most recently from 9f277cd to a8e0770 Compare November 4, 2019 23:18
* set jest integration test maxWorker flag to 1
* set max node memory consumption for CI container to 4000MB

Signed-off-by: Gary Ryan Vaz <[email protected]>
@garyrvaz garyrvaz force-pushed the fix-5779-yuuwaku-ci-integration-test branch from a8e0770 to cc589fc Compare November 5, 2019 02:17
@garyrvaz garyrvaz changed the title [WIP] fix: integration test in circle ci fix: integration test in circle ci Nov 5, 2019
Copy link
Contributor

@machikoyasuda machikoyasuda left a comment

Choose a reason for hiding this comment

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

🎉

@machikoyasuda
Copy link
Contributor

@rosshadden What do you think?

I ran it locally on OS X and my stats were:

Test Suites: 40 passed, 40 total
Tests:       118 passed, 118 total
Snapshots:   7 passed, 7 total
Time:        308.429s

But it's much faster in CI. How about your machine?

@garyrvaz
Copy link
Author

garyrvaz commented Nov 5, 2019

@rosshadden What do you think?

I ran it locally on OS X and my stats were:

Test Suites: 40 passed, 40 total
Tests:       118 passed, 118 total
Snapshots:   7 passed, 7 total
Time:        308.429s

But it's much faster in CI. How about your machine?

@machikoyasuda one of the main reasons this happens is due to the specification of the host CPU of the docker container. For eg, you would be running the tests on macbook pro which may have an i5 or i7 mobile processor while the CI instance has a XEON server processor, which has a massive difference in single core performance. This is important as we are using --runInBand which uses a single core of the CPU.

Test results on my machine take:

Test Suites: 40 passed, 40 total
Tests:       118 passed, 118 total
Snapshots:   7 passed, 7 total
Time:        255.031s

My laptop has the intel i7 9750H mobile processor.

@rosshadden rosshadden self-requested a review November 5, 2019 23:38
Copy link
Contributor

@rosshadden rosshadden left a comment

Choose a reason for hiding this comment

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

My environment seems to be a bit messed up, as even with no changes from HEAD and newly installed node modules neither way successfully finishes. I believe it would be ideal to run with --maxWorkers locally and --runInBand in CI, like that one article says that you linked the other day @machikoyasuda.

@garyrvaz
Copy link
Author

garyrvaz commented Nov 6, 2019

@rosshadden with --maxWorkers the tests take more time to complete and even cross the 5000 ms default jest timeout causing tests to fail locally. To not let this happen most of the tests have jest.setTimeout(30000) but there are some tests that don't have this setting. If you could share the error information of the tests failing while using --runInBand.

@aldeed
Copy link
Contributor

aldeed commented Nov 6, 2019

I've been out, but to add a little context:

The --runInBand is necessary to get the full benefits of the @shelf/jest-mongodb package. It creates the MongoDB server in Jest setup code and destroys it in Jest teardown code. If you run tests in parallel, then it will do this in every process and tests will be much slower.

I'm not sure if any automatic data destruction happens between tests. I don't think any tests are creating many documents without removing them after, but that could be one thing to check, especially if it keeps some of the mongo data in memory.

So this PR looks fine to me

FYI @spencern

@aldeed aldeed merged commit 7f539e7 into reactioncommerce:develop Nov 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants