8000 fix: Rewrite ptytest to buffer stdout by mafredri · Pull Request #3170 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

fix: Rewrite ptytest to buffer stdout #3170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 25, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
8000
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: Rename ctx to timeout
  • Loading branch information
mafredri committed Jul 25, 2022
commit d747356c2664894341bf7156dc1f16e08ba8d7f3
4 changes: 2 additions & 2 deletions pty/ptytest/ptytest.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ type PTY struct {
func (p *PTY) ExpectMatch(str string) string {
p.t.Helper()

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
timeout, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()

var buffer bytes.Buffer
Expand Down Expand Up @@ -119,7 +119,7 @@ func (p *PTY) ExpectMatch(str string) string {
}
p.t.Logf("%s: matched %q = %q", time.Now(), str, buffer.String())
return buffer.String()
case <-ctx.Done():
case <-timeout.Done():
_ = p.out.closeErr(p.Close())
p.t.Fatalf("%s: match exceeded deadline: wanted %q; got %q", time.Now(), str, buffer.String())
return ""
Expand Down
0