Skip to content

Commit e44663a

Browse files
mishushakovclaude
andcommitted
fix(ci): deflake redis lock test and covdata ETXTBSY race
- Raise the waiter timeout in TestStorageLocker_ObtainUsesProvidedContext from 25ms to 100ms. The whole notify chain (registration polling, lock release round-trip, pub/sub delivery) must fit in that window, which flaked on loaded CI runners. 100ms still stays below the minimum jittered fallback backoff (150ms), so the test keeps proving the notification path wakes the waiter. - Pre-build go tool covdata in test workflows. Go builds it on demand into the build cache and go test -cover invokes it concurrently as packages finish; racing first builds intermittently fail with ETXTBSY (text file busy). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 434ea70 commit e44663a

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

‎.github/workflows/pr-tests-arm64.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,13 @@ jobs:
173173
- name: Install gotestsum
174174
run: go install gotest.tools/gotestsum@v1.13.0
175175

176+
# Go builds `go tool covdata` on demand into the build cache, and
177+
# `go test -cover` invokes it concurrently as packages finish; racing
178+
# first builds can fail with ETXTBSY ("text file busy"). Build it once
179+
# up front so test-time invocations only exec the cached binary.
180+
- name: Pre-build go tool covdata
181+
run: go tool covdata >/dev/null 2>&1 || true
182+
176183
- name: Compile test binaries
177184
working-directory: ${{ matrix.package }}
178185
run: sudo -E `which go` test -run '^$' ${{ matrix.test_path }}

‎.github/workflows/pr-tests.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,13 @@ jobs:
122122
- name: Install gotestsum
123123
run: go install gotest.tools/gotestsum@v1.13.0
124124

125+
# Go builds `go tool covdata` on demand into the build cache, and
126+
# `go test -cover` invokes it concurrently as packages finish; racing
127+
# first builds can fail with ETXTBSY ("text file busy"). Build it once
128+
# up front so test-time invocations only exec the cached binary.
129+
- name: Pre-build go tool covdata
130+
run: go tool covdata >/dev/null 2>&1 || true
131+
125132
# sudo strips PATH; pass it through so gotestsum/go resolve to the runner's
126133
# toolchain (1.26.3) instead of /usr/bin/go. Trap chowns reports back to
127134
# the runner so uploads can read them even when tests fail.

‎packages/api/internal/sandbox/storage/redis/lock_test.go‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ func TestStorageLocker_ObtainUsesProvidedContext(t *testing.T) {
8181

8282
waiterDone := make(chan error, 1)
8383
go func() {
84-
waiterLock, obtainErr := locker.Obtain(t.Context(), lockKey, 25*time.Millisecond)
84+
// The timeout must stay below the minimum jittered fallback backoff
85+
// (lockRetryMinInterval * (1 - lockRetryJitter) = 150ms) so the waiter
86+
// can only succeed via the release notification, while leaving enough
87+
// headroom for Redis round-trips and CI scheduling jitter.
88+
waiterLock, obtainErr := locker.Obtain(t.Context(), lockKey, 100*time.Millisecond)
8589
if obtainErr != nil {
8690
waiterDone <- obtainErr
8791

0 commit comments

Comments
 (0)