Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow asterisk only wild card #8572

Merged
merged 2 commits into from Aug 1, 2023
Merged

Conversation

fatal10110
Copy link
Contributor

@fatal10110 fatal10110 commented Jun 26, 2023

closes #8566

Just a small note, according to the docs
https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ReceiveMessage.html#SQS-ReceiveMessage-request-MessageAttributeNames

only All and .* are allowed as wild card, but actually it also supports * (as described in the issue)

Copy link
Collaborator

@localstack-bot localstack-bot left a comment

Choose a reason for hiding this comment

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

Welcome to LocalStack! Thanks for raising your first Pull Request and landing in your contributions. Our team will reach out with any reviews or feedbacks that we have shortly. We recommend joining our Slack Community and share your PR on the #community channel to share your contributions with us. Please make sure you are following our contributing guidelines and our Code of Conduct.

@localstack-bot
Copy link
Collaborator

localstack-bot commented Jun 26, 2023

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@fatal10110
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@baermat baermat added the semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases label Jul 6, 2023
@baermat
Copy link
Member

baermat commented Jul 7, 2023

Hi @fatal10110 , thank you for the contribution, and sorry for the delay!
This looks good, we only need to fix the failing tests. This is caused by the modified test not matching our snapshot, which is fixable, but requires running the test against live AWS once and can be a bit daunting the first time. All details for how our parity tests work can be found here.
Alternatively, you can simply copy paste the necessary changes into the json directly. I took the liberty of capturing the necessary snapshot if you prefer it this way.

Steps for direct copying:

  1. Find https://github.com/localstack/localstack/blob/master/tests/integration/test_sqs.snapshot.json locally.
  2. Exchange the whole item for "tests/integration/test_sqs.py::TestSqsProvider::test_receive_message_message_attribute_names_filters" with the following code:
"tests/integration/test_sqs.py::TestSqsProvider::test_receive_message_message_attribute_names_filters": {
    "recorded-date": "06-07-2023, 11:20:02",
    "recorded-content": {
      "send_message_response": {
        "MD5OfMessageAttributes": "4c360f3fdafd970e05fae2f149d997f5",
        "MD5OfMessageBody": "6e2baaf3b97dbeef01c0043275f9a0e7",
        "MessageId": "<uuid:1>",
        "ResponseMetadata": {
          "HTTPHeaders": {},
          "HTTPStatusCode": 200
        }
      },
      "empty_filter": {
        "Messages": [
          {
            "Body": "msg",
            "MD5OfBody": "6e2baaf3b97dbeef01c0043275f9a0e7",
            "MessageId": "<uuid:1>",
            "ReceiptHandle": "<receipt-handle:1>"
          }
        ],
        "ResponseMetadata": {
          "HTTPHeaders": {},
          "HTTPStatusCode": 200
        }
      },
      "all_name": {
        "Messages": [
          {
            "Body": "msg",
            "MD5OfBody": "6e2baaf3b97dbeef01c0043275f9a0e7",
            "MD5OfMessageAttributes": "4c360f3fdafd970e05fae2f149d997f5",
            "MessageAttributes": {
              "General": {
                "DataType": "String",
                "StringValue": "Kenobi"
              },
              "Hello": {
                "DataType": "String",
                "StringValue": "There"
              },
              "Help.Me": {
                "DataType": "String",
                "StringValue": "Me"
              }
            },
            "MessageId": "<uuid:1>",
            "ReceiptHandle": "<receipt-handle:2>"
          }
        ],
        "ResponseMetadata": {
          "HTTPHeaders": {},
          "HTTPStatusCode": 200
        }
      },
      "all_wildcard_asterisk": {
        "Body": "msg",
        "MD5OfBody": "6e2baaf3b97dbeef01c0043275f9a0e7",
        "MD5OfMessageAttributes": "4c360f3fdafd970e05fae2f149d997f5",
        "MessageAttributes": {
          "General": {
            "DataType": "String",
            "StringValue": "Kenobi"
          },
          "Hello": {
            "DataType": "String",
            "StringValue": "There"
          },
          "Help.Me": {
            "DataType": "String",
            "StringValue": "Me"
          }
        },
        "MessageId": "<uuid:1>",
        "ReceiptHandle": "<receipt-handle:3>"
      },
      "all_wildcard": {
        "Body": "msg",
        "MD5OfBody": "6e2baaf3b97dbeef01c0043275f9a0e7",
        "MD5OfMessageAttributes": "4c360f3fdafd970e05fae2f149d997f5",
        "MessageAttributes": {
          "General": {
            "DataType": "String",
            "StringValue": "Kenobi"
          },
          "Hello": {
            "DataType": "String",
            "StringValue": "There"
          },
          "Help.Me": {
            "DataType": "String",
            "StringValue": "Me"
          }
        },
        "MessageId": "<uuid:1>",
        "ReceiptHandle": "<receipt-handle:4>"
      },
      "only_non_existing_names": {
        "Body": "msg",
        "MD5OfBody": "6e2baaf3b97dbeef01c0043275f9a0e7",
        "MessageId": "<uuid:1>",
        "ReceiptHandle": "<receipt-handle:5>"
      },
      "only_existing": {
        "Body": "msg",
        "MD5OfBody": "6e2baaf3b97dbeef01c0043275f9a0e7",
        "MD5OfMessageAttributes": "fca026605781cb4126a1e9044df24232",
        "MessageAttributes": {
          "General": {
            "DataType": "String",
            "StringValue": "Kenobi"
          },
          "Hello": {
            "DataType": "String",
            "StringValue": "There"
          }
        },
        "MessageId": "<uuid:1>",
        "ReceiptHandle": "<receipt-handle:6>"
      },
      "existing_and_non_existing": {
        "Body": "msg",
        "MD5OfBody": "6e2baaf3b97dbeef01c0043275f9a0e7",
        "MD5OfMessageAttributes": "a311262e065454b75da111d535b8dacd",
        "MessageAttributes": {
          "Hello": {
            "DataType": "String",
            "StringValue": "There"
          }
        },
        "MessageId": "<uuid:1>",
        "ReceiptHandle": "<receipt-handle:7>"
      },
      "prefix_filter": {
        "Body": "msg",
        "MD5OfBody": "6e2baaf3b97dbeef01c0043275f9a0e7",
        "MD5OfMessageAttributes": "83fee93c1bcd8b9a5a923ffacdc636c7",
        "MessageAttributes": {
          "Hello": {
            "DataType": "String",
            "StringValue": "There"
          },
          "Help.Me": {
            "DataType": "String",
            "StringValue": "Me"
          }
        },
        "MessageId": "<uuid:1>",
        "ReceiptHandle": "<receipt-handle:8>"
      },
      "illegal_name_1": {
        "Messages": [
          {
            "Body": "msg",
            "MD5OfBody": "6e2baaf3b97dbeef01c0043275f9a0e7",
            "MessageId": "<uuid:1>",
            "ReceiptHandle": "<receipt-handle:9>"
          }
        ],
        "ResponseMetadata": {
          "HTTPHeaders": {},
          "HTTPStatusCode": 200
        }
      },
      "illegal_name_2": {
        "Messages": [
          {
            "Body": "msg",
            "MD5OfBody": "6e2baaf3b97dbeef01c0043275f9a0e7",
            "MessageId": "<uuid:1>",
            "ReceiptHandle": "<receipt-handle:10>"
          }
        ],
        "ResponseMetadata": {
          "HTTPHeaders": {},
          "HTTPStatusCode": 200
        }
      }
    }
  },
  
  1. Run the test locally to confirm that no errors happened during the transferal of the data.
    If you have any questions or need help, please let me know!

@baermat
Copy link
Member

baermat commented Aug 1, 2023

I took the liberty of pushing the change. Thank you again for your contribution!

@baermat baermat merged commit 6b55391 into localstack:master Aug 1, 2023
19 of 23 checks passed
viren-nadkarni pushed a commit that referenced this pull request Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: MessageAttributes inconsistency on SQS Receive message
3 participants