diff options
| author | Dean Troyer <dtroyer@gmail.com> | 2017-04-28 14:25:00 -0500 |
|---|---|---|
| committer | Dean Troyer <dtroyer@gmail.com> | 2017-04-28 16:06:00 -0500 |
| commit | 2c5405ed5e69eb5b000d47d92e1019b8bb9b54f9 (patch) | |
| tree | 5cbb527098cf1c74539874b6e65cdf5fe3426384 /openstackclient/tests/unit/volume/v2 | |
| parent | dd7da49325e3b4bc430b8a3d46ae19e43491c3b5 (diff) | |
| download | python-openstackclient-2c5405ed5e69eb5b000d47d92e1019b8bb9b54f9.tar.gz | |
Fix volume qos spec list
This has been sporadically failing in functional tests due to the way
the volume qos spec list command calls get_associations() for each spec.
When tests run in parallel occasionally a spec from another test is present
in the list returned and is deleted before the get_associations() call is
made, causing a NotFound exception. We should just keep going when this
occurs.
* make v1 match v2
* add tests to ensure the exception is being caught and handled
Closes-Bug: #1687083
Change-Id: If2d17c1deb53d293fc2c7f0c527a4e4ef6f69976
Diffstat (limited to 'openstackclient/tests/unit/volume/v2')
| -rw-r--r-- | openstackclient/tests/unit/volume/v2/test_qos_specs.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/openstackclient/tests/unit/volume/v2/test_qos_specs.py b/openstackclient/tests/unit/volume/v2/test_qos_specs.py index 35d9a345..8f145a7e 100644 --- a/openstackclient/tests/unit/volume/v2/test_qos_specs.py +++ b/openstackclient/tests/unit/volume/v2/test_qos_specs.py @@ -13,6 +13,7 @@ # under the License. # +import copy import mock from mock import call @@ -342,6 +343,33 @@ class TestQosList(TestQos): self.assertEqual(self.columns, columns) self.assertEqual(self.data, list(data)) + def test_qos_list_no_association(self): + self.qos_mock.reset_mock() + self.qos_mock.get_associations.side_effect = [ + [self.qos_association], + exceptions.NotFound("NotFound"), + ] + + arglist = [] + verifylist = [] + + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + + columns, data = self.cmd.take_action(parsed_args) + self.qos_mock.list.assert_called_with() + + self.assertEqual(self.columns, columns) + + ex_data = copy.deepcopy(self.data) + ex_data[1] = ( + self.qos_specs[1].id, + self.qos_specs[1].name, + self.qos_specs[1].consumer, + None, + utils.format_dict(self.qos_specs[1].specs), + ) + self.assertEqual(ex_data, list(data)) + class TestQosSet(TestQos): |
