test: wait for devcontainer readiness#25567
Conversation
| var parentAgentID uuid.UUID | ||
| for _, resource := range resources { | ||
| for _, workspaceAgent := range resource.Agents { | ||
| if workspaceAgent.Name == parentAgentName { | ||
| parentAgentID = workspaceAgent.ID | ||
| } | ||
| } | ||
| } | ||
| require.NotEqual(t, uuid.Nil, parentAgentID) |
There was a problem hiding this comment.
non-blocking, suggestion: I feel like this "give me the parent agent" is ripe for a helper or something. I recall seeing it in a few places.
There was a problem hiding this comment.
Definitely remember thinking this when working more heavily on dev containers. Have span up a helper in codertest and gotten the agent to find places to use it in
| for _, dc := range resp.Devcontainers { | ||
| if dc.ID != devcontainerID { | ||
| continue | ||
| } | ||
| if dc.Status != codersdk.WorkspaceAgentDevcontainerStatusRunning { | ||
| return false | ||
| } | ||
| if dc.Container == nil || dc.Container.ID != containerID { | ||
| return false | ||
| } | ||
| if dc.Agent == nil || dc.Agent.Name != devcontainerName { | ||
| return false | ||
| } | ||
| devcontainerAgentID = dc.Agent.ID | ||
| } | ||
| if devcontainerAgentID == uuid.Nil { | ||
| return false | ||
| } |
There was a problem hiding this comment.
non-blocking, suggestion: might be worth dropping a few more t.Logf's before the false returns.
There was a problem hiding this comment.
The agent gave it a go 😄
|
|
||
| // WorkspaceAgentWaiter only observes coderd state. The CLI exercises | ||
| // the parent agent container API through tailnet, so wait for that path | ||
| // before starting parallel open commands. |
There was a problem hiding this comment.
This comment is just very confusingly written.
There was a problem hiding this comment.
Will rewrite
There was a problem hiding this comment.
Agent rewrote it. I think it makes more sense now but if you want it refined again lemme know
Note
🤖 This PR was written by Coder Agent on behalf of Danielle Maywood
TestOpenVSCodeDevContainercould start its parallelcoder open vscodesubtests before the parent agent's container API was ready through tailnet. This adds a setup wait for the parent container API to return the running devcontainer and for the devcontainer subagent to be visible as connected before the parallel CLI checks begin.Research
A recent CI failure timed out in
coder open vscodewhile listing parent workspace agent containers. The coderd request took nearly the full test deadline and the parent agent logged a container update after the subtest had already timed out.The existing
WorkspaceAgentWaiteronly waits for coderd's workspace agent state. It does not prove that the parent agent's HTTP API is reachable through tailnet or that the agent container cache has a running devcontainer with the subagent populated. The CLI path under test depends on that API before building the VS Code devcontainer link.The targeted fix keeps the parallel subtests but moves the readiness wait into setup. The wait exercises the same parent container endpoint the CLI uses and also confirms the devcontainer subagent is present in the workspace before the subtests run.