mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
test: reduce number of coderdtest instances (#23463)
Consolidates coderdtest invocations in 7 tests to reduce 23 instances to 7 across: - `TestGetUser` (3 → 1) — read-only user lookups - `TestUserTerminalFont` (3 → 1) — each creates own user via CreateAnotherUser - `TestUserTaskNotificationAlertDismissed` (3 → 1) — each creates own user - `TestUserLogin` (3 → 1) — each creates/deletes own user - `TestExpMcpConfigureClaudeCode` (5 → 1) — writes to isolated temp dirs - `TestOAuth2RegistrationTokenSecurity` (3 → 1) — independent registrations - `TestOAuth2SpecificErrorScenarios` (3 → 1) — independent error scenarios > 🤖 This PR was created with the help of Coder Agents, and has been reviewed by my human. 🧑💻
This commit is contained in:
@@ -104,11 +104,14 @@ func TestOAuth2ClientIsolation(t *testing.T) {
|
||||
func TestOAuth2RegistrationTokenSecurity(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// Single instance shared across all sub-tests. Each registers
|
||||
// independent OAuth2 apps with unique client names.
|
||||
client := coderdtest.New(t, nil)
|
||||
_ = coderdtest.CreateFirstUser(t, client)
|
||||
|
||||
t.Run("InvalidTokenFormats", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
client := coderdtest.New(t, nil)
|
||||
_ = coderdtest.CreateFirstUser(t, client)
|
||||
ctx := t.Context()
|
||||
|
||||
// Register a client to use for testing
|
||||
@@ -145,8 +148,6 @@ func TestOAuth2RegistrationTokenSecurity(t *testing.T) {
|
||||
t.Run("TokenNotReusableAcrossClients", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
client := coderdtest.New(t, nil)
|
||||
_ = coderdtest.CreateFirstUser(t, client)
|
||||
ctx := t.Context()
|
||||
|
||||
// Register first client
|
||||
@@ -179,8 +180,6 @@ func TestOAuth2RegistrationTokenSecurity(t *testing.T) {
|
||||
t.Run("TokenNotExposedInGETResponse", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
client := coderdtest.New(t, nil)
|
||||
_ = coderdtest.CreateFirstUser(t, client)
|
||||
ctx := t.Context()
|
||||
|
||||
// Register a client
|
||||
|
||||
Reference in New Issue
Block a user