Skip to content

Conversation

bentsku
Copy link
Contributor

@bentsku bentsku commented Dec 5, 2024

Motivation

As reported in #11992, there might have been issue with the new engine rule engine.

I could only reproduce the test_dynamodb_event_filter[numeric_filter] failure, which was due to our bad handling of numeric logic with string values.

While validating the fix and the handling of the new EventRuleEngine for test_sqs_event_filter[this is a test string], the behavior was right, but the validation for TestEventPattern was wrong.

I've also validated that test_dynamodb_event_filter[numeric_filter] now works with the fix 👍

Then, when validating the DynamoDB fix, I've tried to copy-paste the input event from ESM, but it failed when calling TestEventPattern because the event was not following the right format, so I've added it in the provider to also validate this, as specified by the documentation here: https://docs.aws.amazon.com/eventbridge/latest/APIReference/API_TestEventPattern.html (note, the resources field is not mandatory in reality).

Changes

  • fix the handling of numeric if the value is a string (or more like the value is not a numeric value)
  • fix the validation of the TestEventPattern provider operation
  • add test cases to cover the numeric fix, and the provider validation

@bentsku bentsku added aws:events Amazon EventBridge semver: patch Non-breaking changes which can be included in patch releases labels Dec 5, 2024
@bentsku bentsku added this to the 4.1 milestone Dec 5, 2024
@bentsku bentsku self-assigned this Dec 5, 2024
@bentsku bentsku marked this pull request as ready for review December 5, 2024 18:01
@bentsku bentsku mentioned this pull request Dec 5, 2024
4 tasks
Copy link

github-actions bot commented Dec 5, 2024

LocalStack Community integration with Pro

    2 files  ±    0      2 suites  ±0   1h 9m 14s ⏱️ - 40m 25s
2 291 tests  - 1 539  2 189 ✅  - 1 323  102 💤  - 216  0 ❌ ±0 
2 293 runs   - 1 539  2 189 ✅  - 1 323  104 💤  - 216  0 ❌ ±0 

Results for commit 68a699b. ± Comparison against base commit 6df4dbc.

This pull request removes 1547 and adds 8 tests. Note that renamed tests count towards both.
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_lambda_dynamodb
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_opensearch_crud
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_search_books
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_setup
tests.aws.scenario.kinesis_firehose.test_kinesis_firehose.TestKinesisFirehoseScenario ‑ test_kinesis_firehose_s3
tests.aws.scenario.lambda_destination.test_lambda_destination_scenario.TestLambdaDestinationScenario ‑ test_destination_sns
tests.aws.scenario.lambda_destination.test_lambda_destination_scenario.TestLambdaDestinationScenario ‑ test_infra
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_prefill_dynamodb_table
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input0-SUCCEEDED]
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input1-SUCCEEDED]
…
tests.aws.services.events.test_events_patterns.TestEventPattern ‑ test_array_event_payload
tests.aws.services.events.test_events_patterns.TestEventPattern ‑ test_event_pattern[numeric-int-float]
tests.aws.services.events.test_events_patterns.TestEventPattern ‑ test_event_pattern[numeric-null_NEG]
tests.aws.services.events.test_events_patterns.TestEventPattern ‑ test_event_pattern[numeric-string_NEG]
tests.aws.services.events.test_events_patterns.TestEventPattern ‑ test_event_pattern[or-numeric-anything-but]
tests.aws.services.events.test_events_patterns.TestEventPattern ‑ test_event_pattern[or-numeric-anything-but_NEG]
tests.aws.services.events.test_events_patterns.TestEventPattern ‑ test_invalid_event_payload
tests.aws.services.events.test_events_patterns.TestEventPattern ‑ test_plain_string_payload

♻️ This comment has been updated with latest results.

Copy link
Member

@joe4dev joe4dev left a comment

Choose a reason for hiding this comment

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

Wow, amazing edge case coverage ✨ 💯

@bentsku bentsku merged commit 75ddcb6 into master Dec 9, 2024
31 checks passed
@bentsku bentsku deleted the fix-events-engine branch December 9, 2024 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws:events Amazon EventBridge semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants