Skip to content

flake: TestAPI/Delete/OK_with_container_and_subagent #1305

@flake-investigator

Description

@flake-investigator

CI Failure Details

Root Cause Classification

  • Type: Flaky Test (mock expectation + timeout)
  • Affected package: agent/agentcontainers
  • Failing test: TestAPI/Delete/OK_with_container_and_subagent

Error Evidence

=== FAIL: agent/agentcontainers TestAPI/Delete/OK_with_container_and_subagent (25.01s)
api.go:1783: Unexpected call to *acmock.MockContainerCLI.DetectArchitecture(...)
  expected call at api_test.go:364 has already been called the max number of times
api_test.go:1481: refresh containers failed:
    github.com/coder/coder/v2/agent/agentcontainers.(*API).RefreshContainers.func1
    /home/runner/work/coder/coder/agent/agentcontainers/api.go:1168
  - context deadline exceeded
controller.go:97: missing call(s) to *acmock.MockContainerCLI.Stop(...)
controller.go:97: missing call(s) to *acmock.MockContainerCLI.Remove(...)

Analysis

  • The subtest starts the updater loop and injects a subagent, then explicitly calls api.RefreshContainers(ctx) before issuing the DELETE request.
  • During refresh, a background updater invocation triggers an extra DetectArchitecture call, exceeding the gomock expectation and leading to a context deadline timeout.
  • The timeout short-circuits the delete flow, so the expected Stop/Remove calls are never observed.
  • No panic/OOM or race detector output was observed in this job.

Ownership / Assignment

Primary assignment uses test function blame per guidelines.

Relevant test lines:

  • File: agent/agentcontainers/api_test.go
  • Subtest: "OK with container and subagent" around line ~1363 (log references api_test.go:1406/1481)

Suggested blame commands:

grep -n "OK with container and subagent" agent/agentcontainers/api_test.go
# -> line ~1363

git blame -L 1363,1460 agent/agentcontainers/api_test.go

Recent change context:

  • list_commits for the file shows commit 44a46db487 ("feat(agent): support deleting dev containers") by Danielle Maywood as the most recent substantive change to delete devcontainer tests; newer commits are import-only.

Assigning to Danielle Maywood for triage.

Related Issues

Reproduction

go test ./agent/agentcontainers -run TestAPI/Delete/OK_with_container_and_subagent -count=50

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions