mirror of
https://github.com/mattermost/mattermost.git
synced 2026-06-11 20:07:34 +00:00
The subtest used a fixed sleep before asserting callback counts, but job.run waits until runAt plus up to scheduleOnceJitter. Under the race detector or loaded CI that window can elapse after the sleep, so newCount3 is still 0 and the assertion flakes. Poll with require.Eventually (same approach as the paging subtest in #35891) so the test waits for the scheduled callback without weakening assertions. Tests-only change. Verified with: go test -run '^TestScheduleOnceSequential$/adding_two_callback_works' \ -race -count=100 ./pluginapi/cluster/... (from server/public) Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: mattermost-code <matty-code@mattermost.com>