Add the scenario of list-flavors
Change-Id: Id5ec575a71c11a969fe60f74a35dd9c5c6b39b4e
This commit is contained in:
parent
cc5794c395
commit
d1d7121e50
@ -860,3 +860,19 @@
|
|||||||
sla:
|
sla:
|
||||||
failure_rate:
|
failure_rate:
|
||||||
max: 0
|
max: 0
|
||||||
|
|
||||||
|
NovaFlavors.list_flavors:
|
||||||
|
-
|
||||||
|
args:
|
||||||
|
detailed: True
|
||||||
|
runner:
|
||||||
|
type: "constant"
|
||||||
|
times: 5
|
||||||
|
concurrency: 2
|
||||||
|
context:
|
||||||
|
users:
|
||||||
|
tenants: 2
|
||||||
|
users_per_tenant: 2
|
||||||
|
sla:
|
||||||
|
failure_rate:
|
||||||
|
max: 0
|
||||||
|
38
rally/plugins/openstack/scenarios/nova/flavors.py
Normal file
38
rally/plugins/openstack/scenarios/nova/flavors.py
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# Copyright 2015: Inc.
|
||||||
|
# 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 import consts
|
||||||
|
from rally.plugins.openstack import scenario
|
||||||
|
from rally.plugins.openstack.scenarios.nova import utils
|
||||||
|
from rally.task import validation
|
||||||
|
|
||||||
|
|
||||||
|
class NovaFlavors(utils.NovaScenario):
|
||||||
|
"""Benchmark scenarios for Nova flavors."""
|
||||||
|
|
||||||
|
@validation.required_services(consts.Service.NOVA)
|
||||||
|
@validation.required_openstack(users=True)
|
||||||
|
@scenario.configure(context={"cleanup": ["nova"]})
|
||||||
|
def list_flavors(self, detailed=True, **kwargs):
|
||||||
|
"""List all flavors.
|
||||||
|
|
||||||
|
Measure the "nova flavor-list" command performance.
|
||||||
|
|
||||||
|
:param detailed: True if the flavor listing
|
||||||
|
should contain detailed information
|
||||||
|
|
||||||
|
:param kwargs: Optional additional arguments for flavor listing
|
||||||
|
"""
|
||||||
|
self._list_flavors(detailed, **kwargs)
|
@ -892,3 +892,14 @@ class NovaScenario(scenario.OpenStackScenario):
|
|||||||
:param net_id: The nova-network ID to delete
|
:param net_id: The nova-network ID to delete
|
||||||
"""
|
"""
|
||||||
return self.admin_clients("nova").networks.delete(net_id)
|
return self.admin_clients("nova").networks.delete(net_id)
|
||||||
|
|
||||||
|
@atomic.action_timer("nova.list_flavors")
|
||||||
|
def _list_flavors(self, detailed=True, **kwargs):
|
||||||
|
"""List all flavors.
|
||||||
|
|
||||||
|
:param kwargs: Optional additional arguments for flavor listing
|
||||||
|
:param detailed: True if the image listing
|
||||||
|
should contain detailed information
|
||||||
|
:returns: flavors list
|
||||||
|
"""
|
||||||
|
return self.clients("nova").flavors.list(detailed, **kwargs)
|
||||||
|
20
samples/tasks/scenarios/nova/list-flavors.json
Normal file
20
samples/tasks/scenarios/nova/list-flavors.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"NovaFlavors.list_flavors": [
|
||||||
|
{
|
||||||
|
"runner": {
|
||||||
|
"type": "constant",
|
||||||
|
"concurrency": 2,
|
||||||
|
"times": 10
|
||||||
|
},
|
||||||
|
"args": {
|
||||||
|
"detailed": true
|
||||||
|
},
|
||||||
|
"context": {
|
||||||
|
"users": {
|
||||||
|
"tenants": 3,
|
||||||
|
"users_per_tenant": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
13
samples/tasks/scenarios/nova/list-flavors.yaml
Normal file
13
samples/tasks/scenarios/nova/list-flavors.yaml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
NovaFlavors.list_flavors:
|
||||||
|
-
|
||||||
|
args:
|
||||||
|
detailed: True
|
||||||
|
runner:
|
||||||
|
type: "constant"
|
||||||
|
times: 10
|
||||||
|
concurrency: 2
|
||||||
|
context:
|
||||||
|
users:
|
||||||
|
tenants: 3
|
||||||
|
users_per_tenant: 2
|
28
tests/unit/plugins/openstack/scenarios/nova/test_flavors.py
Normal file
28
tests/unit/plugins/openstack/scenarios/nova/test_flavors.py
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# Copyright: 2015.
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
import mock
|
||||||
|
|
||||||
|
from rally.plugins.openstack.scenarios.nova import flavors
|
||||||
|
from tests.unit import test
|
||||||
|
|
||||||
|
|
||||||
|
class NovaFlavorsTestCase(test.TestCase):
|
||||||
|
|
||||||
|
def test_list_flavors(self):
|
||||||
|
scenario = flavors.NovaFlavors()
|
||||||
|
scenario._list_flavors = mock.Mock()
|
||||||
|
scenario.list_flavors(detailed=True, fakearg="fakearg")
|
||||||
|
scenario._list_flavors.assert_called_once_with(True, fakearg="fakearg")
|
@ -865,3 +865,13 @@ class NovaScenarioTestCase(test.ScenarioTestCase):
|
|||||||
self.assertEqual(return_netlabel, fake_net)
|
self.assertEqual(return_netlabel, fake_net)
|
||||||
self._test_atomic_action_timer(nova_scenario.atomic_actions(),
|
self._test_atomic_action_timer(nova_scenario.atomic_actions(),
|
||||||
"nova.create_network")
|
"nova.create_network")
|
||||||
|
|
||||||
|
def test__list_flavors(self):
|
||||||
|
nova_scenario = utils.NovaScenario()
|
||||||
|
self.clients("nova").flavors.list.return_value = "flavors_list"
|
||||||
|
result = nova_scenario._list_flavors(detailed=True, fakearg="fakearg")
|
||||||
|
self.assertEqual("flavors_list", result)
|
||||||
|
self.clients("nova").flavors.list.assert_called_once_with(
|
||||||
|
True, fakearg="fakearg")
|
||||||
|
self._test_atomic_action_timer(nova_scenario.atomic_actions(),
|
||||||
|
"nova.list_flavors")
|
||||||
|
Loading…
Reference in New Issue
Block a user