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 reached
More reviews will be available in 22 minutes and 6 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?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 credits. 🚦 How do rate 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 see our Fair Usage Limits Policy for further information. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
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
81272ae to
ba55b3c
Compare
|
@coderabbitai review |
Rate Limit Exceeded
|
|
@coderabbitai full review (Earlier |
|
✅ Action performedFull review finished. |
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