Fix : Added implementation for CloudWatch Describe Metric for Alarm (#3148)
* Fix : added implementation for CloudWatch Describe Metric for Alarm * Linting Co-authored-by: Bert Blommers <info@bertblommers.nl>
This commit is contained in:
parent
bed769a387
commit
09b764148c
3 changed files with 100 additions and 1 deletions
|
|
@ -127,6 +127,22 @@ def test_describe_alarms():
|
|||
alarms.should.have.length_of(0)
|
||||
|
||||
|
||||
@mock_cloudwatch_deprecated
|
||||
def test_describe_alarms_for_metric():
|
||||
conn = boto.connect_cloudwatch()
|
||||
|
||||
conn.create_alarm(alarm_fixture(name="nfoobar", action="afoobar"))
|
||||
conn.create_alarm(alarm_fixture(name="nfoobaz", action="afoobaz"))
|
||||
conn.create_alarm(alarm_fixture(name="nbarfoo", action="abarfoo"))
|
||||
conn.create_alarm(alarm_fixture(name="nbazfoo", action="abazfoo"))
|
||||
|
||||
alarms = conn.describe_alarms_for_metric("nbarfoo_metric", "nbarfoo_namespace")
|
||||
alarms.should.have.length_of(1)
|
||||
|
||||
alarms = conn.describe_alarms_for_metric("nbazfoo_metric", "nbazfoo_namespace")
|
||||
alarms.should.have.length_of(1)
|
||||
|
||||
|
||||
@mock_cloudwatch_deprecated
|
||||
def test_get_metric_statistics():
|
||||
conn = boto.connect_cloudwatch()
|
||||
|
|
|
|||
|
|
@ -123,6 +123,24 @@ def test_delete_invalid_alarm():
|
|||
e.exception.response["Error"]["Code"].should.equal("ResourceNotFound")
|
||||
|
||||
|
||||
@mock_cloudwatch
|
||||
def test_describe_alarms_for_metric():
|
||||
conn = boto3.client("cloudwatch", region_name="eu-central-1")
|
||||
conn.put_metric_alarm(
|
||||
AlarmName="testalarm1",
|
||||
MetricName="cpu",
|
||||
Namespace="blah",
|
||||
Period=10,
|
||||
EvaluationPeriods=5,
|
||||
Statistic="Average",
|
||||
Threshold=2,
|
||||
ComparisonOperator="GreaterThanThreshold",
|
||||
ActionsEnabled=True,
|
||||
)
|
||||
alarms = conn.describe_alarms_for_metric(MetricName="cpu", Namespace="blah")
|
||||
alarms.get("MetricAlarms").should.have.length_of(1)
|
||||
|
||||
|
||||
@mock_cloudwatch
|
||||
def test_alarm_state():
|
||||
client = boto3.client("cloudwatch", region_name="eu-central-1")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue