Skip to content

test: scaletest/reconnectingpty: use TerminalReader #15079

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 8 commits into from
Oct 16, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixes
  • Loading branch information
mtojek committed Oct 15, 2024
commit eced09c935e27ea04ee90f52fb052a2ffa370139
13 changes: 6 additions & 7 deletions scaletest/reconnectingpty/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,10 @@ func Test_Runner(t *testing.T) {

logs := bytes.NewBuffer(nil)
err := runner.Run(ctx, "1", logs)
require.NoError(t, err)

tr := testutil.NewTerminalReader(t, logs)
err = tr.ReadUntilString(ctx, "expected timeout")
require.NoError(t, err)
logStr := logs.String()
t.Log("Runner logs:\n\n" + logStr)
require.Error(t, err)
require.ErrorContains(t, err, "expected timeout")
})
})

Expand Down Expand Up @@ -228,15 +227,15 @@ func Test_Runner(t *testing.T) {
Init: workspacesdk.AgentReconnectingPTYInit{
Command: "echo 'hello world'; sleep 1",
},
LogOutput: false,
LogOutput: true,
})

ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitSuperLong)
defer cancel()

logs := bytes.NewBuffer(nil)
err := runner.Run(ctx, "1", logs)
require.Error(t, err)
require.NoError(t, err)

tr := testutil.NewTerminalReader(t, logs)
err = tr.ReadUntilString(ctx, "bello borld")
Expand Down
Loading