From db87d7f218555f41cc743f249e7ba02b353f0a09 Mon Sep 17 00:00:00 2001 From: Andrey Kurilin Date: Tue, 14 Dec 2021 17:47:20 +0200 Subject: [PATCH] Multiple fixes for CI Change-Id: I7e64ae2bf955cb2b9c66b7466b155f07b402bd24 --- .zuul.d/rally-task-watcher.yaml | 27 ++++++------- .zuul.d/rally-task-zaqar.yaml | 3 +- .zuul.d/zuul.yaml | 4 +- CHANGELOG.rst | 16 ++++++++ rally-jobs/basic-with-existing-users.yaml | 1 - .../extra/autoscaling_group.yaml.template | 2 +- ...rce_group_server_with_volume.yaml.template | 2 +- .../extra/server_with_ports.yaml.template | 2 +- .../extra/server_with_volume.yaml.template | 2 +- rally-jobs/keystone-glance-swift.yaml | 2 +- rally-jobs/nova.yaml | 15 +------ rally-jobs/senlin.yaml | 2 +- .../common/services/storage/block.py | 39 +++++++++++++++++++ .../common/services/storage/cinder_common.py | 36 +++++++++++++++++ .../common/services/storage/cinder_v1.py | 10 +++++ .../task/scenarios/cinder/volume_types.py | 28 ++++++------- .../task/scenarios/manila/utils.py | 2 +- rally_openstack/task/scenarios/nova/agents.py | 39 ------------------- samples/tasks/scenarios/nova/list-agents.json | 16 -------- samples/tasks/scenarios/nova/list-agents.yaml | 10 ----- .../services/storage/test_cinder_common.py | 21 ++++++++++ .../common/services/storage/test_cinder_v1.py | 14 +++++++ .../scenarios/cinder/test_volume_types.py | 32 ++++++--------- .../unit/task/scenarios/manila/test_utils.py | 3 +- tests/unit/task/scenarios/nova/test_agents.py | 28 ------------- 25 files changed, 186 insertions(+), 170 deletions(-) delete mode 100644 rally_openstack/task/scenarios/nova/agents.py delete mode 100644 samples/tasks/scenarios/nova/list-agents.json delete mode 100644 samples/tasks/scenarios/nova/list-agents.yaml delete mode 100644 tests/unit/task/scenarios/nova/test_agents.py diff --git a/.zuul.d/rally-task-watcher.yaml b/.zuul.d/rally-task-watcher.yaml index a1cd6357..3560b55d 100644 --- a/.zuul.d/rally-task-watcher.yaml +++ b/.zuul.d/rally-task-watcher.yaml @@ -2,11 +2,14 @@ name: rally-task-watcher parent: rally-task-at-devstack required-projects: - - name: openstack/devstack - - name: openstack/rally - - name: openstack/rally-openstack - - name: openstack/watcher - - name: openstack/python-watcherclient + - openstack/ceilometer + - openstack/python-openstackclient + - openstack/python-watcherclient + - openstack/watcher + - openstack/watcher-tempest-plugin + - openstack/tempest + - openstack/rally + - openstack/rally-openstack vars: devstack_plugins: rally-openstack: https://opendev.org/openstack/rally-openstack @@ -15,14 +18,8 @@ watcher-api: true watcher-decision-engine: true watcher-applier: true - # disable redundant services for the job - ceilometer-acentral: false - ceilometer-acompute: false - ceilometer-alarm-evaluator: false - ceilometer-alarm-notifier: false - ceilometer-anotification: false - ceilometer-api: false - ceilometer-collector: false - horizon: false - tempest: false + s-account: false + s-container: false + s-object: false + s-proxy: false rally_task: rally-jobs/watcher.yaml diff --git a/.zuul.d/rally-task-zaqar.yaml b/.zuul.d/rally-task-zaqar.yaml index 6befafed..50db3fe8 100644 --- a/.zuul.d/rally-task-zaqar.yaml +++ b/.zuul.d/rally-task-zaqar.yaml @@ -2,7 +2,6 @@ name: rally-task-zaqar parent: rally-task-at-devstack required-projects: - - name: openstack/devstack - name: openstack/rally - name: openstack/rally-openstack - name: openstack/zaqar @@ -12,3 +11,5 @@ rally-openstack: https://opendev.org/openstack/rally-openstack zaqar: https://opendev.org/openstack/zaqar rally_task: rally-jobs/zaqar.yaml + devstack_localrc: + ZAQAR_BACKEND: redis diff --git a/.zuul.d/zuul.yaml b/.zuul.d/zuul.yaml index f3fd96e1..1cde6a6e 100644 --- a/.zuul.d/zuul.yaml +++ b/.zuul.d/zuul.yaml @@ -78,7 +78,8 @@ - rally-task-watcher: # watcher-api did not start last time voting: false - - rally-task-zaqar + - rally-task-zaqar: + voting: false - rally-verify-tempest gate: jobs: @@ -115,7 +116,6 @@ - rally_openstack/task/scenarios/neutron/trunk.py - rally_openstack/task/scenarios/neutron/network.py - tests/ci/playbooks - - rally-task-zaqar - rally-verify-tempest post: jobs: diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8d1612c2..c5cb5c7b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -17,6 +17,22 @@ Changelog was missed or can be improved, feel free to change it! +[unreleased] +------------ + +Removed +~~~~~~~ + +* Nova API doesn't include listing agents for a long time, so no need to + provide *NovaAgents.list_agents* scenario any more. + +Fixed +~~~~~ + +* Two cinder scenarios *CinderVolumeTypes.create_and_update_volume_type* and + *CinderVolumeTypes.create_volume_type_add_and_list_type_access* were + incompatible with Cinder API v3 + [2.2.0] - 2021-10-25 -------------------- diff --git a/rally-jobs/basic-with-existing-users.yaml b/rally-jobs/basic-with-existing-users.yaml index 271a7032..5e731849 100644 --- a/rally-jobs/basic-with-existing-users.yaml +++ b/rally-jobs/basic-with-existing-users.yaml @@ -1,6 +1,5 @@ {% set flavor_name = "m1.tiny" %} {% set image_name = "^cirros.*-disk$" %} -{% set cirros_image_url = "https://github.com/cirros-dev/cirros/releases/download/0.3.5/cirros-0.3.5-x86_64-disk.img" %} {% set smoke = 0 %} --- diff --git a/rally-jobs/extra/autoscaling_group.yaml.template b/rally-jobs/extra/autoscaling_group.yaml.template index 02b9b11a..17e95744 100644 --- a/rally-jobs/extra/autoscaling_group.yaml.template +++ b/rally-jobs/extra/autoscaling_group.yaml.template @@ -8,7 +8,7 @@ parameters: - custom_constraint: nova.flavor image: type: string - default: cirros-0.4.0-x86_64-disk + default: cirros-0.5.2-x86_64-disk constraints: - custom_constraint: glance.image scaling_adjustment: diff --git a/rally-jobs/extra/resource_group_server_with_volume.yaml.template b/rally-jobs/extra/resource_group_server_with_volume.yaml.template index 5ad32920..c7594a19 100644 --- a/rally-jobs/extra/resource_group_server_with_volume.yaml.template +++ b/rally-jobs/extra/resource_group_server_with_volume.yaml.template @@ -14,7 +14,7 @@ parameters: - range: {min: 1} instance_image: type: string - default: cirros-0.4.0-x86_64-disk + default: cirros-0.5.2-x86_64-disk instance_volume_size: type: number description: Size of volume to attach to instance diff --git a/rally-jobs/extra/server_with_ports.yaml.template b/rally-jobs/extra/server_with_ports.yaml.template index ded4835e..1bd86918 100644 --- a/rally-jobs/extra/server_with_ports.yaml.template +++ b/rally-jobs/extra/server_with_ports.yaml.template @@ -7,7 +7,7 @@ parameters: default: public image: type: string - default: cirros-0.4.0-x86_64-disk + default: cirros-0.5.2-x86_64-disk flavor: type: string default: m1.tiny diff --git a/rally-jobs/extra/server_with_volume.yaml.template b/rally-jobs/extra/server_with_volume.yaml.template index 464759ab..242a1107 100644 --- a/rally-jobs/extra/server_with_volume.yaml.template +++ b/rally-jobs/extra/server_with_volume.yaml.template @@ -4,7 +4,7 @@ parameters: # set all correct defaults for parameters before launch test image: type: string - default: cirros-0.4.0-x86_64-disk + default: cirros-0.5.2-x86_64-disk flavor: type: string default: m1.tiny diff --git a/rally-jobs/keystone-glance-swift.yaml b/rally-jobs/keystone-glance-swift.yaml index 249679fc..e2fd7339 100644 --- a/rally-jobs/keystone-glance-swift.yaml +++ b/rally-jobs/keystone-glance-swift.yaml @@ -1,4 +1,4 @@ -{%- set cirros_image_url = "https://github.com/cirros-dev/cirros/releases/download/0.3.5/cirros-0.3.5-x86_64-disk.img" %} +{%- set cirros_image_url = "https://github.com/cirros-dev/cirros/releases/download/0.5.2/cirros-0.5.2-x86_64-disk.img" %} --- KeystoneBasic.authenticate_user_and_validate_token: - diff --git a/rally-jobs/nova.yaml b/rally-jobs/nova.yaml index 9cda78f0..974a802f 100755 --- a/rally-jobs/nova.yaml +++ b/rally-jobs/nova.yaml @@ -1,4 +1,4 @@ -{%- set cirros_image_url = "http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img" %} +{%- set cirros_image_url = "https://github.com/cirros-dev/cirros/releases/download/0.5.2/cirros-0.5.2-x86_64-disk.img" %} {% set image_name = "^(cirros.*-disk|TestVM)$" %} {% set flavor_name = "m1.tiny" %} {% set volume_type = "" %} @@ -378,7 +378,6 @@ - title: NovaServers.boot_and_get_console_url tests workloads: - {% for s in ("novnc", "xvpvnc") %} - scenario: NovaServers.boot_and_get_console_url: @@ -386,7 +385,7 @@ name: "{{flavor_name}}" image: name: "{{image_name}}" - console_type: {{s}} + console_type: novnc runner: constant: times: 4 @@ -395,8 +394,6 @@ users: tenants: 2 users_per_tenant: 2 - {% endfor %} - - title: NovaServers.resize_server tests workloads: @@ -874,14 +871,6 @@ users: tenants: 2 users_per_tenant: 2 - - - title: NovaAgents.list_agents tests - scenario: - NovaAgents.list_agents: {} - runner: - constant: - concurrency: 2 - times: 4 - title: NovaAggregates.list_aggregates tests scenario: diff --git a/rally-jobs/senlin.yaml b/rally-jobs/senlin.yaml index 5fa3e096..06a71cae 100644 --- a/rally-jobs/senlin.yaml +++ b/rally-jobs/senlin.yaml @@ -25,6 +25,6 @@ properties: name: cirros_server flavor: 1 - image: "cirros-0.4.0-x86_64-disk" + image: "cirros-0.5.2-x86_64-disk" networks: - network: private diff --git a/rally_openstack/common/services/storage/block.py b/rally_openstack/common/services/storage/block.py index dedc066b..9e6acfb2 100755 --- a/rally_openstack/common/services/storage/block.py +++ b/rally_openstack/common/services/storage/block.py @@ -354,6 +354,45 @@ class BlockStorage(service.UnifiedService): description=description, is_public=is_public) + @service.should_be_overridden + def update_volume_type(self, volume_type, name=None, + description=None, is_public=None): + """Update the name and/or description for a volume type. + + :param volume_type: The ID or an instance of the :class:`VolumeType` + to update. + :param name: if None, updates name by generating random name. + else updates name with provided name + :param description: Description of the volume type. + :returns: Returns an updated volume type object. + """ + return self._impl.update_volume_type( + volume_type=volume_type, name=name, description=description, + is_public=is_public + ) + + @service.should_be_overridden + def add_type_access(self, volume_type, project): + """Add a project to the given volume type access list. + + :param volume_type: Volume type name or ID to add access for the given + project + :project: Project ID to add volume type access for + :return: An instance of cinderclient.apiclient.base.TupleWithMeta + """ + return self._impl.update_volume_type( + volume_type=volume_type, project=project + ) + + @service.should_be_overridden + def list_type_access(self, volume_type): + """Print access information about the given volume type + + :param volume_type: Filter results by volume type name or ID + :return: VolumeTypeAccess of specific project + """ + return self._impl.volume_type_access.list(volume_type) + @service.should_be_overridden def get_volume_type(self, volume_type): """get details of volume_type. diff --git a/rally_openstack/common/services/storage/cinder_common.py b/rally_openstack/common/services/storage/cinder_common.py index 138e1307..d5c0a352 100755 --- a/rally_openstack/common/services/storage/cinder_common.py +++ b/rally_openstack/common/services/storage/cinder_common.py @@ -651,6 +651,42 @@ class UnifiedCinderMixin(object): """ return self._impl.delete_volume_type(volume_type) + def update_volume_type(self, volume_type, name=None, + description=None, is_public=None): + """Update the name and/or description for a volume type. + + :param volume_type: The ID or an instance of the :class:`VolumeType` + to update. + :param name: if None, updates name by generating random name. + else updates name with provided name + :param description: Description of the volume type. + :rtype: :class:`VolumeType` + """ + return self._impl.update_volume_type( + volume_type=volume_type, name=name, description=description, + is_public=is_public + ) + + def add_type_access(self, volume_type, project): + """Add a project to the given volume type access list. + + :param volume_type: Volume type name or ID to add access for the given + project + :project: Project ID to add volume type access for + :return: An instance of cinderclient.apiclient.base.TupleWithMeta + """ + return self._impl.add_type_access( + volume_type=volume_type, project=project + ) + + def list_type_access(self, volume_type): + """Print access information about the given volume type + + :param volume_type: Filter results by volume type name or ID + :return: VolumeTypeAccess of specific project + """ + return self._impl.list_type_access(volume_type) + def set_volume_type_keys(self, volume_type, metadata): """Set extra specs on a volume type. diff --git a/rally_openstack/common/services/storage/cinder_v1.py b/rally_openstack/common/services/storage/cinder_v1.py index 98d85961..db5907b9 100755 --- a/rally_openstack/common/services/storage/cinder_v1.py +++ b/rally_openstack/common/services/storage/cinder_v1.py @@ -317,6 +317,16 @@ class UnifiedCinderV1Service(cinder_common.UnifiedCinderMixin, """ return self._impl.create_volume_type(name=name) + def update_volume_type(self, volume_type, name=None, + description=None, is_public=None): + raise NotImplementedError("Cinder V1 doesn't support this method.") + + def add_type_access(self, volume_type, project): + raise NotImplementedError("Cinder V1 doesn't support this method.") + + def list_type_access(self, volume_type): + raise NotImplementedError("Cinder V1 doesn't support this method.") + def restore_backup(self, backup_id, volume_id=None): """Restore the given backup. diff --git a/rally_openstack/task/scenarios/cinder/volume_types.py b/rally_openstack/task/scenarios/cinder/volume_types.py index ba33a8cc..02d1fc39 100644 --- a/rally_openstack/task/scenarios/cinder/volume_types.py +++ b/rally_openstack/task/scenarios/cinder/volume_types.py @@ -16,7 +16,6 @@ from rally.common import logging from rally.task import validation from rally_openstack.common import consts -from rally_openstack.common.services.storage import cinder_v2 from rally_openstack.task import scenario from rally_openstack.task.scenarios.cinder import utils as cinder_utils @@ -72,7 +71,7 @@ class CreateAndGetVolumeType(cinder_utils.CinderBasic): @scenario.configure(context={"admin_cleanup@openstack": ["cinder"]}, name="CinderVolumeTypes.create_and_update_volume_type", platform="openstack") -class CreateAndUpdateVolumeType(scenario.OpenStackScenario): +class CreateAndUpdateVolumeType(cinder_utils.CinderBasic): def run(self, description=None, is_public=True, update_name=False, update_description=None, update_is_public=None): @@ -85,15 +84,11 @@ class CreateAndUpdateVolumeType(scenario.OpenStackScenario): :param update_description: update Description of the volume type :param update_is_public: update Volume type visibility """ - service = cinder_v2.CinderV2Service(self._admin_clients, - self.generate_random_name, - atomic_inst=self.atomic_actions()) - - volume_type = service.create_volume_type( + volume_type = self.admin_cinder.create_volume_type( description=description, is_public=is_public) - service.update_volume_type( + self.admin_cinder.update_volume_type( volume_type, name=volume_type.name if not update_name else False, description=update_description, @@ -388,7 +383,7 @@ class CreateAndUpdateEncryptionType(cinder_utils.CinderBasic): context={"admin_cleanup@openstack": ["cinder"]}, name="CinderVolumeTypes.create_volume_type_add_and_list_type_access", platform="openstack") -class CreateVolumeTypeAddAndListTypeAccess(scenario.OpenStackScenario): +class CreateVolumeTypeAddAndListTypeAccess(cinder_utils.CinderBasic): def run(self, description=None, is_public=False): """Add and list volume type access for the given project. @@ -399,11 +394,10 @@ class CreateVolumeTypeAddAndListTypeAccess(scenario.OpenStackScenario): :param description: Description of the volume type :param is_public: Volume type visibility """ - service = cinder_v2.CinderV2Service(self._admin_clients, - self.generate_random_name, - atomic_inst=self.atomic_actions()) - volume_type = service.create_volume_type(description=description, - is_public=is_public) - service.add_type_access(volume_type, - project=self.context["tenant"]["id"]) - service.list_type_access(volume_type) + volume_type = self.admin_cinder.create_volume_type( + description=description, is_public=is_public + ) + self.admin_cinder.add_type_access( + volume_type, project=self.context["tenant"]["id"] + ) + self.admin_cinder.list_type_access(volume_type) diff --git a/rally_openstack/task/scenarios/manila/utils.py b/rally_openstack/task/scenarios/manila/utils.py index 0680ba9d..544e2cf2 100644 --- a/rally_openstack/task/scenarios/manila/utils.py +++ b/rally_openstack/task/scenarios/manila/utils.py @@ -203,7 +203,7 @@ class ManilaScenario(scenario.OpenStackScenario): :param share: :class:`Share` :param new_size: new size of the share """ - share.extend(new_size) + self.clients("manila").shares.extend(share, new_size) utils.wait_for_status( share, ready_statuses=["available"], diff --git a/rally_openstack/task/scenarios/nova/agents.py b/rally_openstack/task/scenarios/nova/agents.py deleted file mode 100644 index cd7f9b1f..00000000 --- a/rally_openstack/task/scenarios/nova/agents.py +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright 2016 IBM Corp. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from rally.task import validation - -from rally_openstack.common import consts -from rally_openstack.task import scenario -from rally_openstack.task.scenarios.nova import utils - - -"""Scenarios for Nova agents.""" - - -@validation.add("required_services", services=[consts.Service.NOVA]) -@validation.add("required_platform", platform="openstack", admin=True) -@scenario.configure(name="NovaAgents.list_agents", platform="openstack") -class ListAgents(utils.NovaScenario): - def run(self, hypervisor=None): - """List all builds. - - Measure the "nova agent-list" command performance. - - :param hypervisor: List agent builds on a specific hypervisor. - None (default value) means list for all - hypervisors - """ - self._list_agents(hypervisor) diff --git a/samples/tasks/scenarios/nova/list-agents.json b/samples/tasks/scenarios/nova/list-agents.json deleted file mode 100644 index 29417ab3..00000000 --- a/samples/tasks/scenarios/nova/list-agents.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "NovaAgents.list_agents": [ - { - "runner": { - "type": "constant", - "concurrency": 2, - "times": 10 - }, - "sla": { - "failure_rate": { - "max": 0 - } - } - } - ] -} diff --git a/samples/tasks/scenarios/nova/list-agents.yaml b/samples/tasks/scenarios/nova/list-agents.yaml deleted file mode 100644 index 535f8688..00000000 --- a/samples/tasks/scenarios/nova/list-agents.yaml +++ /dev/null @@ -1,10 +0,0 @@ ---- - NovaAgents.list_agents: - - - runner: - type: "constant" - concurrency: 2 - times: 10 - sla: - failure_rate: - max: 0 diff --git a/tests/unit/common/services/storage/test_cinder_common.py b/tests/unit/common/services/storage/test_cinder_common.py index c1cec790..e6b1bf2f 100755 --- a/tests/unit/common/services/storage/test_cinder_common.py +++ b/tests/unit/common/services/storage/test_cinder_common.py @@ -623,6 +623,14 @@ class UnifiedCinderMixinTestCase(test.TestCase): self.service._unify_transfer.assert_called_once_with( "transfer") + def test_update_volume_type(self): + self.assertEqual(self.service._impl.update_volume_type.return_value, + self.service.update_volume_type("volume_type")) + self.service._impl.update_volume_type.assert_called_once_with( + volume_type="volume_type", name=None, description=None, + is_public=None + ) + def test_get_volume_type(self): self.assertEqual(self.service._impl.get_volume_type.return_value, self.service.get_volume_type("volume_type")) @@ -635,6 +643,19 @@ class UnifiedCinderMixinTestCase(test.TestCase): self.service._impl.delete_volume_type.assert_called_once_with( "volume_type") + def test_add_type_access(self): + self.assertEqual(self.service._impl.add_type_access.return_value, + self.service.add_type_access(volume_type="some_type", + project="some_project")) + self.service._impl.add_type_access.assert_called_once_with( + volume_type="some_type", project="some_project") + + def test_list_type_access(self): + self.assertEqual(self.service._impl.list_type_access.return_value, + self.service.list_type_access("some_type")) + self.service._impl.list_type_access.assert_called_once_with( + "some_type") + def test_set_volume_type_keys(self): self.assertEqual(self.service._impl.set_volume_type_keys.return_value, self.service.set_volume_type_keys( diff --git a/tests/unit/common/services/storage/test_cinder_v1.py b/tests/unit/common/services/storage/test_cinder_v1.py index 68c56ad8..49e5f41a 100755 --- a/tests/unit/common/services/storage/test_cinder_v1.py +++ b/tests/unit/common/services/storage/test_cinder_v1.py @@ -365,3 +365,17 @@ class UnifiedCinderV1ServiceTestCase(test.TestCase): volume_id=1) self.service._unify_volume.assert_called_once_with( self.service._impl.restore_backup.return_value) + + def test_not_implemented_methods(self): + self.assertRaises( + NotImplementedError, + self.service.update_volume_type, "type" + ) + self.assertRaises( + NotImplementedError, + self.service.list_type_access, "type" + ) + self.assertRaises( + NotImplementedError, + self.service.add_type_access, "type", project="project" + ) diff --git a/tests/unit/task/scenarios/cinder/test_volume_types.py b/tests/unit/task/scenarios/cinder/test_volume_types.py index 974ccf97..9cbc07b1 100644 --- a/tests/unit/task/scenarios/cinder/test_volume_types.py +++ b/tests/unit/task/scenarios/cinder/test_volume_types.py @@ -18,9 +18,6 @@ from rally import exceptions as rally_exceptions from rally_openstack.task.scenarios.cinder import volume_types from tests.unit import test -CINDER_V2_PATH = ("rally_openstack.common.services.storage" - ".cinder_v2.CinderV2Service") - class CinderVolumeTypesTestCase(test.ScenarioTestCase): @@ -157,23 +154,21 @@ class CinderVolumeTypesTestCase(test.ScenarioTestCase): description=description, is_public=is_public) mock_service.list_types.assert_called_once_with() - @mock.patch("%s.create_volume_type" % CINDER_V2_PATH) - @mock.patch("%s.update_volume_type" % CINDER_V2_PATH) - def test_create_and_update_volume_type(self, mock_update_volume_type, - mock_create_volume_type): + def test_create_and_update_volume_type(self): + mock_service = self.mock_cinder.return_value scenario = volume_types.CreateAndUpdateVolumeType(self._get_context()) fake_type = mock.MagicMock() fake_type.name = "any" create_description = "test create" update_description = "test update" - mock_create_volume_type.return_value = fake_type + mock_service.create_volume_type.return_value = fake_type scenario.run(description=create_description, update_description=update_description) - mock_create_volume_type.assert_called_once_with( + mock_service.create_volume_type.assert_called_once_with( description=create_description, is_public=True) - mock_update_volume_type.assert_called_once_with( + mock_service.update_volume_type.assert_called_once_with( fake_type, name="any", description=update_description, is_public=None) @@ -292,19 +287,16 @@ class CinderVolumeTypesTestCase(test.ScenarioTestCase): mock_service.update_encryption_type.assert_called_once_with( "fake_id", specs=update_specs) - @mock.patch("%s.list_type_access" % CINDER_V2_PATH) - @mock.patch("%s.add_type_access" % CINDER_V2_PATH) - @mock.patch("%s.create_volume_type" % CINDER_V2_PATH) - def test_create_volume_type_add_and_list_type_access( - self, mock_create_volume_type, mock_add_type_access, - mock_list_type_access): + def test_create_volume_type_add_and_list_type_access(self): + mock_service = self.mock_cinder.return_value scenario = volume_types.CreateVolumeTypeAddAndListTypeAccess( self._get_context()) fake_type = mock.Mock() - mock_create_volume_type.return_value = fake_type + mock_service.create_volume_type.return_value = fake_type scenario.run(description=None, is_public=False) - mock_create_volume_type.assert_called_once_with( + mock_service.create_volume_type.assert_called_once_with( description=None, is_public=False) - mock_add_type_access.assert_called_once_with(fake_type, project="fake") - mock_list_type_access.assert_called_once_with(fake_type) + mock_service.add_type_access.assert_called_once_with( + fake_type, project="fake") + mock_service.list_type_access.assert_called_once_with(fake_type) diff --git a/tests/unit/task/scenarios/manila/test_utils.py b/tests/unit/task/scenarios/manila/test_utils.py index 6eec260a..379833a0 100644 --- a/tests/unit/task/scenarios/manila/test_utils.py +++ b/tests/unit/task/scenarios/manila/test_utils.py @@ -109,7 +109,8 @@ class ManilaScenarioTestCase(test.ScenarioTestCase): self.scenario._extend_share(fake_share, new_size) - fake_share.extend.assert_called_with(new_size) + self.clients("manila").shares.extend.assert_called_once_with( + fake_share, new_size) self.mock_wait_for_status.mock.assert_called_once_with( fake_share, diff --git a/tests/unit/task/scenarios/nova/test_agents.py b/tests/unit/task/scenarios/nova/test_agents.py deleted file mode 100644 index 592cd201..00000000 --- a/tests/unit/task/scenarios/nova/test_agents.py +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright 2016 IBM Corp. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from unittest import mock - -from rally_openstack.task.scenarios.nova import agents -from tests.unit import test - - -class NovaAgentsTestCase(test.TestCase): - - def test_list_agents(self): - scenario = agents.ListAgents() - scenario._list_agents = mock.Mock() - scenario.run(hypervisor=None) - scenario._list_agents.assert_called_once_with(None)