test_create_with_live_time can fail if run at "just the wrong time"
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Glance |
New
|
Undecided
|
Dharini Chandrasekar |
Bug Description
In https:/
| Captured traceback:
| ~~~~~~~~~~~~~~~~~~~
| Traceback (most recent call last):
| File "/home/
| return func(*args, **keywargs)
| File "glance/
| self.assertEqua
| File "/home/
| self.assertThat
| File "/home/
| raise mismatch_error
| testtools.
This can happen if the exires_at and updated_at are not 2 days apart (ignoring seconds and microsecond) (from [2])
# ignore second and microsecond to avoid flaky runs
The following interactive example shows what I mean:
balder:glance tony8129$ python
Python 2.7.12 (default, Jun 29 2016, 12:46:54)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> class FakeTask(object):
... pass
>>> success_task = FakeTask()
>>> success_
>>> success_
>>> task_live_time = (success_
>>> microsecond=0) -
... success_
... microsecond=0))
... task_live_time
>>> datetime.
>>> success_
>>> task_live_time = (success_
>>> microsecond=0) -
... success_
... microsecond=0))
... task_live_time
>>> datetime.
task_live_time_hour = (task_live_
>>> task_live_
>>> task_live_time_hour
>>> 47
I couldn't find the specific code but I assume something like:
db.expires_at = now() + CONF.task.
db_updated_at = now() # 1+mm:00
Happens causing this false positive.
[1] http://
[2] https:/
Changed in glance: | |
assignee: | nobody → Dharini Chandrasekar (dharini-chandrasekar) |
So, this was a problem in the past as well. It was "fixed" to make it less flakey but it's still flakey. It is presently still a problem and I'm wondering if there's a better way of making this less flakey than we currently have (besides just deleting the test).