Skip to content

fix: make retry examples using seeded random#96

Merged
yaythomas merged 1 commit into
mainfrom
fix_flaky_tests
Nov 12, 2025
Merged

fix: make retry examples using seeded random#96
yaythomas merged 1 commit into
mainfrom
fix_flaky_tests

Conversation

@vip-amzn

@vip-amzn vip-amzn commented Nov 4, 2025

Copy link
Copy Markdown
Contributor

Issue #, if available:
closes #93
Changes:

  1. step_with_retry.py:
    With counter-based deterministic behavior:

    • Attempt 1: counter = 1 < 2 → raises RuntimeError ❌
    • Attempt 2: counter = 2 >= 2 → succeeds ✓
  2. steps_with_retry.py:
    With counter-based deterministic behavior:

    • Poll 1, Attempt 1: counter = 1 → raises RuntimeError ❌
    • Poll 1, Attempt 2: counter = 2 → returns None
    • Poll 2, Attempt 1: counter = 3 → returns item ✓

Dependencies

If this PR requires testing against a specific branch of the Python Language SDK (e.g., for unreleased changes), uncomment and specify the branch below. Otherwise, leave commented to use the main branch.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@vip-amzn vip-amzn changed the title fix: make retry examples deterministic using seeded random fix: make retry examples using seeded random Nov 4, 2025
@vip-amzn vip-amzn closed this Nov 4, 2025
@vip-amzn vip-amzn reopened this Nov 4, 2025
rarepolz
rarepolz previously approved these changes Nov 4, 2025
Comment thread examples/src/step_with_retry.py Outdated
yaythomas
yaythomas previously approved these changes Nov 5, 2025
@vip-amzn vip-amzn force-pushed the fix_flaky_tests branch 7 times, most recently from 81648e3 to ba83c86 Compare November 5, 2025 11:09
@vip-amzn vip-amzn requested a review from yaythomas November 5, 2025 15:51
Comment thread src/aws_durable_execution_sdk_python_testing/checkpoint/processors/step.py Outdated
Comment thread src/aws_durable_execution_sdk_python_testing/checkpoint/processors/step.py Outdated
Comment thread examples/src/step/step_with_retry.py Outdated
Comment thread examples/src/step/steps_with_retry.py Outdated
Comment thread examples/test/step/test_step_with_retry.py
ghost
ghost previously requested changes Nov 6, 2025
Comment thread examples/test/step/test_steps_with_retry.py Outdated
@vip-amzn vip-amzn requested a review from yaythomas November 10, 2025 18:15
@wangyb-A

Copy link
Copy Markdown
Contributor

Is it possible to pass the random seed through lambda invoke event? So that we can have same random seed in both lambda function and the pytest function. It keeps the randomness and make it easier to assert on the random result.

@vip-amzn vip-amzn requested a review from bchampp as a code owner November 11, 2025 10:42
@vip-amzn vip-amzn requested a review from a user November 11, 2025 10:46
@vip-amzn vip-amzn requested a review from rarepolz November 11, 2025 10:46
bchampp
bchampp previously approved these changes Nov 11, 2025
Comment thread examples/src/step/step_with_retry.py Outdated
@yaythomas yaythomas dismissed ghost ’s stale review November 12, 2025 17:30

stale

@yaythomas yaythomas merged commit a3cda91 into main Nov 12, 2025
32 checks passed
@yaythomas yaythomas deleted the fix_flaky_tests branch November 12, 2025 17:31
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.

Fix intermittent test failures in test_steps_with_retry

5 participants