jeudi 28 mars 2019

JEST test suite fails if restricted to run in one core

Scenario: Frontend typescript project, using React and Redux. We have something like 800 tests spread around 150 test suites. Some of tests are unit tests, but other are actually integration tests. Ocasionally we mock backend calls, which we use to populate the Redux store. Backend calls are asynchronous in our production code, so we use async and await when we use them in tests (even if they are mocked).

Using the call

npm test

Shows that all the tests are beautiful and green. However:

numactl -C 0 npm test       # one test is red 

makes one test to fail. Adding a second CPU:

numactl -C 0,1 npm test     # all tests are green

is enough to get all tests to pass without any problem. I am trying to understand what could be causing this but I have honestly no clue. I cannot see the connection between the nunmber of CPUs at work and the succes of the tests :( Did someone ever face a similar scenario?

Additional information: if I disable the other tests in the test suite the red one belongs to, then the call numactl -C 0 npm test works fine (i.e. all tests are green).

I am aware that I am providing very little information. I will happily provide any information that you deem relevant (that may put me on the right track as well!). Any little hint will be very appreciated. Thanks!

Aucun commentaire:

Enregistrer un commentaire