mirror of
https://github.com/coder/coder.git
synced 2026-09-21 20:51:01 +08:00
fix(cli): remove unnecessary PTY from TestServerCreateAdminUser/Validates (#25444)
Fixes https://linear.app/codercom/issue/PLAT-224 The Validates subtest only checks that `Run()` returns a validation error and never reads PTY output. We don't need it in this test, so removing. > 🤖 Generated by Coder Agents
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"io"
|
||||
"runtime"
|
||||
"testing"
|
||||
|
||||
@@ -224,8 +225,7 @@ func TestServerCreateAdminUser(t *testing.T) {
|
||||
}
|
||||
connectionURL, err := dbtestutil.Open(t)
|
||||
require.NoError(t, err)
|
||||
ctx, cancelFunc := context.WithCancel(context.Background())
|
||||
defer cancelFunc()
|
||||
ctx := testutil.Context(t, testutil.WaitShort)
|
||||
|
||||
root, _ := clitest.New(t,
|
||||
"server", "create-admin-user",
|
||||
@@ -235,10 +235,7 @@ func TestServerCreateAdminUser(t *testing.T) {
|
||||
"--email", "not-an-email",
|
||||
"--password", "x",
|
||||
)
|
||||
pty := ptytest.New(t)
|
||||
root.Stdout = pty.Output()
|
||||
root.Stderr = pty.Output()
|
||||
|
||||
root.Stdout, root.Stderr = io.Discard, io.Discard
|
||||
err = root.WithContext(ctx).Run()
|
||||
require.Error(t, err)
|
||||
require.ErrorContains(t, err, "'email' failed on the 'email' tag")
|
||||
|
||||
Reference in New Issue
Block a user