ConduitIO / ConduitIO/conduit

Rare flake: mock source helper cleanup asserts done before the record goroutine returns

Open
#2,581 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
610
Forks
63
Avg merge
12h 28m
Merged PRs (30d)
57

Description

Surfaced during the #2578 flaky-test fix (flagged by the review, deliberately left out of that PR to avoid a rushed change to shared infra).

`SourcePluginWithRecords` in `pkg/plugin/connector/mock/source.go` registers `t.Cleanup(func(){ is.True(done.Load()) })` where `done` is set via `defer done.Store(true)` at the end of the source's record-sending goroutine. If a test tears down before that goroutine returns, the cleanup assertion fails. It is very rare — after #2578, `pkg/lifecycle-poc` passes ~2700 consecutive `-race` runs; this reproduced once at `-count=100` and not again in 2000+ subsequent runs (the review hit it only at 6× CPU load + `-count=1500`).

This is **shared** test infra (used well beyond lifecycle-poc), so the fix wants care + its own verification, not a rushed change. Options: have the cleanup wait for `done` with a bounded timeout before asserting (preserves intent — 'the run should finish' — while tolerating scheduling delay), or ensure callers join the source goroutine before returning. Needs stress-verification that it doesn't mask a genuine hang. Tracking so CI's rare residual has an owner.

Contributor guide

Open the contributing guide

Research direction

Start in pkg/plugin/connector/mock/source.go at SourcePluginWithRecords and inspect the cleanup assertion alongside the record-sending goroutine. Reproduce with the stress commands described in the issue, including -race and repeated counts, then verify the chosen fix prevents scheduling flakes without masking a genuine hang.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.