Add CinderVolumes.list_types
This simple scenario tests the cinder type-list command by listing all the volume types. Change-Id: I33c0a4eef8cc21bb848050d23e0d207653efca23
This commit is contained in:
parent
edb093d9be
commit
724a1db8b9
@ -236,6 +236,24 @@
|
||||
failure_rate:
|
||||
max: 0
|
||||
|
||||
CinderVolumes.list_types:
|
||||
{% for s in ("true", "false") %}
|
||||
-
|
||||
args:
|
||||
is_public: {{s}}
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 10
|
||||
concurrency: 2
|
||||
context:
|
||||
users:
|
||||
tenants: 2
|
||||
users_per_tenant: 3
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
||||
{% endfor %}
|
||||
|
||||
CinderVolumes.create_volume:
|
||||
-
|
||||
args:
|
||||
|
@ -65,6 +65,17 @@ class CinderScenario(scenario.OpenStackScenario):
|
||||
|
||||
return self.clients("cinder").volume_snapshots.list(detailed)
|
||||
|
||||
@atomic.action_timer("cinder.list_types")
|
||||
def _list_types(self, search_opts=None, is_public=None):
|
||||
"""Lists all volume types.
|
||||
|
||||
:param search_opts: Options used when search for volume types
|
||||
:param is_public: If query public volume type
|
||||
:returns: A list of volume types
|
||||
"""
|
||||
return self.clients("cinder").volume_types.list(search_opts,
|
||||
is_public)
|
||||
|
||||
def _set_metadata(self, volume, sets=10, set_size=3):
|
||||
"""Set volume metadata.
|
||||
|
||||
|
@ -88,6 +88,24 @@ class ListVolumes(cinder_utils.CinderScenario,
|
||||
self._list_volumes(detailed)
|
||||
|
||||
|
||||
@validation.required_services(consts.Service.CINDER)
|
||||
@validation.required_openstack(users=True)
|
||||
@scenario.configure(name="CinderVolumes.list_types")
|
||||
class ListTypes(cinder_utils.CinderScenario):
|
||||
|
||||
def run(self, search_opts=None, is_public=None):
|
||||
"""List all volume types.
|
||||
|
||||
This simple scenario tests the cinder type-list command by listing
|
||||
all the volume types.
|
||||
|
||||
:param search_opts: Options used when search for volume types
|
||||
:param is_public: If query public volume type
|
||||
"""
|
||||
|
||||
self._list_types(search_opts, is_public)
|
||||
|
||||
|
||||
@types.convert(image={"type": "glance_image"})
|
||||
@validation.image_exists("image", nullable=True)
|
||||
@validation.required_services(consts.Service.CINDER)
|
||||
@ -702,4 +720,4 @@ class CreateVolumeFromSnapshot(cinder_utils.CinderScenario,
|
||||
|
||||
if do_delete:
|
||||
self._delete_snapshot(snapshot)
|
||||
self._delete_volume(volume)
|
||||
self._delete_volume(volume)
|
||||
|
25
samples/tasks/scenarios/cinder/list-types.json
Normal file
25
samples/tasks/scenarios/cinder/list-types.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"CinderVolumes.list_types": [
|
||||
{
|
||||
"args": {
|
||||
"is_public": true
|
||||
},
|
||||
"runner": {
|
||||
"type": "constant",
|
||||
"times": 10,
|
||||
"concurrency": 2
|
||||
},
|
||||
"context": {
|
||||
"users": {
|
||||
"tenants": 2,
|
||||
"users_per_tenant": 3
|
||||
}
|
||||
},
|
||||
"sla": {
|
||||
"failure_rate": {
|
||||
"max": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
16
samples/tasks/scenarios/cinder/list-types.yaml
Normal file
16
samples/tasks/scenarios/cinder/list-types.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
CinderVolumes.list_types:
|
||||
-
|
||||
args:
|
||||
is_public: true
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 10
|
||||
concurrency: 2
|
||||
context:
|
||||
users:
|
||||
tenants: 2
|
||||
users_per_tenant: 3
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
@ -45,6 +45,13 @@ class CinderScenarioTestCase(test.ScenarioTestCase):
|
||||
self._test_atomic_action_timer(self.scenario.atomic_actions(),
|
||||
"cinder.list_volumes")
|
||||
|
||||
def test__list_types(self):
|
||||
return_types_list = self.scenario._list_types()
|
||||
self.assertEqual(self.clients("cinder").volume_types.list.return_value,
|
||||
return_types_list)
|
||||
self._test_atomic_action_timer(self.scenario.atomic_actions(),
|
||||
"cinder.list_types")
|
||||
|
||||
def test__list_snapshots(self):
|
||||
return_snapshots_list = self.scenario._list_snapshots()
|
||||
self.assertEqual(
|
||||
|
@ -54,6 +54,12 @@ class CinderServersTestCase(test.ScenarioTestCase):
|
||||
scenario.run(True)
|
||||
scenario._list_volumes.assert_called_once_with(True)
|
||||
|
||||
def test_list_types(self):
|
||||
scenario = volumes.ListTypes(self.context)
|
||||
scenario._list_types = mock.MagicMock()
|
||||
scenario.run(None, None)
|
||||
scenario._list_types.assert_called_once_with(None, None)
|
||||
|
||||
def test_create_and_update_volume(self):
|
||||
volume_update_args = {"dispaly_name": "_updated"}
|
||||
scenario = volumes.CreateAndUpdateVolume(self.context)
|
||||
|
Loading…
Reference in New Issue
Block a user