Merge lp:~maxiberta/canonical-identity-provider/improve-throttle-tests into lp:canonical-identity-provider/release
Status: | Merged |
---|---|
Approved by: | Maximiliano Bertacchini |
Approved revision: | no longer in the source branch. |
Merge reported by: | Otto Co-Pilot |
Merged at revision: | not available |
Proposed branch: | lp:~maxiberta/canonical-identity-provider/improve-throttle-tests |
Merge into: | lp:canonical-identity-provider/release |
Diff against target: |
68 lines (+11/-31) 1 file modified
src/api/v20/tests/test_handlers.py (+11/-31) |
To merge this branch: | bzr merge lp:~maxiberta/canonical-identity-provider/improve-throttle-tests |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Daniel Manrique (community) | Approve | ||
Review via email: mp+354892@code.launchpad.net |
Commit message
Some cleanup of API throttling tests.
Description of the change
- De-duplicated code in a number of helper test functions (particularly `throttle_by_*`).
- Dropped single-line helper function (`patch_
- Replaced literal `3600` (mocked request counter in cache) by `settings.
- Replaced literal `42` (mocked request counter in cache) by `settings.
- Increased mocked expiration time from `time.time() + 42.1` to `time.time() + 42.99`, which should lower the chances of time-sensitive tests failing under load (with "AssertionError: '41' != u'42'") by allowing an extra 0.89 sec margin; but kept vila's FIXME note in case tests fail again. In that case we can resort to mocking `time()` as vila suggested, but I'd rather try this simple cleanup first.
nice, I guess 42 was overused as an universal constant.
Thanks!