Skip to content

Commit 31bc6f0

Browse files
Code review comments.
Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com>
1 parent ba2cebd commit 31bc6f0

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

clients/githubrepo/roundtripper/rate_limit_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
)
2323

2424
func TestRoundTrip(t *testing.T) {
25+
t.Parallel()
2526
var requestCount int
2627
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
2728
// Customize the response headers and body based on the test scenario
@@ -38,7 +39,7 @@ func TestRoundTrip(t *testing.T) {
3839
w.Write([]byte("Success")) // nolint: errcheck
3940
} else {
4041
// First request: Return Retry-After header
41-
w.Header().Set("Retry-After", "5")
42+
w.Header().Set("Retry-After", "1")
4243
w.WriteHeader(http.StatusTooManyRequests)
4344
w.Write([]byte("Rate Limit Exceeded")) // nolint: errcheck
4445
}
@@ -48,7 +49,9 @@ func TestRoundTrip(t *testing.T) {
4849
w.Write([]byte("Success")) // nolint: errcheck
4950
}
5051
}))
51-
defer ts.Close()
52+
t.Cleanup(func() {
53+
defer ts.Close()
54+
})
5255

5356
// Create the rateLimitTransport with the test server as the inner transport and a default logger
5457
transport := &rateLimitTransport{

0 commit comments

Comments
 (0)