Reset state unit tests failures

Bug #1705249 reported by Gorka Eguileor
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-cinderclient
Fix Released
Undecided
Gorka Eguileor

Bug Description

Depending on the order in which reset status tests are executed we could get failures, which means that we have either tests that mess the system or tests that depend on other tests.

I have narrowed it down quite a bit. If we run "cinderclient.tests.unit.v3.test_shell.ShellTest.test_attachment_create_*" first and then "cinderclient.tests.unit.v3.test_shell.ShellTest.test_reset_state_volume_additional_status_*" we'll get following error:

stdout: {{{'ShellTest' object has no attribute 'reset_state'}}}

Traceback (most recent call last):
  File "/home/geguileo/code/stack/python-cinderclient/.tox/py35/lib/python3.5/site-packages/ddt.py", line 139, in wrapper
    return func(self, *args, **kwargs)
  File "/home/geguileo/code/stack/python-cinderclient/.tox/py35/lib/python3.5/site-packages/mock/mock.py", line 1305, in patched
    return func(*args, **keywargs)
  File "/home/geguileo/code/stack/python-cinderclient/cinderclient/tests/unit/v3/test_shell.py", line 699, in test_reset_state_volume_additional_status
    self.run_command('reset-state %s 1234' % command)
  File "/home/geguileo/code/stack/python-cinderclient/cinderclient/tests/unit/v3/test_shell.py", line 66, in run_command
    self.shell.main(cmd.split())
  File "/home/geguileo/code/stack/python-cinderclient/cinderclient/shell.py", line 785, in main
    args.func(self.cs, args)
  File "/home/geguileo/code/stack/python-cinderclient/cinderclient/v3/shell.py", line 412, in do_reset_state
    raise exceptions.CommandError(msg)
cinderclient.exceptions.CommandError: Unable to reset the state for the specified entity(s).

Tags: tests
Gorka Eguileor (gorka)
Changed in python-cinderclient:
assignee: nobody → Gorka Eguileor (gorka)
Eric Harney (eharney)
tags: added: tests
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-cinderclient (master)

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

Changed in python-cinderclient:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-cinderclient (master)

Reviewed: https://review.openstack.org/485197
Committed: https://git.openstack.org/cgit/openstack/python-cinderclient/commit/?id=83230498eb75ce080de4fe6806b8079b0b87b144
Submitter: Jenkins
Branch: master

commit 83230498eb75ce080de4fe6806b8079b0b87b144
Author: Gorka Eguileor <email address hidden>
Date: Wed Jul 19 14:25:44 2017 +0200

    Fix reset state v3 unit tests failures

    Depending on the order of execution our unit tests could fail because we
    are caching the reset methods in the RESET_STATE_RESOURCES dictionary in
    cinderclient.v3.shell and mocking the methods before importing this file
    will leave future tests with the mocked value.

    This patch fixes this by mocking find_resource instead of individual
    find methods, and in one of the tests with a method that will call
    original method whenever it's not the call we actually wanted to mock.

    Change-Id: Ic3ab32b95abd29e995bc071adc11b1e481b32516
    Closes-Bug: #1705249

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

This issue was fixed in the openstack/python-cinderclient 3.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.