Fix #expect_in_fork helper to check mock expectations#5790
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d673afa176
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
ff81a58 to
ceaa0ce
Compare
|
Thanks to @ivoanjo for helping me debug this one, I was starting to doubt whether anything works in RSpec but it turns out it was a bug of that helper. |
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 2c3cd94 | Docs | Datadog PR Page | Give us feedback! |
Yeah looks suspiciously related to #5795 -- maybe rebase on top of master? |
* Before this, all mock expectations would be ignored, since they are checked after the `after` hooks run, but the fork only ran the passed block and stopped before any `after` hook. * RSpec::Mocks.with_temporary_scope creates a separate scope so only child process mock expectations are checked there. RSpec::Mocks.with_temporary_scope does the same RSpec::Mocks.verify after calling the block.
01d8a09 to
2c3cd94
Compare
BenchmarksBenchmark execution time: 2026-05-21 09:52:13 Comparing candidate commit 2c3cd94 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 46 metrics, 0 unstable metrics.
|
since they are checked after the
afterhooks run,but the fork only ran the passed block and stopped before any
afterhook.so only child process mock expectations are checked there.
RSpec::Mocks.with_temporary_scope does the same as RSpec::Mocks.verify after calling the block.
What does this PR do?
What the title says.
Motivation:
Change log entry
None
Additional Notes:
How to test the change?
I added a spec for
SynchronizationHelpers#expect_in_forkand verified it fails without the fix.I also did some manual tests.