From de2612d70992b95853cd6f4170c96d3c6ba87392 Mon Sep 17 00:00:00 2001 From: Jonathan Rosenberg Date: Thu, 31 Oct 2024 13:31:25 +0200 Subject: [PATCH 1/3] remove retryable client custom error handling --- cmd/lakectl/cmd/retry_client.go | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/cmd/lakectl/cmd/retry_client.go b/cmd/lakectl/cmd/retry_client.go index 8d3850c9010..05da56c9ec3 100644 --- a/cmd/lakectl/cmd/retry_client.go +++ b/cmd/lakectl/cmd/retry_client.go @@ -4,7 +4,6 @@ import ( "context" "crypto/x509" "errors" - "io" "net/http" "net/url" "regexp" @@ -17,10 +16,6 @@ var ( redirectsErrorRe = regexp.MustCompile(`stopped after \d+ redirects\z`) schemeErrorRe = regexp.MustCompile(`unsupported protocol scheme`) notTrustedErrorRe = regexp.MustCompile(`certificate is not trusted`) - - // We need to consume response bodies to maintain http connections, but - // limit the size we consume to respReadLimit. - respReadLimit = int64(4096) //nolint:mnd ) func NewRetryClient(retriesCfg RetriesCfg, transport *http.Transport) *http.Client { @@ -33,7 +28,6 @@ func NewRetryClient(retriesCfg RetriesCfg, transport *http.Transport) *http.Clie retryClient.RetryWaitMin = retriesCfg.MinWaitInterval retryClient.RetryWaitMax = retriesCfg.MaxWaitInterval retryClient.CheckRetry = lakectlRetryPolicy - retryClient.ErrorHandler = customErrorHandler return retryClient.StandardClient() } @@ -77,11 +71,3 @@ func lakectlRetryPolicy(ctx context.Context, resp *http.Response, err error) (bo } return false, nil } - -func customErrorHandler(resp *http.Response, err error, _ int) (*http.Response, error) { - if resp != nil { - defer resp.Body.Close() - io.Copy(io.Discard, io.LimitReader(resp.Body, respReadLimit)) //nolint:errcheck - } - return resp, err -} From 6f09bb5c51f5d12405693976fae656ff2042c795 Mon Sep 17 00:00:00 2001 From: Jonathan Rosenberg Date: Thu, 31 Oct 2024 15:46:50 +0200 Subject: [PATCH 2/3] fix doctor golden file --- esti/golden/lakectl_doctor_wrong_uri_format_endpoint.golden | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esti/golden/lakectl_doctor_wrong_uri_format_endpoint.golden b/esti/golden/lakectl_doctor_wrong_uri_format_endpoint.golden index be68569fc87..6a5ead0a515 100644 --- a/esti/golden/lakectl_doctor_wrong_uri_format_endpoint.golden +++ b/esti/golden/lakectl_doctor_wrong_uri_format_endpoint.golden @@ -1,3 +1,3 @@ It looks like endpoint url is wrong. -Get "/wrong_uri/repositories": unsupported protocol scheme "" +Get "/wrong_uri/repositories": GET /wrong_uri/repositories giving up after 1 attempt(s): unsupported protocol scheme "" Suspicious URI format for server.endpoint_url: wrong_uri From f10f7c2d97ecef472a261e33b9ff5369c62306a1 Mon Sep 17 00:00:00 2001 From: Jonathan Rosenberg Date: Thu, 31 Oct 2024 15:55:43 +0200 Subject: [PATCH 3/3] fix doctor golden file --- .../lakectl_doctor_wrong_uri_format_endpoint_verbose.golden | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esti/golden/lakectl_doctor_wrong_uri_format_endpoint_verbose.golden b/esti/golden/lakectl_doctor_wrong_uri_format_endpoint_verbose.golden index 67d88ba8c21..ad5fa866260 100644 --- a/esti/golden/lakectl_doctor_wrong_uri_format_endpoint_verbose.golden +++ b/esti/golden/lakectl_doctor_wrong_uri_format_endpoint_verbose.golden @@ -3,7 +3,7 @@ Trying to run a sanity command using current configuration. Got error while trying to run a sanity command. Trying to analyze error. It looks like endpoint url is wrong. -Get "/wrong_uri/repositories": unsupported protocol scheme "" +Get "/wrong_uri/repositories": GET /wrong_uri/repositories giving up after 1 attempt(s): unsupported protocol scheme "" Trying to validate access key format. Couldn't find a problem with access key format. Trying to validate secret access key format.