Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bug: SQA SqsManagedSseEnabled discrepancy with AWS #13539

@dmacvicar

Description

@dmacvicar

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

terraform-provider-aws/internal/service/sqs/queue_test.go::TestAccSQSQueue_encryption fails. It seems due to SqsManagedSseEnabled not being returned propery set once a KmsMasterKeyId is set.

>> match key: get-all-attributes-with-redrive-allow-and-kms
        (~) /Attributes/SqsManagedSseEnabled 'false' → 'true' ... (expected → actual)

        Ignore list (please keep in mind list indices might not work and should be replaced):
        ["$..Attributes.SqsManagedSseEnabled"]

Snapshot test:

   @markers.aws.validated
    def test_get_queue_attributes_round_trips_attributes_set_on_create(
        self, sqs_create_queue, aws_client, snapshot
    ):
        source_queue = sqs_create_queue(QueueName=f"queue-{short_uid()}")
        source_attrs = aws_client.sqs.get_queue_attributes(
            QueueUrl=source_queue, AttributeNames=["QueueArn"]
        )
        redrive_allow_policy = {
            "redrivePermission": "byQueue",
            "sourceQueueArns": [source_attrs["Attributes"]["QueueArn"]],
        }

        target_queue = sqs_create_queue(
            QueueName=f"queue-{short_uid()}",
            Attributes={
                "RedriveAllowPolicy": json.dumps(redrive_allow_policy),
                "KmsMasterKeyId": "alias/aws/sqs",
                "KmsDataKeyReusePeriodSeconds": "600",
            },
        )

        snapshot.add_transformer(
            snapshot.transform.regex(source_queue.split("/")[-1], "<source-queue-name>")
        )
        snapshot.add_transformer(
            snapshot.transform.regex(target_queue.split("/")[-1], "<target-queue-name>")
        )
        snapshot.add_transformer(
            snapshot.transform.regex(
                source_attrs["Attributes"]["QueueArn"],
                "arn:<partition>:sqs:<region>:<account-id>:<source-queue-name>",
            )
        )

        single_attribute = aws_client.sqs.get_queue_attributes(
            QueueUrl=target_queue, AttributeNames=["RedriveAllowPolicy"]
        )
        snapshot.match("get-redrive-allow-policy", single_attribute)

        all_attributes = aws_client.sqs.get_queue_attributes(
            QueueUrl=target_queue, AttributeNames=["All"]
        )
        snapshot.match("get-all-attributes-with-redrive-allow-and-kms", all_attributes)

Expected Behavior

Snapshot test to pass

How are you starting LocalStack?

From source.

Steps To Reproduce

  1. Run python -m pytest -vvv terraform-provider-aws/internal/service/sqs/queue_test.go::TestAccSQSQueue_encryption in terraform testsuite
  2. Run above snapsthot test

Metadata

Metadata

Assignees

No one assigned

    Labels

    aws:sqsAmazon Simple Queue Servicestatus: backlogTriaged but not yet being worked ontype: bugBug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions