test(cmd): funnel goroutine results to test goroutine in alias test#1239
test(cmd): funnel goroutine results to test goroutine in alias test#1239cristim wants to merge 1 commit into
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 11 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
81272ae to
ba55b3c
Compare
|
@coderabbitai review |
Rate Limit Exceeded
|
|
@coderabbitai full review (Earlier |
|
✅ Action performedFull review finished. |
ba55b3c to
f3c4d52
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
Merge-prep: rebased onto origin/main (27fdb06). Gates: |
|
✅ Action performedReview finished.
|
f3c4d52 to
1c8f727
Compare
|
Rebased onto origin/main (89658a3 -> a945344) which includes #1437 (tflint plugin cache + retry) and #1438 (trivy |
TestGetAccountAliasConcurrency had 10 worker goroutines each calling assert.Equal directly. Only the test goroutine may call assert/require; calling them from workers risks lost failures or post-test panics if the join is ever removed or assert is upgraded to require. Workers now send results over a buffered channel and the test goroutine asserts after wg.Wait(), matching the errCh pattern used in validator_test.go and service_user_test.go. Verified with go test -race ./cmd/ (733 tests pass). Closes #1159
1c8f727 to
cf1dc18
Compare
Problem
Code-review finding TEST-06 (P3, issue #1159): in
TestGetAccountAliasConcurrency(cmd/helpers_test.go), 10 worker goroutines each calledassert.Equal(t, ...)directly. Only the test goroutine may call assert/require; the current join via adonechannel prevents a post-completion race today, but the pattern is fragile: upgradingasserttorequireinside a goroutine, or removing the join, turns failures into lost reports or post-test panics.Fix
Workers now send their
GetAccountAliasresults over a bufferedresultschannel and only the test goroutine asserts, afterwg.Wait()andclose(results). This matches the established errCh pattern used ininternal/server/scheduledauth/validator_test.goandinternal/auth/service_user_test.go. The goroutine count is a named constant (numGoroutines) instead of a repeated literal.Test evidence
go build ./...passesgo test -race -run TestGetAccountAlias ./cmd/passes (6 tests)go test -race ./cmd/passes (733 tests)This is a test-hygiene refactor of an existing test; the mock single-call invariant (
mockOrg.AssertExpectations) and the double-checked-locking coverage are unchanged.Closes #1159