Skip to content

Commit 06301fa

Browse files
authored
test: adjust time duration on circuit breaker test and readme update (#945)
1 parent ea07167 commit 06301fa

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<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">
77
</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">
88
</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">
9-
</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">
109
</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">
1110
</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>
1211
<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>

client_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,7 +1465,7 @@ func TestClientCircuitBreaker(t *testing.T) {
14651465

14661466
failThreshold := uint32(2)
14671467
successThreshold := uint32(1)
1468-
timeout := 500 * time.Millisecond
1468+
timeout := 100 * time.Millisecond
14691469

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

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

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

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

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

0 commit comments

Comments
 (0)