cleanup and logging for unit tests