Skip to content

[pull] main from coder:main #210

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 7 commits into from
May 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
Diff view
Diff view
16 changes: 8 additions & 8 deletions agent/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2188,14 +2188,14 @@ func TestAgent_DevcontainerRecreate(t *testing.T) {

t.Logf("Looking for container with label: devcontainer.local_folder=%s", workspaceFolder)

var container docker.APIContainers
var container codersdk.WorkspaceAgentContainer
testutil.Eventually(ctx, t, func(context.Context) bool {
containers, err := pool.Client.ListContainers(docker.ListContainersOptions{All: true})
resp, err := conn.ListContainers(ctx)
if err != nil {
t.Logf("Error listing containers: %v", err)
return false
}
for _, c := range containers {
for _, c := range resp.Containers {
t.Logf("Found container: %s with labels: %v", c.ID[:12], c.Labels)
if v, ok := c.Labels["devcontainer.local_folder"]; ok && v == workspaceFolder {
t.Logf("Found matching container: %s", c.ID[:12])
Expand All @@ -2205,7 +2205,7 @@ func TestAgent_DevcontainerRecreate(t *testing.T) {
}
return false
}, testutil.IntervalMedium, "no container with workspace folder label found")
defer func(container docker.APIContainers) {
defer func(container codersdk.WorkspaceAgentContainer) {
// We can't rely on pool here because the container is not
// managed by it (it is managed by @devcontainer/cli).
err := pool.Client.RemoveContainer(docker.RemoveContainerOptions{
Expand All @@ -2225,7 +2225,7 @@ func TestAgent_DevcontainerRecreate(t *testing.T) {
// Invoke recreate to trigger the destruction and recreation of the
// devcontainer, we do it in a goroutine so we can process logs
// concurrently.
go func(container docker.APIContainers) {
go func(container codersdk.WorkspaceAgentContainer) {
err := conn.RecreateDevcontainer(ctx, container.ID)
assert.NoError(t, err, "recreate devcontainer should succeed")
}(container)
Expand Down Expand Up @@ -2253,12 +2253,12 @@ waitForOutcomeLoop:

// Make sure the container exists and isn't the same as the old one.
testutil.Eventually(ctx, t, func(context.Context) bool {
containers, err := pool.Client.ListContainers(docker.ListContainersOptions{All: true})
resp, err := conn.ListContainers(ctx)
if err != nil {
t.Logf("Error listing containers: %v", err)
return false
}
for _, c := range containers {
for _, c := range resp.Containers {
t.Logf("Found container: %s with labels: %v", c.ID[:12], c.Labels)
if v, ok := c.Labels["devcontainer.local_folder"]; ok && v == workspaceFolder {
if c.ID == container.ID {
Expand All @@ -2272,7 +2272,7 @@ waitForOutcomeLoop:
}
return false
}, testutil.IntervalMedium, "new devcontainer not found")
defer func(container docker.APIContainers) {
defer func(container codersdk.WorkspaceAgentContainer) {
// We can't rely on pool here because the container is not
// managed by it (it is managed by @devcontainer/cli).
err := pool.Client.RemoveContainer(docker.RemoveContainerOptions{
Expand Down
Loading
Loading