Skip to content

Add more tests#4

Merged
serroba merged 2 commits into
mainfrom
dev
Dec 31, 2025
Merged

Add more tests#4
serroba merged 2 commits into
mainfrom
dev

Conversation

@serroba
Copy link
Copy Markdown
Owner

@serroba serroba commented Dec 31, 2025

No description provided.

Copilot AI review requested due to automatic review settings December 31, 2025 04:14
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_Concurrent to test concurrent requests that exceed user capacity
  • Refactors type conversion in TestRegistry_Allow_ConcurrentNewUsers by removing redundant string conversion
  • Imports the assert package to support the new test

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread token/registry_test.go

wg.Wait()

// Each user has capacity 100, only 50 requests each, so all should be allowed
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
// 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

Copilot uses AI. Check for mistakes.
Comment thread token/registry_test.go
wg sync.WaitGroup
)

// 50 goroutines per user, 4 users = 200 goroutines
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@serroba serroba merged commit 3dd20b7 into main Dec 31, 2025
1 check passed
@serroba serroba deleted the dev branch December 31, 2025 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants