Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix race condition in RCTLoggingTests integration tests (facebook#34858)
Summary: Pull Request resolved: facebook#34858 Changelog: [iOS][Fixed] - Fix race condition in RCTLoggingTests integration tests RCTLoggingTests work in the following way: * Put a custom hook on logging (logging function) to intercept log messages * Send several log messages via JS and see whether they hit the hook as expected The problem with this approach was that there may be unexpected log messages, which squeeze inbetween the points of time when the hook was set and when the first message was sent. There was a (now 6 years old!!!) fix to mitigate this problem, which was adding a lead pause of 2s to "make sure" that all the other possible log messages had been sent: facebook#10568 That didn't actually guarantee fixing the problem in general, just partially mitigating it, as the race condition conceptually still remained there. Here I take a different approach, which should guarantee that we skip all the rogue JS messages before we start sending and reading them on our own: * Install the hook * Log a "marker" message * Pump the log until the marker appears - at this point we know that the hook has been definitely installed Reviewed By: cipolleschi Differential Revision: D40043442 fbshipit-source-id: b4aa617d27c2dcff26682dd72e47ec19cb0d11ca
- Loading branch information