Repository navigation
r202639: typed rate-limit error on registration - #208
Merged
Merged
Conversation
register_v2 raises SpanPanelRateLimitError, a SpanPanelAPIError, when the panel answers HTTP 429, and does not retry. retry_after_s carries the wait the panel asked for in seconds, from Retry-After: delta-seconds as given, an HTTP-date as the seconds until that time, and None when the header is absent, negative, infinite or neither form. The body and the passphrase stay out of the message, as for every other refusal. The CA download's 429 retry reads Retry-After through the same parser, so it now honours an HTTP-date and no longer waits on an infinite value. The passphrase rotation docstring names 504 beside 500 as an unknown outcome. SpanPanelRateLimitError is exported. Part of the spanos3/r202639/03 batch 2 work.
Two acceptance tests read the delay as retry_after and expect None for an HTTP-date Retry-After. This library names it retry_after_s, in seconds, and reads an HTTP-date as the seconds until that time, so both are known divergences. The rows are inert until the tests land. A row may now name a method of a Test class. Part of the spanos3/r202639/03 batch 2 work.
Don's acceptance tests, ported unchanged from his work: test_register_rate_limit.py. Tests this line does not pass yet are listed in tests/expected_failures.py. Part of the spanos3/r202639/03 batch 2 work.
Companions to the registration acceptance tests, in their own file so those stay unchanged: Retry-After as delta-seconds and as an HTTP-date, future or passed, read as seconds; negative, infinite, NaN and unparseable values read as None; a rejected credential is still an auth error and another 4xx is not a rate limit; and the CA download backoff takes an HTTP-date and never waits forever. They pin what the two divergent acceptance tests check after their divergent line. Part of the spanos3/r202639/03 batch 2 work.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
r202639: a typed error for rate-limited registration. Ports Don's (@dcj) acceptance tests for registration rate limits onto this line unchanged:
tests/test_register_rate_limit.py. Thanks, Don.register_v2raises the newSpanPanelRateLimitError(aSpanPanelAPIError, not an auth error) on HTTP 429 and does not retry.retry_after_sis the wait the panel asked for, in seconds:Retry-Afterdelta-seconds as given, an HTTP-date as the seconds until then;Nonewhen absent, negative, infinite or neither form. The body and the passphrase stay out of the message.Retry-Afterthrough the same parser, so it now takes an HTTP-date and no longer waits on an infinite value.tests/expected_failures.pylists two of Don's tests as divergent: they read the delay asretry_afterand expectNonefor an HTTP-date. A strict xfail stops at its first failing line, sotests/test_register_rate_limit_companions.pypins the delay in seconds and the statuses around 429. Don's file is never edited. The registry now also finds methods of test classes.Registry rows
test_raises_the_rate_limit_class_with_its_statusretry_after_s, in secondstest_retry_after_is_none_without_a_usable_header(all cases)Retry-Afterreads as the seconds until thenChecks
pytest tests -q: 1520 passed, 7 skipped, 27 xfailed (before: 1504 passed, 7 skipped, 21 xfailed); each commit passes on its ownpre-commit run --all-files: all hooks pass, mypy includedprerelease/3.8locally (no conflicts, not committed): 1639 passed, 7 skipped, 20 xfailed