Commit Graph

1 Commits

Author SHA1 Message Date
Bryan 20faf897c9
fix: Test flake when installing yarn dependencies on MacOS (#436)
This fixes #433 - a test flake in E2E (intermittent `ESOCKETTIMEDOUT` errors on MacOS).

The main issue is that, occasionally, for very large dependencies (like `@material-ui/icons`) - yarn can actually time out! We researched this in-depth in v1: https://github.com/coder/m/pull/10040 and fixed it successfully there, by increasing the timeout for yarn.

However, this also highlighted the fact that our `node_modules` caching behavior wasn't correct - we should very rarely see a timeout issue like this, because `@material-ui/icons` should be cached.

It turns out that we weren't falling back to the latest cached `node_modules` if there was a miss - so anytime the lock file changed, we'd  invalidate the cache, and not restore the previous one. This can be improved by using the [`restore-keys`](https://github.com/coder/m/pull/10040) parameter of the [`@actions/cache`](https://github.com/actions/cache)... and in fact we already do this for the `go` dependencies.

So this fix does two things:
- Improve the caching behavior, such that we should rarely have to install `@material-ui/icons` (and other large dependencies) 
- When we do have to install, update the timeout so that we can avoid random `ESOCKETTIMEDOUT` errors
2022-03-14 11:49:49 -07:00