-
-
Notifications
You must be signed in to change notification settings - Fork 612
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
ra/ratelimits: Update tests, use new TransactionBuilder constructor, fix ARI rate limit exception #7869
Conversation
5c9ac63
to
d4f4c9e
Compare
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.
Largely LGTM, loving all the deletions in ra_test.go. Just a question about whether this could be even a bit more elegant.
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.
Changes to the ratelimits package LGTM. I think my only remaining question is around the tests deleted from ra_test.go: can we get confirmation that the behavior each of these tests cares about is covered by a different key-value-limits-based test?
For example, the only references to .IsARIRenewal
that I see in ra_test.go are both in deleted tests. Shouldn't we still be testing that ARI-Renewal orders are exempt from key-value rate limits?
Looking through the deleted test cases, to summarize, they are:
The .IsARIRenewal field Aaron pointed out is in TestNewOrderRateLimitingExempt and TestNewOrderFailedAuthzRateLimitingExempt. |
In the new rate limiting world, the new-order limits are enforced by the WFE, not the RA. I found this test in the WFE that simulates ARI renewal, TestCountNewOrderWithReplaces: https://github.com/letsencrypt/boulder/blob/6ee90ffdda3523b39a2bab5fe5c09d99e884e139/wfe2/wfe_test.go#L4424-L4470 But the asserts seem to only be verifying that the request succeeds and that metric is incremented. They don't test for the rate limit exemption. Probably what's called for is a new unittest in the WFE that checks for the ARI-related rate limit conditions. |
I'll describe the deleted test cases in abbreviated pseudocode to improve my own understanding, then go checking for equivalent test coverage.
|
Thank you! I knew that we'd previously talked about it generally making sense to delete these, but couldn't recreate that reasoning in my head. |
Line 2439 in 81b616b
wfe.NewOrder calls out to check these rate limits:
I believe that confirms these have all moved from the RA to the WFE. Moving on to where each rate limit has been tested in the RA: Some of the testing is around how the limits are ordered, which is no longer relevant: we collect a batch of transactions to check these limits, check them all at once, go through and find which failed, and serve the failure with the Retry-After that's furthest in the future. All this code doesn't really need to be tested again; what needs to be tested is that we're returning the correct failure. That code is This PR now adds a test of the ARI renewal exception, specifically, which did not have existing coverage. We could probably still use more integration tests of the rate limits, overall, but that's beyond the scope of this PR. |
Add a new
ratelimits.NewTransactionBuilderWithLimits
constructor which takes pre-populated rate limit data, instead of filenames for reading it off disk.Use this new constructor to change rate limits during RA tests, instead of using extra
testdata
files.Fix ARI renewals' exception from rate limits: consider
isARIRenewal
as part of theisRenewal
arg tocheckNewOrderLimits
.Remove obsolete RA tests for rate limits that are now only checked in the WFE.
Update remaining new order rate limit tests from deprecated
ratelimit
s to new Redisratelimits
.