Skip to content

Commit 20faf89

Browse files
authored
fix: Test flake when installing yarn dependencies on MacOS (coder#436)
This fixes coder#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
1 parent 58a358b commit 20faf89

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

.github/workflows/coder.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ jobs:
6161
**/node_modules
6262
.eslintcache
6363
key: js-${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }}
64+
restore-keys: |
65+
js-${{ runner.os }}-
6466
6567
- name: Install node_modules
6668
run: ./scripts/yarn_install.sh
@@ -108,6 +110,8 @@ jobs:
108110
**/node_modules
109111
.eslintcache
110112
key: js-${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }}
113+
restore-keys: |
114+
js-${{ runner.os }}-
111115
112116
- name: Install node_modules
113117
run: ./scripts/yarn_install.sh
@@ -250,6 +254,8 @@ jobs:
250254
**/node_modules
251255
.eslintcache
252256
key: js-${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }}
257+
restore-keys: |
258+
js-${{ runner.os }}-
253259
254260
# Go is required for uploading the test results to datadog
255261
- uses: actions/setup-go@v2
@@ -312,6 +318,8 @@ jobs:
312318
**/node_modules
313319
.eslintcache
314320
key: js-${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }}
321+
restore-keys: |
322+
js-${{ runner.os }}-
315323
316324
# Go is required for uploading the test results to datadog
317325
- uses: actions/setup-go@v2

site/.yarnrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
network-timeout 300000

0 commit comments

Comments
 (0)