Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/aws/services/cloudwatch/test_cloudwatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -1318,8 +1318,8 @@ def test_put_metric_alarm(
MetricName=metric_name,
Namespace=namespace,
ActionsEnabled=True,
Period=30,
Threshold=2,
Period=10,
Threshold=21,
Dimensions=dimension,
Unit="Seconds",
Statistic="Average",
Expand Down
28 changes: 14 additions & 14 deletions tests/aws/services/cloudwatch/test_cloudwatch.snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@
}
},
"tests/aws/services/cloudwatch/test_cloudwatch.py::TestCloudwatch::test_put_metric_alarm": {
"recorded-date": "19-01-2024, 13:46:30",
"recorded-date": "12-05-2025, 16:20:57",
"recorded-content": {
"describe-alarm": {
"CompositeAlarms": [],
Expand Down Expand Up @@ -397,13 +397,13 @@
"OKActions": [
"arn:<partition>:sns:<region>:111111111111:<topic_arn>"
],
"Period": 30,
"Period": 10,
"StateReason": "Unchecked: Initial alarm creation",
"StateTransitionedTimestamp": "timestamp",
"StateUpdatedTimestamp": "timestamp",
"StateValue": "INSUFFICIENT_DATA",
"Statistic": "Average",
"Threshold": 2.0,
"Threshold": 21.0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good adjustment of threshold to be equal to one of the data points! 👍 Indeed since metric data is added sequentially in a loop and alarm evaluation happens in a separate thread it is likely that in those 14% of cases evaluation happened after 21.0 was added but before 22.0. Since 21 was already bigger than 2 alarm was triggered. Now it shouldn't be the case - alarm needs both data points to be triggered.

"TreatMissingData": "ignore",
"Unit": "Seconds"
}
Expand All @@ -423,7 +423,7 @@
"AlarmDescription": "testing cloudwatch alarms",
"AlarmName": "<alarm-name:1>",
"InsufficientDataActions": [],
"NewStateReason": "Threshold Crossed: 1 datapoint [21.5 (MM/DD/YY HH:MM:SS)] was greater than the threshold (2.0).",
"NewStateReason": "Threshold Crossed: 1 datapoint [21.5 (MM/DD/YY HH:MM:SS)] was greater than the threshold (21.0).",
"NewStateValue": "ALARM",
"OKActions": [
"arn:<partition>:sns:<region>:111111111111:<topic_arn>"
Expand All @@ -443,10 +443,10 @@
"EvaluationPeriods": 1,
"MetricName": "my-metric1",
"Namespace": "<namespace:1>",
"Period": 30,
"Period": 10,
"Statistic": "AVERAGE",
"StatisticType": "Statistic",
"Threshold": 2.0,
"Threshold": 21.0,
"TreatMissingData": "ignore",
"Unit": "Seconds"
}
Expand All @@ -464,18 +464,18 @@
},
"newState": {
"stateValue": "ALARM",
"stateReason": "Threshold Crossed: 1 datapoint [21.5 (MM/DD/YY HH:MM:SS)] was greater than the threshold (2.0).",
"stateReason": "Threshold Crossed: 1 datapoint [21.5 (MM/DD/YY HH:MM:SS)] was greater than the threshold (21.0).",
"stateReasonData": {
"version": "1.0",
"queryDate": "date",
"startDate": "date",
"unit": "Seconds",
"statistic": "Average",
"period": 30,
"period": 10,
"recentDatapoints": [
21.5
],
"threshold": 2.0,
"threshold": 21.0,
"evaluatedDatapoints": [
{
"timestamp": "date",
Expand Down Expand Up @@ -521,19 +521,19 @@
"OKActions": [
"arn:<partition>:sns:<region>:111111111111:<topic_arn>"
],
"Period": 30,
"StateReason": "Threshold Crossed: 1 datapoint [21.5 (MM/DD/YY HH:MM:SS)] was greater than the threshold (2.0).",
"Period": 10,
"StateReason": "Threshold Crossed: 1 datapoint [21.5 (MM/DD/YY HH:MM:SS)] was greater than the threshold (21.0).",
"StateReasonData": {
"version": "1.0",
"queryDate": "date",
"startDate": "date",
"unit": "Seconds",
"statistic": "Average",
"period": 30,
"period": 10,
"recentDatapoints": [
21.5
],
"threshold": 2.0,
"threshold": 21.0,
"evaluatedDatapoints": [
{
"timestamp": "date",
Expand All @@ -546,7 +546,7 @@
"StateUpdatedTimestamp": "timestamp",
"StateValue": "ALARM",
"Statistic": "Average",
"Threshold": 2.0,
"Threshold": 21.0,
"TreatMissingData": "ignore",
"Unit": "Seconds"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"last_validated_date": "2024-07-29T07:56:05+00:00"
},
"tests/aws/services/cloudwatch/test_cloudwatch.py::TestCloudwatch::test_put_metric_alarm": {
"last_validated_date": "2024-01-19T14:26:26+00:00"
"last_validated_date": "2025-05-12T16:20:56+00:00"
},
"tests/aws/services/cloudwatch/test_cloudwatch.py::TestCloudwatch::test_put_metric_data_values_list": {
"last_validated_date": "2023-09-25T08:26:17+00:00"
Expand Down
Loading