@@ -414,17 +414,11 @@ func TestSSH(t *testing.T) {
414
414
logDir := t .TempDir ()
415
415
416
416
client , workspace , agentToken := setupWorkspaceForAgent (t , nil )
417
- inv , root := clitest .New (t , "ssh" , workspace . Name , "-l" , logDir )
417
+ inv , root := clitest .New (t , "ssh" , "-l" , logDir , workspace . Name )
418
418
clitest .SetupConfig (t , client , root )
419
419
pty := ptytest .New (t ).Attach (inv )
420
+ w := clitest .StartWithWaiter (t , inv )
420
421
421
- ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
422
- defer cancel ()
423
-
424
- cmdDone := tGo (t , func () {
425
- err := inv .WithContext (ctx ).Run ()
426
- assert .NoError (t , err )
427
- })
428
422
pty .ExpectMatch ("Waiting" )
429
423
430
424
agentClient := agentsdk .New (client .URL )
@@ -439,12 +433,11 @@ func TestSSH(t *testing.T) {
439
433
440
434
// Shells on Mac, Windows, and Linux all exit shells with the "exit" command.
441
435
pty .WriteLine ("exit" )
442
- <- cmdDone
436
+ w . RequireSuccess ()
443
437
444
- ents , err := os .ReadDir (t . TempDir () )
438
+ ents , err := os .ReadDir (logDir )
445
439
require .NoError (t , err )
446
-
447
- require .Len (t , ents , 1 , "expected one file in logdir" )
440
+ require .Len (t , ents , 1 , "expected one file in logdir %s" , logDir )
448
441
})
449
442
}
450
443
0 commit comments