Skip to content

Conversation

bnusunny
Copy link
Contributor

@bnusunny bnusunny commented Sep 9, 2025

Description of changes

fix(integration): resolve stack cleanup issues in connector tests

  • Remove @retry_once decorators from test methods to preserve unittest lifecycle
  • Implement separate verification methods with robust retry logic using tenacity
  • Apply repository-standard retry configuration (5 attempts, exponential backoff + jitter)
  • Ensure tearDown() always executes for proper CloudFormation stack cleanup
  • Fix inconsistent stack removal in connector_httpapi_to_function.yaml tests

This resolves the issue where failed test retries prevented tearDown() execution, leaving orphaned stacks in CREATE_COMPLETE state while only successful retry stacks were cleaned up.

Checklist

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

- Remove @retry_once decorators from test methods to preserve unittest lifecycle
- Implement separate verification methods with robust retry logic using tenacity
- Apply repository-standard retry configuration (5 attempts, exponential backoff + jitter)
- Ensure tearDown() always executes for proper CloudFormation stack cleanup
- Fix inconsistent stack removal in connector_httpapi_to_function.yaml tests

This resolves the issue where failed test retries prevented tearDown() execution,
leaving orphaned stacks in CREATE_COMPLETE state while only successful retry
stacks were cleaned up.

Files modified:
- integration/combination/test_connectors.py
- integration/combination/test_connectors_event_rule_eb.py
@bnusunny bnusunny requested a review from a team as a code owner September 9, 2025 18:53
Run `make format` to ensure code style compliance per development guide.
Copy link
Contributor

@reedham-aws reedham-aws left a comment

Choose a reason for hiding this comment

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

Actual changes LGTM, I don't follow how the changes to retry with backoff fixes the issue of the inconsistent stack removal. Would you mind explaining that?

@bnusunny
Copy link
Contributor Author

bnusunny commented Sep 9, 2025

The problem was in the connector integration tests where @retry_once decorators were applied directly to test methods. When the first test attempt failed, the retry mechanism would run the test again (and create a second stack), but the unit test framework's tearDown() method would only execute after the final attempt. This meant:

  1. First attempt fails → the first stack remains
  2. Second attempt succeeds → only the second stack gets cleaned up
  3. First stack becomes orphaned

@reedham-aws
Copy link
Contributor

Ah, so refactoring the retry decorator to a separate method will allow the tearDown() to run on every created stack created under the top level test, successful or not?

@bnusunny
Copy link
Contributor Author

bnusunny commented Sep 9, 2025

Yes.

Ah, so refactoring the retry decorator to a separate method will allow the tearDown() to run on every created stack created under the top level test, successful or not?

@bnusunny bnusunny merged commit 1fa4461 into aws:develop Sep 9, 2025
7 checks passed
@bnusunny bnusunny deleted the fix_connector_tests branch September 10, 2025 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants