Minor fixes in Ceilometer benchmark scenarios

1. Renames ceilometer.py to alarms.py as it contains scenarios for alarms only.
2. Complete a TODO to use self._generate_random_name

Change-Id: I536e0ebd20f8dc56e31a75f117994c3abe4c9f2d
Closes-Bug: #1323629
This commit is contained in:
Aswad Rangnekar 2014-05-29 11:40:47 +05:30
parent 3353933ef5
commit 7d461b19ed
14 changed files with 26 additions and 30 deletions

View File

@ -1,5 +1,5 @@
{
"CeilometerBasic.create_alarm": [
"CeilometerAlarms.create_alarm": [
{
"args": {
"meter_name": "ram_util",

View File

@ -1,5 +1,5 @@
---
CeilometerBasic.create_alarm:
CeilometerAlarms.create_alarm:
-
args:
meter_name: "ram_util"

View File

@ -1,5 +1,5 @@
{
"CeilometerBasic.create_and_delete_alarm": [
"CeilometerAlarms.create_and_delete_alarm": [
{
"args": {
"meter_name": "ram_util",

View File

@ -1,5 +1,5 @@
---
CeilometerBasic.create_and_delete_alarm:
CeilometerAlarms.create_and_delete_alarm:
-
args:
meter_name: "ram_util"

View File

@ -1,5 +1,5 @@
{
"CeilometerBasic.create_and_list_alarm": [
"CeilometerAlarms.create_and_list_alarm": [
{
"args": {
"meter_name": "ram_util",

View File

@ -1,5 +1,5 @@
---
CeilometerBasic.create_and_list_alarm:
CeilometerAlarms.create_and_list_alarm:
-
args:
meter_name: "ram_util"

View File

@ -1,5 +1,5 @@
{
"CeilometerBasic.create_and_update_alarm": [
"CeilometerAlarms.create_and_update_alarm": [
{
"args": {
"meter_name": "ram_util",

View File

@ -1,5 +1,5 @@
---
CeilometerBasic.create_and_update_alarm:
CeilometerAlarms.create_and_update_alarm:
-
args:
meter_name: "ram_util"

View File

@ -1,5 +1,5 @@
{
"CeilometerBasic.list_alarms": [
"CeilometerAlarms.list_alarms": [
{
"runner":{
"type": "constant",

View File

@ -1,5 +1,5 @@
---
CeilometerBasic.list_alarms:
CeilometerAlarms.list_alarms:
-
runner:
type: "constant"

View File

@ -17,7 +17,7 @@
times: 10
concurrency: 10
CeilometerBasic.create_alarm:
CeilometerAlarms.create_alarm:
-
args:
meter_name: "ram_util"
@ -32,7 +32,7 @@
times: 10
concurrency: 10
CeilometerBasic.create_and_delete_alarm:
CeilometerAlarms.create_and_delete_alarm:
-
args:
meter_name: "ram_util"
@ -47,7 +47,7 @@
times: 10
concurrency: 10
CeilometerBasic.create_and_list_alarm:
CeilometerAlarms.create_and_list_alarm:
-
args:
meter_name: "ram_util"
@ -62,7 +62,7 @@
times: 10
concurrency: 10
CeilometerBasic.create_and_update_alarm:
CeilometerAlarms.create_and_update_alarm:
-
args:
meter_name: "ram_util"
@ -77,7 +77,7 @@
times: 10
concurrency: 10
CeilometerBasic.list_alarms:
CeilometerAlarms.list_alarms:
-
runner:
type: "constant"

View File

@ -16,7 +16,7 @@ from rally.benchmark.scenarios import base
from rally.benchmark.scenarios.ceilometer import utils as ceilometerutils
class CeilometerBasic(ceilometerutils.CeilometerScenario):
class CeilometerAlarms(ceilometerutils.CeilometerScenario):
@base.scenario(context={"cleanup": ["ceilometer"]})
def create_alarm(self, meter_name, threshold, **kwargs):
"""Test creating an alarm.

View File

@ -12,8 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import uuid
from rally.benchmark.scenarios import base
from rally.benchmark.scenarios import utils as scenario_utils
@ -27,11 +25,9 @@ class CeilometerScenario(base.Scenario):
:param kwargs: optional parameters to create alarm
:returns: alarm dictionary used to create an alarm
"""
# TODO(Aswad): Reuse _generate_random_name from base.Scenario instead
# of generating alarm_uuid. Ref: bp/benchmark-scenarios-for-neutron.
alarm_uuid = str(uuid.uuid4())
alarm = {"alarm_id": alarm_uuid,
"name": "TestAlarm-%s" % alarm_uuid,
alarm_id = self._generate_random_name()
alarm = {"alarm_id": alarm_id,
"name": "TestAlarm-%s" % alarm_id,
"description": "Test Alarm"}
alarm.update(kwargs)

View File

@ -14,13 +14,13 @@
import mock
from rally.benchmark.scenarios.ceilometer import ceilometer
from rally.benchmark.scenarios.ceilometer import alarms
from tests import test
class CeilometerBasicTestCase(test.TestCase):
class CeilometerAlarmsTestCase(test.TestCase):
def test_create_alarm(self):
scenario = ceilometer.CeilometerBasic()
scenario = alarms.CeilometerAlarms()
scenario._create_alarm = mock.MagicMock()
scenario.create_alarm("fake_meter_name",
@ -31,7 +31,7 @@ class CeilometerBasicTestCase(test.TestCase):
{'fakearg': 'f'})
def test_list_alarm(self):
scenario = ceilometer.CeilometerBasic()
scenario = alarms.CeilometerAlarms()
scenario._list_alarms = mock.MagicMock()
scenario.list_alarms()
@ -39,7 +39,7 @@ class CeilometerBasicTestCase(test.TestCase):
def test_create_and_list_alarm(self):
fake_alarm = mock.MagicMock()
scenario = ceilometer.CeilometerBasic()
scenario = alarms.CeilometerAlarms()
scenario._create_alarm = mock.MagicMock(return_value=fake_alarm)
scenario._list_alarms = mock.MagicMock()
@ -54,7 +54,7 @@ class CeilometerBasicTestCase(test.TestCase):
def test_create_and_update_alarm(self):
fake_alram_dict_diff = {'description': 'Changed Test Description'}
fake_alarm = mock.MagicMock()
scenario = ceilometer.CeilometerBasic()
scenario = alarms.CeilometerAlarms()
scenario._create_alarm = mock.MagicMock(return_value=fake_alarm)
scenario._update_alarm = mock.MagicMock()
@ -69,7 +69,7 @@ class CeilometerBasicTestCase(test.TestCase):
def test_create_and_delete_alarm(self):
fake_alarm = mock.MagicMock()
scenario = ceilometer.CeilometerBasic()
scenario = alarms.CeilometerAlarms()
scenario._create_alarm = mock.MagicMock(return_value=fake_alarm)
scenario._delete_alarm = mock.MagicMock()