mocking of oslo.utils.timeutils.utcnow() is not working

Bug #1408704 reported by Pavlo Shchelokovskyy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Critical
Thomas Herve
Juno
Fix Released
High
Matt Riedemann

Bug Description

since recently our Py27 unittests failing for 12 tests in heat/tests/test_autoscaling.py, all with the same symptom

2015-01-08 15:43:49.167 | Traceback (most recent call last):
2015-01-08 15:43:49.167 | File "heat/engine/resource.py", line 465, in _action_recorder
2015-01-08 15:43:49.167 | yield
2015-01-08 15:43:49.167 | File "heat/engine/resource.py", line 535, in _do_action
2015-01-08 15:43:49.167 | yield self.action_handler_task(action, args=handler_args)
2015-01-08 15:43:49.167 | File "heat/engine/scheduler.py", line 312, in wrapper
2015-01-08 15:43:49.167 | step = next(subtask)
2015-01-08 15:43:49.168 | File "heat/engine/resource.py", line 509, in action_handler_task
2015-01-08 15:43:49.168 | while not check(handler_data):
2015-01-08 15:43:49.168 | File "heat/engine/resources/aws/autoscaling_group.py", line 218, in check_create_complete
2015-01-08 15:43:49.168 | "%s : %s" % (EXACT_CAPACITY, grouputils.get_size(self)))
2015-01-08 15:43:49.168 | File "heat/scaling/cooldown.py", line 44, in _cooldown_timestamp
2015-01-08 15:43:49.168 | self.metadata_set(metadata)
2015-01-08 15:43:49.168 | File "/home/jenkins/workspace/gate-heat-python27/.tox/py27/local/lib/python2.7/site-packages/mox.py", line 765, in __call__
2015-01-08 15:43:49.168 | return mock_method(*params, **named_params)
2015-01-08 15:43:49.168 | File "/home/jenkins/workspace/gate-heat-python27/.tox/py27/local/lib/python2.7/site-packages/mox.py", line 1002, in __call__
2015-01-08 15:43:49.168 | expected_method = self._VerifyMethodCall()
2015-01-08 15:43:49.168 | File "/home/jenkins/workspace/gate-heat-python27/.tox/py27/local/lib/python2.7/site-packages/mox.py", line 1060, in _VerifyMethodCall
2015-01-08 15:43:49.169 | raise UnexpectedMethodCallError(self, expected)
2015-01-08 15:43:49.169 | UnexpectedMethodCallError: Unexpected method call. unexpected:- expected:+
2015-01-08 15:43:49.169 | - metadata_set.__call__({'2015-01-08T15:43:49.121349': 'ExactCapacity : 2'}) -> None
2015-01-08 15:43:49.169 | ? ^ ----
2015-01-08 15:43:49.169 |
2015-01-08 15:43:49.169 | + metadata_set.__call__({'2015-01-08T15:43:48.979197': 'ExactCapacity : 2'}) -> None
2015-01-08 15:43:49.169 | ? ++ ^^ +
2015-01-08 15:43:49.169 | }}}

seems like latest oslo.utils == 1.2.0 is not compatible with our mocking of timeutils.utcnow()

Changed in heat:
importance: Undecided → Critical
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

Fix proposed to branch: master
Review: https://review.openstack.org/145841

Changed in heat:
assignee: nobody → Thomas Herve (therve)
status: New → In Progress
Steven Hardy (shardy)
Changed in heat:
milestone: none → kilo-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/145841
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=15c18a7e33e0339074360da3b70d58d914e0766a
Submitter: Jenkins
Branch: master

commit 15c18a7e33e0339074360da3b70d58d914e0766a
Author: Thomas Herve <email address hidden>
Date: Thu Jan 8 18:08:38 2015 +0100

    Remove mocking of timeutils.utcnow

    With the move out of the namespace package of oslo.utils, it seems that
    mocking utcnow doesn't work as expected. Fortunately there is a
    set_time_override function that can be used to replace time during
    tests.

    Change-Id: Iac43aac547b602bf1689cd5000307abaacd65fca
    Closes-Bug: #1408704

Changed in heat:
status: In Progress → Fix Committed
Revision history for this message
Matt Riedemann (mriedem) wrote :

This is killing the unit tests on stable/juno so we need the fix there as well.

tags: added: juno-backport-potential
Revision history for this message
Matt Riedemann (mriedem) wrote :
Revision history for this message
Steven Hardy (shardy) wrote :

mriedem indicated he's going to propose the backport, so assigning the juno backport to him

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (stable/juno)

Fix proposed to branch: stable/juno
Review: https://review.openstack.org/146570

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (stable/juno)

Reviewed: https://review.openstack.org/146570
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=c5346cd70e79d6eb03dae8dadd08e477ba1f3e9c
Submitter: Jenkins
Branch: stable/juno

commit c5346cd70e79d6eb03dae8dadd08e477ba1f3e9c
Author: Thomas Herve <email address hidden>
Date: Thu Jan 8 18:08:38 2015 +0100

    Remove mocking of timeutils.utcnow

    With the move out of the namespace package of oslo.utils, it seems that
    mocking utcnow doesn't work as expected. Fortunately there is a
    set_time_override function that can be used to replace time during
    tests.

    Conflicts:
            heat/tests/test_watch.py

    NOTE(mriedem): This also fixes another instance in test_autoscaling
    which is only on stable/juno (not master).

    Change-Id: Iac43aac547b602bf1689cd5000307abaacd65fca
    Closes-Bug: #1408704
    (cherry picked from commit 15c18a7e33e0339074360da3b70d58d914e0766a)

Thierry Carrez (ttx)
Changed in heat:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in heat:
milestone: kilo-2 → 2015.1.0
Zane Bitter (zaneb)
tags: added: in-stable-juno
removed: juno-backport-potential
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.