-
Notifications
You must be signed in to change notification settings - Fork 16.4k
[AIRFLOW-6055] Option for exponential backoff in Sensors #6654
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6654 +/- ##
=========================================
- Coverage 83.82% 83.5% -0.33%
=========================================
Files 672 672
Lines 37560 37576 +16
=========================================
- Hits 31483 31376 -107
- Misses 6077 6200 +123
Continue to review full report at Codecov.
|
tests/sensors/test_base_sensor.py
Outdated
| interval1 = sensor._get_next_poke_interval(started_at, 1) | ||
| interval2 = sensor._get_next_poke_interval(started_at, 2) | ||
|
|
||
| self.assertTrue(interval2 >= sensor.poke_interval >= interval1) |
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.
Here too.
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.
problem is that this method calculates sha1, which is based upon the started_at, which is relative to the current time.
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.
In which case use mocking to make timezone.utcnow return a known constant value in the tests.
Or if the "jitter" caused by this is small then
self.assertGreaterThanEqual(interval1, 5)
self.assertLessThanEqual(interval1, 5.5)
self.assertGreaterThanEqual(interval2, 6)
self.assertLessThanEqual(interval2, 7)
Those values are not right, but this is the sort of thing I'd like to see.
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.
mocked timezone
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.
You mocked the timezone, but didn't add the extra tests that I asked for. Please could you add them?
Make sure you have checked all steps below.
Jira
Description
Tests
Commits
Documentation