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

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 self-assigned this Mar 2, 2020
@tonyredondo tonyredondo force-pushed the goroutines-panic-handler branch from 3ee51f4 to e5e78fe Compare March 2, 2020 16:05
@tonyredondo tonyredondo force-pushed the goroutines-panic-handler branch from e5e78fe to b264cfe Compare March 11, 2020 14:15
@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.

4 participants