Our current setup checks all assertions against defined Mocks when a MockServer instance is being dropped.
If a test is panicking for unrelated reason (e.g. a test assertion failed) it is possible (and sometimes quite likely) that assertions won't be satisfied either, hence when Drop is called on the MockServer while unwinding the stack another panic takes place and the whole process is aborted.
This is undesirable for several reasons:
the whole test suite crashes, therefore it interferes with other tests in the same suite;
no backtrace will be printed, therefore it is very messy to debug what happened.
We should leverage panicking and avoid panicking if the current thread is panicking, limiting ourselves to printing/logging the failure.
Our current setup checks all assertions against defined
Mock
s when aMockServer
instance is being dropped. If a test is panicking for unrelated reason (e.g. a test assertion failed) it is possible (and sometimes quite likely) that assertions won't be satisfied either, hence whenDrop
is called on theMockServer
while unwinding the stack another panic takes place and the whole process is aborted.This is undesirable for several reasons:
We should leverage panicking and avoid panicking if the current thread is panicking, limiting ourselves to printing/logging the failure.