Skip to content

Events: add classmethod to recreate services #12566

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

Merged
merged 3 commits into from
May 6, 2025
Merged

Conversation

bentsku
Copy link
Contributor

@bentsku bentsku commented Apr 29, 2025

Motivation

Following some issues to recreate internal services that hold state as those are re-creating their own ID every time you re-instantiate them, leading to issue in the persistence mechanism.

These class methods allow to recreate them and override the internal state they set.

Changes

  • add 2 class methods to recreate internal services for Events

@bentsku bentsku added aws:events Amazon EventBridge semver: patch Non-breaking changes which can be included in patch releases labels Apr 29, 2025
@bentsku bentsku added this to the 4.4 milestone Apr 29, 2025
@bentsku bentsku self-assigned this Apr 29, 2025
@bentsku bentsku marked this pull request as ready for review April 29, 2025 23:15
@bentsku bentsku requested a review from maxhoheiser as a code owner April 29, 2025 23:15
Copy link

github-actions bot commented Apr 29, 2025

LocalStack Community integration with Pro

    2 files  ±    0      2 suites  ±0   58m 7s ⏱️ - 43m 58s
2 551 tests  - 1 848  2 449 ✅  - 1 588  102 💤  - 260  0 ❌ ±0 
2 553 runs   - 1 848  2 449 ✅  - 1 588  104 💤  - 260  0 ❌ ±0 

Results for commit e74736b. ± Comparison against base commit 1b1d7cd.

This pull request removes 1848 tests.
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]
…

♻️ This comment has been updated with latest results.

Copy link
Member

@maxhoheiser maxhoheiser left a comment

Choose a reason for hiding this comment

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

LGTMT - nice way to recreate / restore the destination from an existing one

secret_arn = self.create_connection_secret(
region, account_id, name, authorization_type, auth_parameters
)

Copy link
Member

Choose a reason for hiding this comment

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

very nice way to decouple secret creation from api connection creation

@@ -64,6 +64,23 @@ def __init__(
description,
)

@classmethod
def from_api_destination_and_connection(
Copy link
Member

Choose a reason for hiding this comment

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

nit: should e maybe name it create_... or restore_... to make it more clear?

@@ -52,6 +56,19 @@ def __init__(
invocation_connectivity_parameters,
)

@classmethod
def from_connection(cls, connection: Connection):
Copy link
Member

Choose a reason for hiding this comment

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

same as above: nit: should e maybe name it create_... or restore_... to make it more clear?

@bentsku bentsku force-pushed the fix-events-persistence branch from d47e787 to e74736b Compare May 6, 2025 11:40
@bentsku bentsku merged commit 5df40f1 into master May 6, 2025
32 checks passed
@bentsku bentsku deleted the fix-events-persistence branch May 6, 2025 14:39
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