Skip to content

Commit d7b26ad

Browse files
committed
Update tests
1 parent 1ca5930 commit d7b26ad

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

cli/ssh_test.go

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -414,17 +414,11 @@ func TestSSH(t *testing.T) {
414414
logDir := t.TempDir()
415415

416416
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)
418418
clitest.SetupConfig(t, client, root)
419419
pty := ptytest.New(t).Attach(inv)
420+
w := clitest.StartWithWaiter(t, inv)
420421

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-
})
428422
pty.ExpectMatch("Waiting")
429423

430424
agentClient := agentsdk.New(client.URL)
@@ -439,12 +433,11 @@ func TestSSH(t *testing.T) {
439433

440434
// Shells on Mac, Windows, and Linux all exit shells with the "exit" command.
441435
pty.WriteLine("exit")
442-
<-cmdDone
436+
w.RequireSuccess()
443437

444-
ents, err := os.ReadDir(t.TempDir())
438+
ents, err := os.ReadDir(logDir)
445439
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)
448441
})
449442
}
450443

0 commit comments

Comments
 (0)