Skip to content

fix: Test flake when installing yarn dependencies on MacOS #436

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

Merged
merged 4 commits into from
Mar 14, 2022

Conversation

bryphe-coder
Copy link
Contributor

@bryphe-coder bryphe-coder commented Mar 14, 2022

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 parameter of the @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

Copy link
Member

@kylecarbs kylecarbs left a comment

Choose a reason for hiding this comment

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

Awesome!

@codecov
Copy link

codecov bot commented Mar 14, 2022

Codecov Report

Merging #436 (4c98ad5) into main (58a358b) will increase coverage by 0.26%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #436      +/-   ##
==========================================
+ Coverage   67.99%   68.26%   +0.26%     
==========================================
  Files         156      159       +3     
  Lines        9046     9226     +180     
  Branches       73       73              
==========================================
+ Hits         6151     6298     +147     
- Misses       2289     2308      +19     
- Partials      606      620      +14     
Flag Coverage Δ
unittest-go-macos-latest 62.82% <ø> (+0.19%) ⬆️
unittest-go-ubuntu-latest 67.54% <ø> (+0.01%) ⬆️
unittest-go-windows-2022 62.27% <ø> (?)
unittest-js 64.07% <ø> (ø)
Impacted Files Coverage Δ
pty/pty_windows.go 68.25% <0.00%> (ø)
pty/start_windows.go 60.86% <0.00%> (ø)
agent/usershell/usershell_windows.go 0.00% <0.00%> (ø)
provisioner/terraform/provision.go 75.36% <0.00%> (+0.49%) ⬆️
provisionerd/provisionerd.go 78.67% <0.00%> (+0.55%) ⬆️
peer/conn.go 80.05% <0.00%> (+2.04%) ⬆️
peerbroker/listen.go 83.89% <0.00%> (+2.54%) ⬆️
peer/channel.go 85.96% <0.00%> (+2.92%) ⬆️
pty/ptytest/ptytest.go 100.00% <0.00%> (+5.55%) ⬆️
provisionersdk/transport.go 85.10% <0.00%> (+6.38%) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 58a358b...4c98ad5. Read the comment docs.

@bryphe-coder
Copy link
Contributor Author

bryphe-coder commented Mar 14, 2022

Thanks for the quick review @kylecarbs ! I'll test this out w/ the other dependabot PRs - and then move on to investigating the go intermittent failures we have:

Copy link
Contributor

@greyscaled greyscaled left a comment

Choose a reason for hiding this comment

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

Great job diagnosing and fixing this @bryphe-coder 🎉 !

Co-authored-by: G r e y <vapurrmaid@pm.me>
@bryphe-coder bryphe-coder merged commit 20faf89 into main Mar 14, 2022
@bryphe-coder bryphe-coder deleted the bryphe/fix/433/install-timeout branch March 14, 2022 18:49
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.

E2E | MacOS tests are failing intermittently on yarn install
3 participants