@@ -253,10 +253,8 @@ func TestServer(t *testing.T) {
253
253
"--access-url" , "http://localhost:3000/" ,
254
254
"--cache-dir" , t .TempDir (),
255
255
)
256
- stdoutRW := syncReaderWriter {}
257
- stderrRW := syncReaderWriter {}
258
- inv .Stdout = io .MultiWriter (os .Stdout , & stdoutRW )
259
- inv .Stderr = io .MultiWriter (os .Stderr , & stderrRW )
256
+ pty := ptytest .New (t ).Attach (inv )
257
+ require .NoError (t , pty .Resize (80 , 80 ))
260
258
clitest .Start (t , inv )
261
259
262
260
// Wait for startup
@@ -270,8 +268,9 @@ func TestServer(t *testing.T) {
270
268
// normally shown to the user, so we'll ignore them.
271
269
ignoreLines := []string {
272
270
"isn't externally reachable" ,
273
- "install.sh will be unavailable " ,
271
+ "open install.sh: file does not exist " ,
274
272
"telemetry disabled, unable to notify of security issues" ,
273
+ "installed terraform version newer than expected" ,
275
274
}
276
275
277
276
countLines := func (fullOutput string ) int {
@@ -282,9 +281,11 @@ func TestServer(t *testing.T) {
282
281
for _ , line := range linesByNewline {
283
282
for _ , ignoreLine := range ignoreLines {
284
283
if strings .Contains (line , ignoreLine ) {
284
+ t .Logf ("Ignoring: %q" , line )
285
285
continue lineLoop
286
286
}
287
287
}
288
+ t .Logf ("Counting: %q" , line )
288
289
if line == "" {
289
290
// Empty lines take up one line.
290
291
countByWidth ++
@@ -295,17 +296,10 @@ func TestServer(t *testing.T) {
295
296
return countByWidth
296
297
}
297
298
298
- stdout , err := io .ReadAll (& stdoutRW )
299
- if err != nil {
300
- t .Fatalf ("failed to read stdout: %v" , err )
301
- }
302
- stderr , err := io .ReadAll (& stderrRW )
303
- if err != nil {
304
- t .Fatalf ("failed to read stderr: %v" , err )
305
- }
306
-
307
- numLines := countLines (string (stdout )) + countLines (string (stderr ))
308
- require .Less (t , numLines , 20 )
299
+ out := pty .ReadAll ()
300
+ numLines := countLines (string (out ))
301
+ t .Logf ("numLines: %d" , numLines )
302
+ require .Less (t , numLines , 12 , "expected less than 12 lines of output (terminal width 80), got %d" , numLines )
309
303
})
310
304
311
305
t .Run ("OAuth2GitHubDefaultProvider" , func (t * testing.T ) {
0 commit comments