Skip to content
GitHub Actions / Test Results (amd64) - Integration, Bootstrap failed Sep 29, 2025 in 0s

1 fail, 496 skipped, 4 669 pass in 2h 39m 55s

    5 files  ±  0      5 suites  ±0   2h 39m 55s ⏱️ + 3m 34s
5 166 tests +125  4 669 ✅ +110  496 💤 +14  1 ❌ +1 
5 172 runs  +125  4 669 ✅ +110  502 💤 +14  1 ❌ +1 

Results for commit 80a5dea. ± Comparison against earlier commit 84d5a17.

Annotations

Check warning on line 0 in tests.aws.services.cloudwatch.test_cloudwatch.TestCloudwatch

See this annotation in the file changed.

@github-actions github-actions / Test Results (amd64) - Integration, Bootstrap

test_put_metric_alarm[query] (tests.aws.services.cloudwatch.test_cloudwatch.TestCloudwatch) failed

test-results-integration-amd64-1/pytest-junit-integration-amd64-1.xml [took 1m 2s]
Raw output
AssertionError: no message found for ALARM. Got 1 messages.
  {"Messages": [{"MessageId": "170e29bc-bbe3-45c7-9bdf-56fc3d094880", "ReceiptHandle": "ZGM0ZThhMWYtY2JhMS00YjY0LWIzMWItMWY0NThlYzlmNjA3IGFybjphd3M6c3FzOnVzLWVhc3QtMTowMDAwMDAwMDAwMDA6dGVzdC1xdWV1ZS00ZjQxY2NjNyAxNzBlMjliYy1iYmUzLTQ1YzctOWJkZi01NmZjM2QwOTQ4ODAgMTc1OTE3Mjk4NC4wNzI1Nzk5", "MD5OfBody": "71f19f4111a4511cc2186046ae7cc943", "Body": "{\"Type\": \"Notification\", \"MessageId\": \"c140ee15-53ae-4849-85f8-25c510b8c355\", \"TopicArn\": \"arn:aws:sns:us-east-1:000000000000:test-topic-3bbe25ed\", \"Message\": \"{\\\"AWSAccountId\\\": \\\"000000000000\\\", \\\"OldStateValue\\\": \\\"INSUFFICIENT_DATA\\\", \\\"AlarmName\\\": \\\"test-alarm-b02950eb\\\", \\\"AlarmDescription\\\": \\\"testing cloudwatch alarms\\\", \\\"AlarmConfigurationUpdatedTimestamp\\\": \\\"2025-09-29T19:08:42.990Z\\\", \\\"NewStateValue\\\": \\\"OK\\\", \\\"NewStateReason\\\": \\\"Threshold Crossed\\\", \\\"StateChangeTime\\\": \\\"2025-09-29T19:08:43.088Z\\\", \\\"Region\\\": \\\"Us east 1\\\", \\\"AlarmArn\\\": \\\"arn:aws:cloudwatch:us-east-1:000000000000:alarm:test-alarm-b02950eb\\\", \\\"OKActions\\\": [\\\"arn:aws:sns:us-east-1:000000000000:test-topic-3bbe25ed\\\"], \\\"AlarmActions\\\": [\\\"arn:aws:sns:us-east-1:000000000000:test-topic-3bbe25ed\\\"], \\\"InsufficientDataActions\\\": [], \\\"Trigger\\\": {\\\"MetricName\\\": \\\"my-metric1\\\", \\\"Namespace\\\": \\\"test-nsp-58c21e4a\\\", \\\"Unit\\\": \\\"Seconds\\\", \\\"Period\\\": 10, \\\"EvaluationPeriods\\\": 1, \\\"ComparisonOperator\\\": \\\"GreaterThanThreshold\\\", \\\"Threshold\\\": 21.0, \\\"TreatMissingData\\\": \\\"ignore\\\", \\\"EvaluateLowSampleCountPercentile\\\": \\\"\\\", \\\"Dimensions\\\": [{\\\"value\\\": \\\"abc\\\", \\\"name\\\": \\\"InstanceId\\\"}], \\\"StatisticType\\\": \\\"Statistic\\\", \\\"Statistic\\\": \\\"AVERAGE\\\"}}\", \"Timestamp\": \"2025-09-29T19:08:43.096Z\", \"UnsubscribeURL\": \"http://localhost.localstack.cloud:4566/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:000000000000:test-topic-3bbe25ed:d39484d7-1e55-443a-8908-58235d5bb2e5\", \"Subject\": \"OK: \\\"test-alarm-b02950eb\\\" in us-east-1\", \"SignatureVersion\": \"1\", \"Signature\": \"K6CW8lD9LXNgFQkZammoWQNtxCaDkqcDqAYvpTUcetWO3oCb70facY1m8fcDaI5kMG+Vhgq1blNSJWAt+z3iD0BvKuil1YPhwVfPDEIFzPHZDVqZCCTXxB9UCqoHHCljPelDB4UeRg97Ne4w2E988wmTmVTcvjMDS6k6V7ny88RNuFx3vxOX3TnGBGtnlgPfK2wKMjIJbjOxQLOyujLOqRXHClFlXKpzJdPqgU70lTQzkNuz0DyOB0K7IqAvaOpVKMIeN7USAFb8oVHhRqbFJc8+CQWMNP/+qNu7Xd0Ew1/iL5FaWf9fkWPE7+kMbGPqwye6BHMarUMt/18UKBLa3A==\", \"SigningCertURL\": \"http://localhost.localstack.cloud:4566/_aws/sns/SimpleNotificationService-6c6f63616c737461636b69736e696365.pem\"}"}], "ResponseMetadata": {"RequestId": "28dfef32-ef54-4f49-8441-0c00e9d7b2df", "HTTPStatusCode": 200, "HTTPHeaders": {"server": "TwistedWeb/24.3.0", "date": "Mon, 29 Sep 2025 19:09:44 GMT", "content-type": "application/x-amz-json-1.0", "content-length": "2648", "x-amzn-requestid": "28dfef32-ef54-4f49-8441-0c00e9d7b2df", "x-localstack": "true"}, "RetryAttempts": 0}}
assert None
self = <tests.aws.services.cloudwatch.test_cloudwatch.TestCloudwatch object at 0x7fcb86ef2d50>
sns_create_topic = <function sns_create_topic.<locals>._create_topic at 0x7fca1b12aca0>
sqs_queue = 'http://sqs.us-east-1.localhost.localstack.cloud:4566/000000000000/test-queue-4f41ccc7'
snapshot = <localstack_snapshot.snapshots.prototype.SnapshotSession object at 0x7fca1be8a390>
aws_client = <localstack.aws.connect.ServiceLevelClientFactory object at 0x7fcb8473c1a0>
cleanups = [<function TestCloudwatch.test_put_metric_alarm.<locals>.<lambda> at 0x7fca1cb08360>]
sns_create_sqs_subscription = <function sns_create_sqs_subscription.<locals>._factory at 0x7fc9a2494720>
aws_cloudwatch_client = <botocore.client.CloudWatch object at 0x7fca3b4d5d30>

    @markers.aws.validated
    @markers.snapshot.skip_snapshot_verify(
        paths=[
            "$..AlarmHistoryItems..HistoryData.newState.stateReason",
            "$..AlarmHistoryItems..HistoryData.newState.stateReasonData.evaluatedDatapoints",
            "$..NewStateReason",
            "$..describe-alarms-for-metric..StateReason",  # reason contains datapoint + date
            "$..describe-alarms-for-metric..StateReasonData.evaluatedDatapoints",
        ]
    )
    @pytest.mark.skipif(
        condition=is_old_provider(), reason="DescribeAlarmHistory is not implemented"
    )
    def test_put_metric_alarm(
        self,
        sns_create_topic,
        sqs_queue,
        snapshot,
        aws_client,
        cleanups,
        sns_create_sqs_subscription,
        aws_cloudwatch_client,
    ):
        topic_arn_alarm = sns_create_topic()["TopicArn"]
    
        snapshot.add_transformer(snapshot.transform.cloudwatch_api())
        snapshot.add_transformer(
            snapshot.transform.regex(topic_arn_alarm.split(":")[-1], "<topic_arn>"), priority=2
        )
        snapshot.add_transformer(
            # regex to transform date-pattern, e.g. (03/01/24 11:36:00)
            snapshot.transform.regex(
                r"\(\d{2}\/\d{2}\/\d{2}\ \d{2}:\d{2}:\d{2}\)", "(MM/DD/YY HH:MM:SS)"
            )
        )
        # as we add metrics, we use a unique namespace to ensure the test runs on AWS
        namespace = f"test-nsp-{short_uid()}"
        snapshot.add_transformer(snapshot.transform.regex(namespace, "<metric-namespace>"))
    
        metric_name = "my-metric1"
        dimension = [{"Name": "InstanceId", "Value": "abc"}]
        alarm_name = f"test-alarm-{short_uid()}"
    
        sns_create_sqs_subscription(
            topic_arn=topic_arn_alarm,
            queue_url=sqs_queue,
        )
    
        data = [
            {
                "MetricName": metric_name,
                "Dimensions": dimension,
                "Value": 21,
                "Timestamp": datetime.now(tz=UTC),
                "Unit": "Seconds",
            },
            {
                "MetricName": metric_name,
                "Dimensions": dimension,
                "Value": 22,
                "Timestamp": datetime.now(tz=UTC),
                "Unit": "Seconds",
            },
        ]
    
        # create alarm with action for "ALARM"
        aws_cloudwatch_client.put_metric_alarm(
            AlarmName=alarm_name,
            AlarmDescription="testing cloudwatch alarms",
            MetricName=metric_name,
            Namespace=namespace,
            ActionsEnabled=True,
            Period=10,
            Threshold=21,
            Dimensions=dimension,
            Unit="Seconds",
            Statistic="Average",
            OKActions=[topic_arn_alarm],
            AlarmActions=[topic_arn_alarm],
            EvaluationPeriods=1,
            ComparisonOperator="GreaterThanThreshold",
            TreatMissingData="ignore",
            # notBreaching had some downsides, as depending on the alarm evaluation interval it would first go into OK
        )
        cleanups.append(lambda: aws_cloudwatch_client.delete_alarms(AlarmNames=[alarm_name]))
        response = aws_cloudwatch_client.describe_alarms(AlarmNames=[alarm_name])
        snapshot.match("describe-alarm", response)
    
        aws_cloudwatch_client.put_metric_data(Namespace=namespace, MetricData=data)
>       retry(
            _sqs_messages_snapshot,
            retries=60,
            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,
            snapshot=snapshot,
            identifier="alarm-triggered",
        )

tests/aws/services/cloudwatch/test_cloudwatch.py:1318: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
localstack-core/localstack/utils/sync.py:63: in retry
    raise raise_error
localstack-core/localstack/utils/sync.py:59: in retry
    return function(**kwargs)
           ^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expected_state = 'ALARM'
sqs_client = <localstack.aws.connect.MetadataRequestInjector object at 0x7fc980357d10>
sqs_queue = 'http://sqs.us-east-1.localhost.localstack.cloud:4566/000000000000/test-queue-4f41ccc7'
snapshot = <localstack_snapshot.snapshots.prototype.SnapshotSession object at 0x7fca1be8a390>
identifier = 'alarm-triggered'

    def _sqs_messages_snapshot(expected_state, sqs_client, sqs_queue, snapshot, identifier):
        result = sqs_client.receive_message(QueueUrl=sqs_queue, WaitTimeSeconds=2, VisibilityTimeout=0)
        found_msg = None
        receipt_handle = None
        for msg in result["Messages"]:
            body = json.loads(msg["Body"])
            message = json.loads(body["Message"])
            if message["NewStateValue"] == expected_state:
                found_msg = message
                receipt_handle = msg["ReceiptHandle"]
                break
>       assert found_msg, (
            f"no message found for {expected_state}. Got {len(result['Messages'])} messages.\n{json.dumps(result)}"
        )
E       AssertionError: no message found for ALARM. Got 1 messages.
E         {"Messages": [{"MessageId": "170e29bc-bbe3-45c7-9bdf-56fc3d094880", "ReceiptHandle": "ZGM0ZThhMWYtY2JhMS00YjY0LWIzMWItMWY0NThlYzlmNjA3IGFybjphd3M6c3FzOnVzLWVhc3QtMTowMDAwMDAwMDAwMDA6dGVzdC1xdWV1ZS00ZjQxY2NjNyAxNzBlMjliYy1iYmUzLTQ1YzctOWJkZi01NmZjM2QwOTQ4ODAgMTc1OTE3Mjk4NC4wNzI1Nzk5", "MD5OfBody": "71f19f4111a4511cc2186046ae7cc943", "Body": "{\"Type\": \"Notification\", \"MessageId\": \"c140ee15-53ae-4849-85f8-25c510b8c355\", \"TopicArn\": \"arn:aws:sns:us-east-1:000000000000:test-topic-3bbe25ed\", \"Message\": \"{\\\"AWSAccountId\\\": \\\"000000000000\\\", \\\"OldStateValue\\\": \\\"INSUFFICIENT_DATA\\\", \\\"AlarmName\\\": \\\"test-alarm-b02950eb\\\", \\\"AlarmDescription\\\": \\\"testing cloudwatch alarms\\\", \\\"AlarmConfigurationUpdatedTimestamp\\\": \\\"2025-09-29T19:08:42.990Z\\\", \\\"NewStateValue\\\": \\\"OK\\\", \\\"NewStateReason\\\": \\\"Threshold Crossed\\\", \\\"StateChangeTime\\\": \\\"2025-09-29T19:08:43.088Z\\\", \\\"Region\\\": \\\"Us east 1\\\", \\\"AlarmArn\\\": \\\"arn:aws:cloudwatch:us-east-1:000000000000:alarm:test-alarm-b02950eb\\\", \\\"OKActions\\\": [\\\"arn:aws:sns:us-east-1:000000000000:test-topic-3bbe25ed\\\"], \\\"AlarmActions\\\": [\\\"arn:aws:sns:us-east-1:000000000000:test-topic-3bbe25ed\\\"], \\\"InsufficientDataActions\\\": [], \\\"Trigger\\\": {\\\"MetricName\\\": \\\"my-metric1\\\", \\\"Namespace\\\": \\\"test-nsp-58c21e4a\\\", \\\"Unit\\\": \\\"Seconds\\\", \\\"Period\\\": 10, \\\"EvaluationPeriods\\\": 1, \\\"ComparisonOperator\\\": \\\"GreaterThanThreshold\\\", \\\"Threshold\\\": 21.0, \\\"TreatMissingData\\\": \\\"ignore\\\", \\\"EvaluateLowSampleCountPercentile\\\": \\\"\\\", \\\"Dimensions\\\": [{\\\"value\\\": \\\"abc\\\", \\\"name\\\": \\\"InstanceId\\\"}], \\\"StatisticType\\\": \\\"Statistic\\\", \\\"Statistic\\\": \\\"AVERAGE\\\"}}\", \"Timestamp\": \"2025-09-29T19:08:43.096Z\", \"UnsubscribeURL\": \"http://localhost.localstack.cloud:4566/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:000000000000:test-topic-3bbe25ed:d39484d7-1e55-443a-8908-58235d5bb2e5\", \"Subject\": \"OK: \\\"test-alarm-b02950eb\\\" in us-east-1\", \"SignatureVersion\": \"1\", \"Signature\": \"K6CW8lD9LXNgFQkZammoWQNtxCaDkqcDqAYvpTUcetWO3oCb70facY1m8fcDaI5kMG+Vhgq1blNSJWAt+z3iD0BvKuil1YPhwVfPDEIFzPHZDVqZCCTXxB9UCqoHHCljPelDB4UeRg97Ne4w2E988wmTmVTcvjMDS6k6V7ny88RNuFx3vxOX3TnGBGtnlgPfK2wKMjIJbjOxQLOyujLOqRXHClFlXKpzJdPqgU70lTQzkNuz0DyOB0K7IqAvaOpVKMIeN7USAFb8oVHhRqbFJc8+CQWMNP/+qNu7Xd0Ew1/iL5FaWf9fkWPE7+kMbGPqwye6BHMarUMt/18UKBLa3A==\", \"SigningCertURL\": \"http://localhost.localstack.cloud:4566/_aws/sns/SimpleNotificationService-6c6f63616c737461636b69736e696365.pem\"}"}], "ResponseMetadata": {"RequestId": "28dfef32-ef54-4f49-8441-0c00e9d7b2df", "HTTPStatusCode": 200, "HTTPHeaders": {"server": "TwistedWeb/24.3.0", "date": "Mon, 29 Sep 2025 19:09:44 GMT", "content-type": "application/x-amz-json-1.0", "content-length": "2648", "x-amzn-requestid": "28dfef32-ef54-4f49-8441-0c00e9d7b2df", "x-localstack": "true"}, "RetryAttempts": 0}}
E       assert None

tests/aws/services/cloudwatch/test_cloudwatch.py:3108: AssertionError