From 03f834a1286036e1d3cdd93c5fe5cf8a8d2dee47 Mon Sep 17 00:00:00 2001 From: Cristopher Pinzon Date: Thu, 8 May 2025 11:22:51 -0500 Subject: [PATCH 1/6] fix put-metric-alarm test failure rate --- .../aws/services/cloudwatch/test_cloudwatch.py | 4 ++-- .../cloudwatch/test_cloudwatch.snapshot.json | 18 +++++++++--------- .../cloudwatch/test_cloudwatch.validation.json | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/aws/services/cloudwatch/test_cloudwatch.py b/tests/aws/services/cloudwatch/test_cloudwatch.py index 56573b7c92a80..2a9b6cf75ba2e 100644 --- a/tests/aws/services/cloudwatch/test_cloudwatch.py +++ b/tests/aws/services/cloudwatch/test_cloudwatch.py @@ -1319,7 +1319,7 @@ def test_put_metric_alarm( Namespace=namespace, ActionsEnabled=True, Period=30, - Threshold=2, + Threshold=21, Dimensions=dimension, Unit="Seconds", Statistic="Average", @@ -1339,7 +1339,7 @@ def test_put_metric_alarm( _sqs_messages_snapshot, retries=60, sleep=3 if is_aws_cloud() else 1, - sleep_before=5 if is_aws_cloud() else 0, + sleep_before=5 if is_aws_cloud() else 2, expected_state="ALARM", sqs_client=aws_client.sqs, sqs_queue=sqs_queue, diff --git a/tests/aws/services/cloudwatch/test_cloudwatch.snapshot.json b/tests/aws/services/cloudwatch/test_cloudwatch.snapshot.json index 6563131e1e53f..08d4ca59e7447 100644 --- a/tests/aws/services/cloudwatch/test_cloudwatch.snapshot.json +++ b/tests/aws/services/cloudwatch/test_cloudwatch.snapshot.json @@ -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": "08-05-2025, 16:09:45", "recorded-content": { "describe-alarm": { "CompositeAlarms": [], @@ -403,7 +403,7 @@ "StateUpdatedTimestamp": "timestamp", "StateValue": "INSUFFICIENT_DATA", "Statistic": "Average", - "Threshold": 2.0, + "Threshold": 21.0, "TreatMissingData": "ignore", "Unit": "Seconds" } @@ -423,7 +423,7 @@ "AlarmDescription": "testing cloudwatch alarms", "AlarmName": "", "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::sns::111111111111:" @@ -446,7 +446,7 @@ "Period": 30, "Statistic": "AVERAGE", "StatisticType": "Statistic", - "Threshold": 2.0, + "Threshold": 21.0, "TreatMissingData": "ignore", "Unit": "Seconds" } @@ -464,7 +464,7 @@ }, "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", @@ -475,7 +475,7 @@ "recentDatapoints": [ 21.5 ], - "threshold": 2.0, + "threshold": 21.0, "evaluatedDatapoints": [ { "timestamp": "date", @@ -522,7 +522,7 @@ "arn::sns::111111111111:" ], "Period": 30, - "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", @@ -533,7 +533,7 @@ "recentDatapoints": [ 21.5 ], - "threshold": 2.0, + "threshold": 21.0, "evaluatedDatapoints": [ { "timestamp": "date", @@ -546,7 +546,7 @@ "StateUpdatedTimestamp": "timestamp", "StateValue": "ALARM", "Statistic": "Average", - "Threshold": 2.0, + "Threshold": 21.0, "TreatMissingData": "ignore", "Unit": "Seconds" } diff --git a/tests/aws/services/cloudwatch/test_cloudwatch.validation.json b/tests/aws/services/cloudwatch/test_cloudwatch.validation.json index 35c96909b8d23..2e245aa4c5b7e 100644 --- a/tests/aws/services/cloudwatch/test_cloudwatch.validation.json +++ b/tests/aws/services/cloudwatch/test_cloudwatch.validation.json @@ -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-08T16:09:45+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" From 2443f167f53eb09f6e268fd0b46f0e42549739fc Mon Sep 17 00:00:00 2001 From: Cristopher Pinzon Date: Thu, 8 May 2025 13:00:41 -0500 Subject: [PATCH 2/6] extend seconds --- tests/aws/services/cloudwatch/test_cloudwatch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/aws/services/cloudwatch/test_cloudwatch.py b/tests/aws/services/cloudwatch/test_cloudwatch.py index 2a9b6cf75ba2e..43f7bbffc4e69 100644 --- a/tests/aws/services/cloudwatch/test_cloudwatch.py +++ b/tests/aws/services/cloudwatch/test_cloudwatch.py @@ -1338,8 +1338,8 @@ def test_put_metric_alarm( retry( _sqs_messages_snapshot, retries=60, - sleep=3 if is_aws_cloud() else 1, - sleep_before=5 if is_aws_cloud() else 2, + sleep=3, + sleep_before=5, expected_state="ALARM", sqs_client=aws_client.sqs, sqs_queue=sqs_queue, From 63f8577ed92b32c44284592d7d9e1dc242a9bd2b Mon Sep 17 00:00:00 2001 From: Cristopher Pinzon Date: Thu, 8 May 2025 13:55:18 -0500 Subject: [PATCH 3/6] trigger From 2031e0ae89dfebecebe6617326291b8b23ebe2eb Mon Sep 17 00:00:00 2001 From: Cristopher Pinzon Date: Fri, 9 May 2025 09:02:37 -0500 Subject: [PATCH 4/6] trigger From 57b9b0151cee5e66f8662bf1cbc9003153daed28 Mon Sep 17 00:00:00 2001 From: Misha Tiurin Date: Mon, 12 May 2025 18:23:25 +0200 Subject: [PATCH 5/6] Revert local sleep increase --- tests/aws/services/cloudwatch/test_cloudwatch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/aws/services/cloudwatch/test_cloudwatch.py b/tests/aws/services/cloudwatch/test_cloudwatch.py index 43f7bbffc4e69..81725fc30d044 100644 --- a/tests/aws/services/cloudwatch/test_cloudwatch.py +++ b/tests/aws/services/cloudwatch/test_cloudwatch.py @@ -1338,8 +1338,8 @@ def test_put_metric_alarm( retry( _sqs_messages_snapshot, retries=60, - sleep=3, - sleep_before=5, + sleep=3 if is_aws_cloud() else 1, + sleep_before=5 if is_aws_cloud() else 0, expected_state="ALARM", sqs_client=aws_client.sqs, sqs_queue=sqs_queue, From 9c95b14176d8023d66c6aabeff99e7f38cefe9ec Mon Sep 17 00:00:00 2001 From: Misha Tiurin Date: Mon, 12 May 2025 18:27:04 +0200 Subject: [PATCH 6/6] Reduce alarm evaluation period to 10 seconds --- tests/aws/services/cloudwatch/test_cloudwatch.py | 2 +- .../cloudwatch/test_cloudwatch.snapshot.json | 12 ++++++------ .../cloudwatch/test_cloudwatch.validation.json | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/aws/services/cloudwatch/test_cloudwatch.py b/tests/aws/services/cloudwatch/test_cloudwatch.py index 81725fc30d044..3cb2fbb9b73a5 100644 --- a/tests/aws/services/cloudwatch/test_cloudwatch.py +++ b/tests/aws/services/cloudwatch/test_cloudwatch.py @@ -1318,7 +1318,7 @@ def test_put_metric_alarm( MetricName=metric_name, Namespace=namespace, ActionsEnabled=True, - Period=30, + Period=10, Threshold=21, Dimensions=dimension, Unit="Seconds", diff --git a/tests/aws/services/cloudwatch/test_cloudwatch.snapshot.json b/tests/aws/services/cloudwatch/test_cloudwatch.snapshot.json index 08d4ca59e7447..87abfc826b4a8 100644 --- a/tests/aws/services/cloudwatch/test_cloudwatch.snapshot.json +++ b/tests/aws/services/cloudwatch/test_cloudwatch.snapshot.json @@ -369,7 +369,7 @@ } }, "tests/aws/services/cloudwatch/test_cloudwatch.py::TestCloudwatch::test_put_metric_alarm": { - "recorded-date": "08-05-2025, 16:09:45", + "recorded-date": "12-05-2025, 16:20:57", "recorded-content": { "describe-alarm": { "CompositeAlarms": [], @@ -397,7 +397,7 @@ "OKActions": [ "arn::sns::111111111111:" ], - "Period": 30, + "Period": 10, "StateReason": "Unchecked: Initial alarm creation", "StateTransitionedTimestamp": "timestamp", "StateUpdatedTimestamp": "timestamp", @@ -443,7 +443,7 @@ "EvaluationPeriods": 1, "MetricName": "my-metric1", "Namespace": "", - "Period": 30, + "Period": 10, "Statistic": "AVERAGE", "StatisticType": "Statistic", "Threshold": 21.0, @@ -471,7 +471,7 @@ "startDate": "date", "unit": "Seconds", "statistic": "Average", - "period": 30, + "period": 10, "recentDatapoints": [ 21.5 ], @@ -521,7 +521,7 @@ "OKActions": [ "arn::sns::111111111111:" ], - "Period": 30, + "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", @@ -529,7 +529,7 @@ "startDate": "date", "unit": "Seconds", "statistic": "Average", - "period": 30, + "period": 10, "recentDatapoints": [ 21.5 ], diff --git a/tests/aws/services/cloudwatch/test_cloudwatch.validation.json b/tests/aws/services/cloudwatch/test_cloudwatch.validation.json index 2e245aa4c5b7e..428f5d6c84b8f 100644 --- a/tests/aws/services/cloudwatch/test_cloudwatch.validation.json +++ b/tests/aws/services/cloudwatch/test_cloudwatch.validation.json @@ -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": "2025-05-08T16:09:45+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"