Skip to content

fix: enable goleak in chatd tests - #26335

Merged
hugodutka merged 1 commit into
mainfrom
hugodutka/chatd-enable-goleak
Jun 16, 2026
Merged

hugodutka merged 1 commit into
mainfrom
hugodutka/chatd-enable-goleak

Conversation

@hugodutka

Copy link
Copy Markdown
Collaborator

Enable goleak in chatd tests and fix some leaks. Addresses #26109 (comment)

@mafredri mafredri left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

t.Cleanup -> defer, otherwise LGTM 👍🏻

t.Parallel()

buffer := messagepartbuffer.New(messagepartbuffer.Options{})
t.Cleanup(buffer.Close)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
t.Cleanup(buffer.Close)
defer buffer.Close()

Nit: Prefer defer as if writing regular Go code. Using t.Cleanup mixed with defers (the common path) breaks the expectation of order of events.

otherRunnerID := uuid.New()
f.acquireChat(t, chat.ID, otherWorkerID, otherRunnerID)
recorder := newTaskSideEffectRecorder()
starter := newTestTaskStarter(t, f, messagepartbuffer.New(messagepartbuffer.Options{}), recorder)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might make sense to just move messagepartbuffer.New to newTestTaskStarter and do the cleanup there?

@hugodutka
hugodutka force-pushed the hugodutka/chatd-enable-goleak branch from c77a4a1 to 9f306d0 Compare June 16, 2026 12:23
@hugodutka
hugodutka enabled auto-merge (squash) June 16, 2026 12:24
@hugodutka
hugodutka merged commit 4f74a7a into main Jun 16, 2026
28 checks passed
@hugodutka
hugodutka deleted the hugodutka/chatd-enable-goleak branch June 16, 2026 12:35
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants