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:
usmangani1 2020-07-18 15:17:53 +05:30 committed by GitHub
commit 09b764148c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 100 additions and 1 deletions

View file

@ -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")