yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #44843
[Bug 1527593] Re: Some unit tests breaks timeutils.utcnow() usage in next case
** Changed in: nova
Status: In Progress => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1527593
Title:
Some unit tests breaks timeutils.utcnow() usage in next case
Status in OpenStack Compute (nova):
Fix Released
Bug description:
Especially when making new test case that gets executed after case
that has made timeutils.set_time_override(), it can fail if
timeutils.utcnow() works unexpectedly. To have that working in new
case, one has to call timeutils.clear_time_override() before using
timeutils.utcnow(). This is what happens otherwise:
Traceback (most recent call last):
File "nova/tests/unit/compute/test_compute_api.py", line 2995, in test_host_statuses
instances)
File "nova/compute/api.py", line 3386, in get_instances_host_statuses
host_status = self.get_instance_host_status(instance)
File "nova/compute/api.py", line 3374, in get_instance_host_status
instance["services"][0])
File "nova/servicegroup/api.py", line 89, in service_is_up
return self._driver.is_up(member)
File "nova/servicegroup/drivers/db.py", line 79, in is_up
elapsed = timeutils.delta_seconds(last_heartbeat, timeutils.utcnow())
File "/home/tojuvone/nova/.tox/py27/lib/python2.7/site-packages/oslo_utils/timeutils.py", line 297, in delta_seconds
delta = after - before
TypeError: can't subtract offset-naive and offset-aware datetimes
Cases using timeutils.set_time_override() should also make
timeutils.clear_time_override() at the end.
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1527593/+subscriptions
References