diff --git a/rally-jobs/rally.yaml b/rally-jobs/rally.yaml index 03b3f093..cb420191 100755 --- a/rally-jobs/rally.yaml +++ b/rally-jobs/rally.yaml @@ -176,6 +176,29 @@ failure_rate: max: 0 + CeilometerAlarms.create_alarm_and_get_history: + - + args: + meter_name: "ram_util" + threshold: 10.0 + type: "threshold" + state: "ok" + statistic: "avg" + alarm_actions: ["http://localhost:8776/alarm"] + ok_actions: ["http://localhost:8776/ok"] + insufficient_data_actions: ["http://localhost:8776/notok"] + runner: + type: "constant" + times: 10 + concurrency: 5 + context: + users: + tenants: 2 + users_per_tenant: 2 + sla: + failure_rate: + max: 0 + CeilometerAlarms.list_alarms: - runner: diff --git a/samples/tasks/scenarios/ceilometer/create-alarm-and-get-history.json b/samples/tasks/scenarios/ceilometer/create-alarm-and-get-history.json new file mode 100644 index 00000000..8432feb3 --- /dev/null +++ b/samples/tasks/scenarios/ceilometer/create-alarm-and-get-history.json @@ -0,0 +1,27 @@ +{ + "CeilometerAlarms.create_alarm_and_get_history": [ + { + "args": { + "meter_name": "ram_util", + "threshold": 10.0, + "type": "threshold", + "state": "ok", + "statistic": "avg", + "alarm_actions": ["http://localhost:8776/alarm"], + "ok_actions": ["http://localhost:8776/ok"], + "insufficient_data_actions": ["http://localhost:8776/notok"] + }, + "runner": { + "type": "constant", + "times": 10, + "concurrency": 5 + }, + "context": { + "users": { + "tenants": 2, + "users_per_tenant": 2 + } + } + } + ] +} diff --git a/samples/tasks/scenarios/ceilometer/create-alarm-and-get-history.yaml b/samples/tasks/scenarios/ceilometer/create-alarm-and-get-history.yaml new file mode 100644 index 00000000..dff289ea --- /dev/null +++ b/samples/tasks/scenarios/ceilometer/create-alarm-and-get-history.yaml @@ -0,0 +1,20 @@ +--- + CeilometerAlarms.create_alarm_and_get_history: + - + args: + meter_name: "ram_util" + threshold: 10.0 + type: "threshold" + state: "ok" + statistic: "avg" + alarm_actions: ["http://localhost:8776/alarm"] + ok_actions: ["http://localhost:8776/ok"] + insufficient_data_actions: ["http://localhost:8776/notok"] + runner: + type: "constant" + times: 10 + concurrency: 5 + context: + users: + tenants: 2 + users_per_tenant: 2 diff --git a/tests/unit/fakes.py b/tests/unit/fakes.py index e525d902..cd8650e4 100644 --- a/tests/unit/fakes.py +++ b/tests/unit/fakes.py @@ -213,6 +213,7 @@ class FakeAlarm(FakeResource): super(FakeAlarm, self).__init__(manager) self.meter_name = kwargs.get("meter_name") self.threshold = kwargs.get("threshold") + self.state = kwargs.get("state", "fake-alarm-state") self.alarm_id = kwargs.get("alarm_id", "fake-alarm-id") self.optional_args = kwargs.get("optional_args", {}) @@ -730,6 +731,19 @@ class FakeAlarmManager(FakeManager): del self.cache[alarm.id] self.resources_order.remove(alarm.id) + def get_state(self, alarm_id): + alarm = self.find(alarm_id=alarm_id) + if alarm is not None: + return getattr(alarm, "state", "fake-alarm-state") + + def get_history(self, alarm_id): + return ["fake-alarm-history"] + + def set_state(self, alarm_id, state): + alarm = self.find(alarm_id=alarm_id) + if alarm is not None: + return setattr(alarm, "state", state) + class FakeSampleManager(FakeManager):