Skip to content

test: fix client project cleanup in setupLocalJobSystem loop - #54

Draft
devops-rob wants to merge 2 commits into
mainfrom
cursor/fix-client-test-defer-dea2
Draft

test: fix client project cleanup in setupLocalJobSystem loop#54
devops-rob wants to merge 2 commits into
mainfrom
cursor/fix-client-test-defer-dea2

Conversation

@devops-rob

Copy link
Copy Markdown
Contributor

Summary

Fixes a resource leak in Test_setupLocalJobSystem that can cause flaky hangs in subsequent internal/client tests such as TestProjectNoop.

Root cause

defer c.Close() inside a for loop only runs when the subtest function returns, not after each iteration. Earlier iterations' runners and test servers stayed active while later tests ran, which can cause GetJobStream to hang waiting for completion events under CI load.

Fix

  • Close each Project at the end of its loop iteration
  • Use t.Cleanup in the other subtest for consistent cleanup

Test Plan

  • go test -count=3 ./internal/client -run 'Test_setupLocalJobSystem|TestProjectNoop'
Open in Web Open in Cursor 

cursoragent and others added 2 commits July 31, 2026 17:52
defer c.Close() inside a for loop only runs when the subtest function
returns, leaving runners and servers from earlier iterations active while
later tests run. Close each project at the end of its iteration instead.

Co-authored-by: DevOps Rob <devops-rob@users.noreply.github.com>
defer c.Close() inside a for loop only runs when the subtest function
returns, leaving runners and servers from earlier iterations active while
later tests run. Close each project at the end of its iteration instead.

Co-authored-by: DevOps Rob <devops-rob@users.noreply.github.com>
@github-actions github-actions Bot added the core label Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants