Skip to content

Commit 451fd89

Browse files
committed
fix
1 parent 6c045da commit 451fd89

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

scaletest/reconnectingpty/run_test.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package reconnectingpty_test
33
import (
44
"bytes"
55
"context"
6+
"io"
67
"testing"
78
"time"
89

@@ -72,11 +73,12 @@ func Test_Runner(t *testing.T) {
7273

7374
logs := bytes.NewBuffer(nil)
7475
err := runner.Run(ctx, "1", logs)
75-
logStr := logs.String()
76-
t.Log("Runner logs:\n\n" + logStr)
7776
require.NoError(t, err)
7877

79-
require.NotContains(t, logStr, "Output:")
78+
tr := testutil.NewTerminalReader(t, logs)
79+
err = tr.ReadUntilString(ctx, "Output:")
80+
require.Error(t, err)
81+
require.ErrorIs(t, err, io.EOF)
8082
})
8183

8284
t.Run("Timeout", func(t *testing.T) {
@@ -226,19 +228,20 @@ func Test_Runner(t *testing.T) {
226228
Init: workspacesdk.AgentReconnectingPTYInit{
227229
Command: "echo 'hello world'; sleep 1",
228230
},
229-
ExpectOutput: "bello borld",
230-
LogOutput: false,
231+
LogOutput: false,
231232
})
232233

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

236237
logs := bytes.NewBuffer(nil)
237238
err := runner.Run(ctx, "1", logs)
238-
logStr := logs.String()
239-
t.Log("Runner logs:\n\n" + logStr)
240239
require.Error(t, err)
241-
require.ErrorContains(t, err, `expected string "bello borld" not found`)
240+
241+
tr := testutil.NewTerminalReader(t, logs)
242+
err = tr.ReadUntilString(ctx, "bello borld")
243+
require.Error(t, err)
244+
require.ErrorIs(t, err, io.EOF)
242245
})
243246
})
244247
}

0 commit comments

Comments
 (0)