call_until_true raises error in water plugin

Bug #1744210 reported by zhufl
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tempest
Fix Released
Undecided
zhufl

Bug Description

1. Problem

watcher_tempest_plugin.tests.scenario.test_execute_actuator.TestExecuteActionsViaActuator.test_execute_resize
-------------------------------------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):
      File "/opt/stack/new/tempest/.tox/tempest/local/lib/python2.7/site-packages/watcher_tempest_plugin/tests/scenario/test_execute_actuator.py", line 315, in test_execute_resize
        self._execute_actions(actions)
      File "/opt/stack/new/tempest/.tox/tempest/local/lib/python2.7/site-packages/watcher_tempest_plugin/tests/scenario/test_execute_actuator.py", line 236, in _execute_actions
        sleep_for=.5
      File "tempest/lib/common/utils/test_utils.py", line 108, in call_until_true
        getattr(func, '__name__'), time.time() - begin_time)
    AttributeError: 'functools.partial' object has no attribute '__name__'

2. Analysis
if func is wrapped with functools.partial, then func.__class__.__name__ should be used.

3. Solution
Though the usuage of functools.partial can be removed because now call_until_true supports args and kwargs that are passed to func, but it's better for call_until_true to get func.__class__.__name__ if func has no attribute '__name__'.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tempest (master)

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

Changed in tempest:
assignee: nobody → zhufl (zhu-fanglei)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tempest (master)

Reviewed: https://review.openstack.org/535610
Committed: https://git.openstack.org/cgit/openstack/tempest/commit/?id=effafa32304ef06fc5a0f4b3762e8a5a10e81cfc
Submitter: Zuul
Branch: master

commit effafa32304ef06fc5a0f4b3762e8a5a10e81cfc
Author: zhufl <email address hidden>
Date: Fri Jan 19 13:37:05 2018 +0800

    Get func.__class__.__name__ if no attribute __name__

    In call_until_true, if func is wrapped with functools.partial,
    getattr(func, '__name__') will get "AttributeError:
    'functools.partial' object has no attribute '__name__'"

    Now call_until_true supports args and kwargs that are passed
    to func, so functools.partial is no longer needed, but it's
    better for call_until_true to get func.__class__.__name__
    if func has not attritube __name__.

    Change-Id: Icc734e44af925655a31e7dcac04620352093cbeb
    Closes-Bug: #1744210

Changed in tempest:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tempest 18.0.0

This issue was fixed in the openstack/tempest 18.0.0 release.

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.