Skip to content
This repository has been archived by the owner on Aug 17, 2020. It is now read-only.

Goroutines global panic handler #188

Merged
merged 4 commits into from
Mar 13, 2020
Merged

Conversation

tonyredondo
Copy link
Contributor

Currently when a test starts a new goroutine, and this goroutine panics, all process crashes without any signal so the data inside the recorder's buffer is lost. This let us without data for the missing tests for that execution and possible failures being hidden by the missing data.

This PR adds a new goroutines global panic handler allowing to fail running tests and flush the recorder buffer before process exit.

When a panic occurs in any goroutine, the following is executed:

  1. Panic event!
  2. Handlers registered with AddPanicHandler are executed
  3. If the panic is handled and recovered by the goroutine the execution continues...
  4. If the panic is unhandled the process will crash, before crashing all handlers registered with AddOnPanicExitHandler are executed.
  5. Process end with an exit code != 0

For this PR before crashing we finish all running tests with status Fail and write the panic info as an exception in each one.

@tonyredondo tonyredondo merged commit 5d294f6 into master Mar 13, 2020
@tonyredondo tonyredondo deleted the goroutines-panic-handler branch March 13, 2020 17:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants