Merge "[Ceilometer] Add CeilometerAlarms.create_alarm_and_get_history scenario"
This commit is contained in:
commit
a3357f3d51
@ -176,6 +176,29 @@
|
|||||||
failure_rate:
|
failure_rate:
|
||||||
max: 0
|
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:
|
CeilometerAlarms.list_alarms:
|
||||||
-
|
-
|
||||||
runner:
|
runner:
|
||||||
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -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
|
@ -213,6 +213,7 @@ class FakeAlarm(FakeResource):
|
|||||||
super(FakeAlarm, self).__init__(manager)
|
super(FakeAlarm, self).__init__(manager)
|
||||||
self.meter_name = kwargs.get("meter_name")
|
self.meter_name = kwargs.get("meter_name")
|
||||||
self.threshold = kwargs.get("threshold")
|
self.threshold = kwargs.get("threshold")
|
||||||
|
self.state = kwargs.get("state", "fake-alarm-state")
|
||||||
self.alarm_id = kwargs.get("alarm_id", "fake-alarm-id")
|
self.alarm_id = kwargs.get("alarm_id", "fake-alarm-id")
|
||||||
self.optional_args = kwargs.get("optional_args", {})
|
self.optional_args = kwargs.get("optional_args", {})
|
||||||
|
|
||||||
@ -730,6 +731,19 @@ class FakeAlarmManager(FakeManager):
|
|||||||
del self.cache[alarm.id]
|
del self.cache[alarm.id]
|
||||||
self.resources_order.remove(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):
|
class FakeSampleManager(FakeManager):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user