Search code examples
kotlinhystrixnetflix

How to reset Hystrix Circuit Breaker completely before every unit tests?


I have some test cases, and also have a test where i want to test that CB get triggered. But every time i run the tests, sometimes it fails, some times it passed. I understand that i need to reset hystrix, but how can i do that? Thanx


Solution

  • I've had some issues with this myself.

    Using Hystrix.reset() by itself didn't work when resetting Circuit Breakers. The following method is working for me.

    private void resetCircuitBreakers() {
        Hystrix.reset();
        HealthCountsStream.reset();
    }