Skip to content

Commit

Permalink
test: adjust time duration on circuit breaker test and readme update
Browse files Browse the repository at this point in the history
  • Loading branch information
jeevatkm committed Jan 8, 2025
1 parent ea07167 commit 0adebca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<p align="center" style="margin-top:3rem"><a href="https://github.com/go-resty/resty/actions/workflows/ci.yml?query=branch%3Av3" target="_blank"><img src="https://github.com/go-resty/resty/actions/workflows/ci.yml/badge.svg?branch=v3" alt="Resty Build Status">
</a><a href="https://app.codecov.io/gh/go-resty/resty/tree/v3" target="_blank"><img src="https://codecov.io/gh/go-resty/resty/branch/v3/graph/badge.svg" alt="Resty Code Coverage">
</a><a href="https://goreportcard.com/report/resty.dev/v3" target="_blank"><img src="https://goreportcard.com/badge/resty.dev/v3" alt="Go Report Card">
</a><a href="https://github.com/go-resty/resty/releases/latest" target="_blank"><img src="https://img.shields.io/badge/version-v3.0.0--alpha.5-blue.svg" alt="Resty Release Version">
</a><a href="https://pkg.go.dev/resty.dev/v3" target="_blank"><img src="https://pkg.go.dev/badge/resty.dev/v3" alt="Resty GoDoc">
</a><a href="LICENSE"><img src="https://img.shields.io/github/license/go-resty/resty.svg" alt="License"></a> <a href="https://github.com/avelino/awesome-go" target="_blank"><img src="https://awesome.re/mentioned-badge.svg" alt="Mentioned in Awesome Go"></a></p>
<p align="center" style="margin-bottom:1rem"><a href="https://app.fossa.com/projects/git%2Bgithub.com%2Fgo-resty%2Fresty?ref=badge_shield&amp;issueType=license" alt="FOSSA Status"><img src="https://app.fossa.com/api/projects/git%2Bgithub.com%2Fgo-resty%2Fresty.svg?type=shield&amp;issueType=license"></a>
Expand Down
6 changes: 3 additions & 3 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1465,7 +1465,7 @@ func TestClientCircuitBreaker(t *testing.T) {

failThreshold := uint32(2)
successThreshold := uint32(1)
timeout := 500 * time.Millisecond
timeout := 100 * time.Millisecond

cb := NewCircuitBreaker().
SetTimeout(timeout).
Expand All @@ -1484,14 +1484,14 @@ func TestClientCircuitBreaker(t *testing.T) {
assertNil(t, resp)
assertEqual(t, circuitBreakerStateOpen, c.circuitBreaker.getState())

time.Sleep(timeout + 1*time.Millisecond)
time.Sleep(timeout + 50*time.Millisecond)
assertEqual(t, circuitBreakerStateHalfOpen, c.circuitBreaker.getState())

_, err = c.R().Get(ts.URL + "/500")
assertError(t, err)
assertEqual(t, circuitBreakerStateOpen, c.circuitBreaker.getState())

time.Sleep(timeout + 1*time.Millisecond)
time.Sleep(timeout + 50*time.Millisecond)
assertEqual(t, circuitBreakerStateHalfOpen, c.circuitBreaker.getState())

for i := uint32(0); i < successThreshold; i++ {
Expand Down

0 comments on commit 0adebca

Please sign in to comment.