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
feat: Parallel tests with global logger (google#1798)
Proof of concept of Parallel testing with a global logger via black
magic (inspecting stack traces).
Changes in this PR:
- Refactor `cmdlogger.CmdLogger` to be an interface.
- Move `cmdlogger.CmdLogger` implementation to be `cmdlogger.Handler`
- Create a new logging package caled `testlogger`, and an implementation
of `cmdlogger.CmdLogger` called `testlogger.Handler`
- `testlogger.Handler` passes all logging queries to a map of underlying
`cmdlogger.CmdLogger`s, with the key being the memory address value of
`testing.T` passed into each test.
- I believe this address should be unique for the lifespan of each test,
even if after the test the same memory address gets reused.
- Move static function into `static.go`
This results in much faster test runtimes again. On my local machine, it
takes the time taken down from over 5 minutes to <30 seconds.
Obviously this is not the most stable approach, as internal function
names and variables can change any time go is updated, but since this is
only used in tests, and breakages would be quite loud, I believe this is
acceptable.
0 commit comments