Conversation
691467f to
361db80
Compare
|
@gmlewis I'm going to completely rebase this PR as I need to split it into 3. |
|
#4152 replaces the app engine removal part of this PR. |
Signed-off-by: Steve Hipwell <steve.hipwell@gmail.com>
361db80 to
9785804
Compare
|
@gmlewis I've rebased this PR and it should be ready for review now. |
|
@gmlewis I had to update the |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4151 +/- ##
==========================================
- Coverage 93.18% 93.18% -0.01%
==========================================
Files 210 210
Lines 24568 24564 -4
==========================================
- Hits 22894 22889 -5
- Misses 1478 1479 +1
Partials 196 196 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
gmlewis
left a comment
There was a problem hiding this comment.
In case a force-push is performed, I'm going to stop my review here before examining the remaining 182 files.
|
@gmlewis I won't force push this, I only force pushed to realign after we split the PR up and I did provide a warning that I was doing it. Could you possibly review the linter, the only real changes are there and in |
OK, the linter LGTM. |
|
@gmlewis I've made the requested docs changes. |
gmlewis
left a comment
There was a problem hiding this comment.
One question, otherwise LGTM.
cc: @alexandear - @zyfy29 - @Not-Dhananjay-Mishra - @munlicode
|
@gmlewis how do you want me to resolve the conflict? |
|
@stevehipwell - apologies, but could you please resolve conflicts before I merge? |
|
|
@gmlewis merge commit it is, was just checking. |
|
Although if you have a better mechanism, I am fine with that in this huge PR. |
|
@gmlewis assuming that you're squash merging and you'd rather the commits aren't modified, a merge commit is likely to be the best compromise. |
|
@gmlewis it should be ready again. |
|
@alexandear I think we're just waiting on you now? |
|
@gmlewis I think we're ready to merge now. |
| func (s *RateLimitService) Get(ctx context.Context) (*RateLimits, *Response, error) { | ||
| req, err := s.client.NewRequest("GET", "rate_limit", nil) | ||
| // This resource is not subject to rate limits. | ||
| if !s.client.DisableRateLimitCheck { |
There was a problem hiding this comment.
Why is this added? Before this PR we don't have if !s.client.DisableRateLimitCheck
There was a problem hiding this comment.
It short circuits the context modification as it's never going to be retrieved with s.client.DisableRateLimitCheck set to true.
There was a problem hiding this comment.
I propose to move this change to a separate PR and add a test.
There was a problem hiding this comment.
I don't want to remove this change as it's demonstrably "correct". @alexandear if you have a suggestion for how to test this I'm happy to add a test, but it doesn't look testable to me.
There was a problem hiding this comment.
Should be something like the following:
func TestRateLimits_bypassRateLimitCheckContext(t *testing.T) {
t.Parallel()
tests := []struct {
name string
disableRateLimitCheck bool
wantBypassValue any
}{
{
name: "DisableRateLimitCheck disabled",
disableRateLimitCheck: false,
wantBypassValue: true,
},
{
name: "DisableRateLimitCheck enabled",
disableRateLimitCheck: true,
wantBypassValue: nil,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
client.DisableRateLimitCheck = tt.disableRateLimitCheck
mux.HandleFunc("/rate_limit", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
fmt.Fprint(w, `{"resources":{}}`)
})
_, resp, err := client.RateLimit.Get(t.Context())
if err != nil {
t.Errorf("RateLimits returned error: %v", err)
}
if got, want := resp.Request.Context().Value(BypassRateLimitCheck), tt.wantBypassValue; got != want {
t.Errorf("Request context bypass value = %v, want %v", got, want)
}
})
}
}
Closes #4127
This PR makes the following changes:
http.NewRequestWithContextso we no longer need thewithContexthelperclient.BareDoto get benefits such as rate limit support