Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a new concurrent test case for the token registry and refactors an existing test. The changes enhance test coverage by verifying the registry's behavior when requests exceed capacity.
- Adds
TestRegistry_Deny_Concurrentto test concurrent requests that exceed user capacity - Refactors type conversion in
TestRegistry_Allow_ConcurrentNewUsersby removing redundant string conversion - Imports the
assertpackage to support the new test
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| wg.Wait() | ||
|
|
||
| // Each user has capacity 100, only 50 requests each, so all should be allowed |
There was a problem hiding this comment.
The comment states "only 50 requests each" but the code actually makes 110 requests per user. Update the comment to match the actual test implementation (110 requests per user with capacity 100, resulting in 400 allowed and 40 denied).
| // Each user has capacity 100, only 50 requests each, so all should be allowed | |
| // Each user has capacity 100 and makes 110 requests; in total 400 allowed and 40 denied |
| wg sync.WaitGroup | ||
| ) | ||
|
|
||
| // 50 goroutines per user, 4 users = 200 goroutines |
There was a problem hiding this comment.
The comment states "50 goroutines per user, 4 users = 200 goroutines" but the code actually creates 110 goroutines per user (4 users × 110 = 440 goroutines). Update the comment to accurately reflect the actual number of goroutines being created.
No description provided.