-
Notifications
You must be signed in to change notification settings - Fork 2.8k
chore(cloudflare): migrate customhostname to v5 #5891
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
chore(cloudflare): migrate customhostname to v5 #5891
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Pull Request Test Coverage Report for Build 19081547235Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
Moved all tests from cloudflare_customhostname_test.go into cloudflare_test.go to ensure proper coverage tracking by coveralls. Tests maintain 92.4% coverage.
Co-authored-by: Michel Loiseleur <97035654+mloiseleur@users.noreply.github.com>
|
@vflaux @mrozentsvayg Any comment on this PR ? Do you think you can review it ? |
provider/cloudflare/cloudflare.go
Outdated
| if strings.Contains(errStr, "exceeded available rate limit retries") || | ||
| strings.Contains(errStr, "rate limit") || | ||
| strings.Contains(errStr, "429") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should handle this according to the doc here: https://github.com/cloudflare/cloudflare-go?tab=readme-ov-file#errors
var apierr *cloudflare.Error
if errors.As(err, &apierr) {
if apierr.StatusCode == http.StatusTooManyRequests {
}
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was implemented
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so why do we have this code here?
- Rate limit errors are not returned as ErrorTypeRateLimit cloudflare/cloudflare-go#4155 talks about the v0 version of the library which we don't use after merging your PR.
- the first string.Contains is not needed if you have the second one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry forgot to commit it. It's gone now
|
@vflaux: changing LGTM is restricted to collaborators In response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Co-authored-by: vflaux <38909103+vflaux@users.noreply.github.com>
Co-authored-by: vflaux <38909103+vflaux@users.noreply.github.com>
…Flare API - Change CustomHostnames method signature to return autoPager[CustomHostnameListResponse] instead of processed []CustomHostname for better API matching and testability - Keep listAllCustomHostnames helper function for callers that need processed results - Update mock implementation to return autoPager with realistic CloudFlare API behavior - All tests continue to pass with improved interface design Addresses PR feedback about method signatures being closer to CloudFlare API for better mocking.
- Handle CloudFlare v5 SDK errors according to official documentation - Use errors.As() to check for cloudflare.Error type - Convert 429 (rate limit) status codes to SoftError for retry logic - Add comprehensive test coverage for v5 error handling - Use wrapper types in tests to avoid CloudFlare SDK internal nil pointer issues Addresses PR comment on line 376 requesting proper v5 error handling.
|
How did broken tests get merged in? |
This should be fixed, see #5896. |
|
/retest |
|
@vflaux everything look good now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've not review all the new tests yet.
Looks like IA generated, some clearly improve test coverage, others seems less relevant. 😄
Co-authored-by: vflaux <38909103+vflaux@users.noreply.github.com>
…rkaround no longer needed, per reviewer feedback)
|
The tests just fail because of rate limits to coveralls |
|
Did you @AndrewCharlesHay address comments by @vflaux ? Cleaning up things that are not useful is always great for maintaining the software. |
- Update convertCloudflareError to detect rate limit keywords in error messages - Check for 'rate limit' and '429' in error strings - Fixes failing rate limit error tests
|
@szuecs yep all updated |
What does it do ?
Migrate customhostname to v5
Motivation
Closes #5540
More