diff --git a/client_test.go b/client_test.go index d632748..2bd71d8 100644 --- a/client_test.go +++ b/client_test.go @@ -1458,23 +1458,23 @@ func TestClientCircuitBreaker(t *testing.T) { resp, err := c.R().Get(ts.URL + "/500") assertErrorIs(t, ErrCircuitBreakerOpen, err) assertNil(t, resp) - assertEqual(t, c.circuitBreaker.getState(), circuitBreakerStateOpen) + assertEqual(t, circuitBreakerStateOpen, c.circuitBreaker.getState()) time.Sleep(timeout + 1*time.Millisecond) - assertEqual(t, c.circuitBreaker.getState(), circuitBreakerStateHalfOpen) + assertEqual(t, circuitBreakerStateHalfOpen, c.circuitBreaker.getState()) resp, err = c.R().Get(ts.URL + "/500") assertError(t, err) - assertEqual(t, c.circuitBreaker.getState(), circuitBreakerStateOpen) + assertEqual(t, circuitBreakerStateOpen, c.circuitBreaker.getState()) time.Sleep(timeout + 1*time.Millisecond) - assertEqual(t, c.circuitBreaker.getState(), circuitBreakerStateHalfOpen) + assertEqual(t, circuitBreakerStateHalfOpen, c.circuitBreaker.getState()) for i := uint32(0); i < successThreshold; i++ { _, err := c.R().Get(ts.URL + "/200") assertNil(t, err) } - assertEqual(t, c.circuitBreaker.getState(), circuitBreakerStateClosed) + assertEqual(t, circuitBreakerStateClosed, c.circuitBreaker.getState()) resp, err = c.R().Get(ts.URL + "/200") assertNil(t, err) @@ -1482,11 +1482,11 @@ func TestClientCircuitBreaker(t *testing.T) { resp, err = c.R().Get(ts.URL + "/500") assertError(t, err) - assertEqual(t, c.circuitBreaker.failCount.Load(), uint32(1)) + assertEqual(t, uint32(1), c.circuitBreaker.failCount.Load()) time.Sleep(timeout) resp, err = c.R().Get(ts.URL + "/500") assertError(t, err) - assertEqual(t, c.circuitBreaker.failCount.Load(), uint32(1)) + assertEqual(t, uint32(1), c.circuitBreaker.failCount.Load()) }