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

[heft] Increase Jest default timeout from 5s to 15s #4495

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

octogonz
Copy link
Collaborator

Summary

Some builds were failing randomly because the VM was under heavy load.

@dmichon-msft
Copy link
Contributor

I'm not a fan of doing this globally for all consumers of heft-jest-plugin.

@octogonz
Copy link
Collaborator Author

I'm not a fan of doing this globally for all consumers of heft-jest-plugin.

Why not?

@dmichon-msft
Copy link
Contributor

I'm not a fan of doing this globally for all consumers of heft-jest-plugin.

Why not?

A test taking longer than 5 seconds, even if the VM is under load still indicates a bad test. Alternatively it indicates that you VM's scheduler is running too many processes relative to the number of CPUs, which is a configuration bug.

@octogonz
Copy link
Collaborator Author

A test taking longer than 5 seconds, even if the VM is under load still indicates a bad test. Alternatively it indicates that you VM's scheduler is running too many processes relative to the number of CPUs, which is a configuration bug.

@IanC and @elliot-nelson felt the same way.

After some discussion, we think this error may be revealing an actually incorrect practice for the tests that were timing out:

it('returns when given an array with a large number of elements and a concurrency limit', async () => {
const array: number[] = [];
for (let i = 0; i < 250; i++) {
array.push(i);
}
await Async.forEachAsync(array, async () => await Async.sleep(1), { concurrency: 3 });
});

This file contains numerous calls to Async.sleep(1) that although sleeping for "only" 1ms may actually be accumulating into nontrivial delays. Possible improvements:

  1. Change them all to Sleep(0)
  2. Mock the timers
  3. Increase the test limit for just this one file... but how much?

Option 1 seems like the least effort. @dmichon-msft any opinions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: General Discussions
Development

Successfully merging this pull request may close these issues.

None yet

2 participants