8000 feat(agent/reconnectingpty): allow selecting backend type by johnstcn · Pull Request #17011 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

feat(agent/reconnectingpty): allow selecting backend type #17011

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 2 commits into from
Mar 20, 2025
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
8000
Diff view
Diff view
Prev Previous commit
fixup! feat(agent/reconnectingpty): allow selecting backend type
  • Loading branch information
johnstcn committed Mar 19, 2025
commit f3595c3d6a09a1cc688a3407eb5e3f424f85550a
30 changes: 25 additions & 5 deletions cli/exp_rpty_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package cli_test

import (
"fmt"
"runtime"
"testing"

"github.com/google/uuid"
"github.com/ory/dockertest/v3"
"github.com/ory/dockertest/v3/docker"

Expand All @@ -23,7 +23,7 @@ import (
func TestExpRpty(t *testing.T) {
t.Parallel()

t.Run("OK", func(t *testing.T) {
t.Run("DefaultCommand", func(t *testing.T) {
t.Parallel()

client, workspace, agentToken := setupWorkspaceForAgent(t)
Expand All @@ -41,11 +41,33 @@ func TestExpRpty(t *testing.T) {
_ = agenttest.New(t, client.URL, agentToken)
_ = coderdtest.NewWorkspaceAgentWaiter(t, client, workspace.ID).Wait()

pty.ExpectMatch(fmt.Sprintf("Connected to %s", workspace.Name))
pty.WriteLine("exit")
<-cmdDone
})

t.Run("Command", func(t *testing.T) {
t.Parallel()

client, workspace, agentToken := setupWorkspaceForAgent(t)
randStr := uuid.NewString()
inv, root := clitest.New(t, "exp", "rpty", workspace.Name, "echo", randStr)
clitest.SetupConfig(t, client, root)
pty := ptytest.New(t).Attach(inv)

ctx := testutil.Context(t, testutil.WaitLong)

cmdDone := tGo(t, func() {
err := inv.WithContext(ctx).Run()
assert.NoError(t, err)
})

_ = agenttest.New(t, client.URL, agentToken)
_ = coderdtest.NewWorkspaceAgentWaiter(t, client, workspace.ID).Wait()

pty.ExpectMatch(randStr)
<-cmdDone
})

t.Run("NotFound", func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -103,8 +125,6 @@ func TestExpRpty(t *testing.T) {
assert.NoError(t, err)
})

pty.ExpectMatch(fmt.Sprintf("Connected to %s", workspace.Name))
pty.ExpectMatch("Reconnect ID: ")
pty.ExpectMatch(" #")
pty.WriteLine("hostname")
pty.ExpectMatch(ct.Container.Config.Hostname)
Expand Down
Loading
0