Fix flaky TestSetTraceFunc#test_remove_in_trace by filtering trace events #11368
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
According to Lauchable, TestSetTraceFunc#test_remove_in_trace is one of flaky tests.
https://app.launchableinc.com/organizations/ruby/workspaces/ruby/data/test-paths/file%3Dtest%2Fruby%2Ftest_settracefunc.rb%23%23%23class%3DTestSetTraceFunc%23%23%23testcase%3Dtest_remove_in_trace?testSessionStatus=fail
Here is the log when failing it.
Based on investigation, the test was failed when unexpected instance was set in
ok
variable because unexpected events like Tempfile::Closer was traced. Here is the log when outputting the log. The former event, "e: c-return, f: /home/runner/work/ruby/ruby/src/test/ruby/test_settracefunc.rb..." is expected event, but the latter one is not. Thus, I modified test code so that we can filter out unexpected trace events.https://github.com/ruby/ruby/actions/runs/10365091706/job/28691604883?pr=11323#step:12:19393