Skip to content

Commit 2aa749a

Browse files
authored
chore(cli): fix test flake caused by agent connect race (#16725)
Fixes test flake seen here: https://github.com/coder/coder/actions/runs/13552012547/job/37877778883 ``` exp_rpty_test.go:96: Error Trace: /home/runner/work/coder/coder/cli/exp_rpty_test.go:96 /home/runner/work/coder/coder/cli/ssh_test.go:1963 /home/runner/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.9.linux-amd64/src/runtime/asm_amd64.s:1695 Error: Received unexpected error: running command "coder exp rpty": GET http://localhost:37991/api/v2/workspaceagents/3785b98f-0589-47d2-a3c8-33a55a6c5b29/containers: unexpected status code 400: Agent state is "connecting", it must be in the "connected" state. Test: TestExpRpty/Container ```
1 parent 81ef9e9 commit 2aa749a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cli/exp_rpty_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ func TestExpRpty(t *testing.T) {
8787
require.NoError(t, err, "Could not stop container")
8888
})
8989

90+
_ = agenttest.New(t, client.URL, agentToken, func(o *agent.Options) {
91+
o.ExperimentalContainersEnabled = true
92+
})
93+
_ = coderdtest.NewWorkspaceAgentWaiter(t, client, workspace.ID).Wait()
94+
9095
inv, root := clitest.New(t, "exp", "rpty", workspace.Name, "-c", ct.Container.ID)
9196
clitest.SetupConfig(t, client, root)
9297
pty := ptytest.New(t).Attach(inv)
@@ -96,11 +101,6 @@ func TestExpRpty(t *testing.T) {
96101
assert.NoError(t, err)
97102
})
98103

99-
_ = agenttest.New(t, client.URL, agentToken, func(o *agent.Options) {
100-
o.ExperimentalContainersEnabled = true
101-
})
102-
_ = coderdtest.NewWorkspaceAgentWaiter(t, client, workspace.ID).Wait()
103-
104104
pty.ExpectMatch(fmt.Sprintf("Connected to %s", workspace.Name))
105105
pty.ExpectMatch("Reconnect ID: ")
106106
pty.ExpectMatch(" #")

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy