rushstack icon indicating copy to clipboard operation
rushstack copied to clipboard

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

Open octogonz opened this issue 1 year ago • 4 comments
trafficstars

Summary

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

octogonz avatar Jan 25 '24 22:01 octogonz

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

dmichon-msft avatar Jan 26 '24 00:01 dmichon-msft

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

Why not?

octogonz avatar Jan 26 '24 00:01 octogonz

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.

dmichon-msft avatar Jan 26 '24 00:01 dmichon-msft

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:

https://github.com/microsoft/rushstack/blob/638079610e4d963e89f81ce729a53ef44ac704bc/libraries/node-core-library/src/test/Async.test.ts#L168-L175

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?

octogonz avatar Jan 26 '24 19:01 octogonz