test: rename ExpectMatchContext to ExpectMatch (#25998)

Cleans the last few instances of ExpectMatch that didn't use the new `(ctx, ...)` variant, then deletes the deprecated method and renames `ExpectMatchContext` to drop the `Context` suffix.
This commit is contained in:
Spike Curtis
2026-06-03 15:30:37 -04:00
committed by GitHub
parent 7d7cc27581
commit 5b692bf1cc
66 changed files with 524 additions and 536 deletions
+3 -2
View File
@@ -17,9 +17,10 @@ func TestPtytest(t *testing.T) {
t.Parallel()
t.Run("Echo", func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitMedium)
pty := ptytest.New(t)
pty.Output().Write([]byte("write"))
pty.ExpectMatch("write")
pty.ExpectMatch(ctx, "write")
pty.WriteLine("read")
})
@@ -38,7 +39,7 @@ func TestPtytest(t *testing.T) {
require.Equal(t, "line 2", pty.ReadLine(ctx))
require.Equal(t, "line 3", pty.ReadLine(ctx))
require.Equal(t, "line 4", pty.ReadLine(ctx))
require.Equal(t, "line 5", pty.ExpectMatch("5"))
require.Equal(t, "line 5", pty.ExpectMatch(ctx, "5"))
})
// See https://github.com/coder/coder/issues/2122 for the motivation
+4 -2
View File
@@ -26,9 +26,10 @@ func TestStart(t *testing.T) {
t.Parallel()
t.Run("Echo", func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitMedium)
pty, ps := ptytest.Start(t, pty.Command("echo", "test"))
pty.ExpectMatch("test")
pty.ExpectMatch(ctx, "test")
err := ps.Wait()
require.NoError(t, err)
err = pty.Close()
@@ -63,6 +64,7 @@ func TestStart(t *testing.T) {
t.Run("SSH_TTY", func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitMedium)
opts := pty.WithPTYOption(pty.WithSSHRequest(ssh.Pty{
Window: ssh.Window{
Width: 80,
@@ -70,7 +72,7 @@ func TestStart(t *testing.T) {
},
}))
pty, ps := ptytest.Start(t, pty.Command(`/bin/sh`, `-c`, `env | grep SSH_TTY`), opts)
pty.ExpectMatch("SSH_TTY=/dev/")
pty.ExpectMatch(ctx, "SSH_TTY=/dev/")
err := ps.Wait()
require.NoError(t, err)
err = pty.Close()
+2 -1
View File
@@ -27,8 +27,9 @@ func TestStart(t *testing.T) {
t.Parallel()
t.Run("Echo", func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitMedium)
ptty, ps := ptytest.Start(t, pty.Command("cmd.exe", "/c", "echo", "test"))
ptty.ExpectMatch("test")
ptty.ExpectMatch(ctx, "test")
err := ps.Wait()
require.NoError(t, err)
err = ptty.Close()