You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I propose that testing.AllocsPerRun panic if called during a parallel test,
because it cannot give accurate results in that context. Tests that use
the result in that context will be flaky.
For example, flake #70327 was caused by a test that called t.Parallel
and then used AllocsPerRun. The other tests running in parallel
had allocations that were observed by the AllocsPerRun, resulting
in inconsistent results and a flaky failure.
Personally I think this is a bug fix. I don't think it needs to go through the proposal process. Since it can't work correctly, it's hard for me to believe that anybody depends on the current behavior.
I propose that testing.AllocsPerRun panic if called during a parallel test,
because it cannot give accurate results in that context. Tests that use
the result in that context will be flaky.
For example, flake #70327 was caused by a test that called t.Parallel
and then used AllocsPerRun. The other tests running in parallel
had allocations that were observed by the AllocsPerRun, resulting
in inconsistent results and a flaky failure.
I've implemented this change in CL 630137.
The text was updated successfully, but these errors were encountered: