8000 feat(agent/agentcontainers): implement ignore customization for devcontainers by mafredri · Pull Request #18530 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

feat(agent/agentcontainers): implement ignore customization for devcontainers #18530

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 5 commits into from
Jun 24, 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
Diff view
Diff view
Prev Previous commit
nowindows
  • Loading branch information
mafredri committed Jun 24, 2025
commit f01711aaa1bb24ae173aaca9ee334415e7160f57
26 changes: 15 additions & 11 deletions agent/agentcontainers/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2074,6 +2074,10 @@ func TestAPI(t *testing.T) {
t.Run("IgnoreCustomization", func(t *testing.T) {
t.Parallel()

if runtime.GOOS == "windows" {
t.Skip("Dev Container tests are not supported on Windows (this test uses mocks but fails due to Windows paths)")
}

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

startTime := time.Date(2025, 1, 1, 12, 0, 0, 0, time.UTC)
Expand Down Expand Up @@ -2188,6 +2192,16 @@ func TestAPI(t *testing.T) {
err = api.RefreshContainers(ctx)
require.NoError(t, err)

t.Log("Phase 2: Cont, waiting for sub agent to exit")
exitSubAgentOnce.Do(func() {
close(exitSubAgent)
})
select {
case <-subAgentExited:
case <-ctx.Done():
t.Fatal("timeout waiting for sub agent to exit")
}

req = httptest.NewRequest(http.MethodGet, "/", nil).WithContext(ctx)
rec = httptest.NewRecorder()
r.ServeHTTP(rec, req)
Expand All @@ -2199,19 +2213,9 @@ func TestAPI(t *testing.T) {
assert.Len(t, response.Devcontainers, 1, "devcontainer should be in response when ignore=false")
assert.Len(t, response.Containers, 1, "regular container should still be listed")
assert.Equal(t, "/workspace/project", response.Devcontainers[0].WorkspaceFolder)
assert.Len(t, fakeSAC.created, 1, "sub agent should be created when ignore=false")
require.Len(t, fakeSAC.created, 1, "sub agent should be created when ignore=false")
createdAgentID := fakeSAC.created[0].ID

t.Log("Phase 2: Done, waiting for sub agent to exit")
exitSubAgentOnce.Do(func() {
close(exitSubAgent)
})
select {
case <-subAgentExited:
case <-ctx.Done():
t.Fatal("timeout waiting for sub agent to exit")
}

t.Log("Phase 3: Change back to ignore=true and test sub agent deletion")
fDCCLI.readConfig.Configuration.Customizations.Coder.Ignore = true
testutil.RequireSend(ctx, t, fakeSAC.deleteErrC, nil)
Expand Down
Loading
0