From 31bc6f07bea865039e470be6d4a8f0e2e9885ac8 Mon Sep 17 00:00:00 2001 From: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com> Date: Mon, 10 Jul 2023 15:23:05 -0500 Subject: [PATCH] Code review comments. Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com> --- clients/githubrepo/roundtripper/rate_limit_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/clients/githubrepo/roundtripper/rate_limit_test.go b/clients/githubrepo/roundtripper/rate_limit_test.go index d0e17c976cb..b74b7d997b8 100644 --- a/clients/githubrepo/roundtripper/rate_limit_test.go +++ b/clients/githubrepo/roundtripper/rate_limit_test.go @@ -22,6 +22,7 @@ import ( ) func TestRoundTrip(t *testing.T) { + t.Parallel() var requestCount int ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { // Customize the response headers and body based on the test scenario @@ -38,7 +39,7 @@ func TestRoundTrip(t *testing.T) { w.Write([]byte("Success")) // nolint: errcheck } else { // First request: Return Retry-After header - w.Header().Set("Retry-After", "5") + w.Header().Set("Retry-After", "1") w.WriteHeader(http.StatusTooManyRequests) w.Write([]byte("Rate Limit Exceeded")) // nolint: errcheck } @@ -48,7 +49,9 @@ func TestRoundTrip(t *testing.T) { w.Write([]byte("Success")) // nolint: errcheck } })) - defer ts.Close() + t.Cleanup(func() { + defer ts.Close() + }) // Create the rateLimitTransport with the test server as the inner transport and a default logger transport := &rateLimitTransport{