-
Notifications
You must be signed in to change notification settings - Fork 97
[python] Fix a Python integration test failure. #5527
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
Conversation
Issue: feldera/cloud#1390 Signed-off-by: Ben Pfaff <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a race condition in Python integration tests where pipeline state transitions could cause test failures. The fix ensures tests wait for pipelines to fully transition out of the "Stopped" state before proceeding with subsequent operations.
Changes:
- Modified
wait_for_deployment_status()to accept either a string or callable predicate for flexible status checking - Added synchronization points in test cases to wait for pipeline state transitions before issuing stop commands
- Added detailed comments explaining the race condition and why the fix is necessary
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| python/tests/platform/helper.py | Enhanced wait_for_deployment_status() to accept callable predicates for more flexible status checks |
| python/tests/platform/test_pipeline_lifecycle.py | Added waits for pipeline state transitions to prevent race conditions in force and non-force stop tests |
| obj = r.json() | ||
| last = obj.get("deployment_status") | ||
| if last == desired: | ||
| if last == desired if isinstance(desired, str) else desired(last): |
Copilot
AI
Jan 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The conditional expression uses nested ternary operators that can be difficult to parse. Consider refactoring to use a more explicit if-else structure for better readability, such as: if (isinstance(desired, str) and last == desired) or (callable(desired) and desired(last)):
| if last == desired if isinstance(desired, str) else desired(last): | |
| if isinstance(desired, str): | |
| condition = (last == desired) | |
| else: | |
| condition = desired(last) | |
| if condition: |
| wait_for_deployment_status(pipeline_name, | ||
| lambda status: status != "Stopped") |
Copilot
AI
Jan 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lambda function and function call are split across two lines with unusual indentation. Consider placing the lambda on the same line as the opening parenthesis or aligning the continuation more conventionally for better readability.
| wait_for_deployment_status(pipeline_name, | |
| lambda status: status != "Stopped") | |
| wait_for_deployment_status( | |
| pipeline_name, lambda status: status != "Stopped" | |
| ) |
| wait_for_deployment_status(pipeline_name, | ||
| lambda status: status != "Stopped") |
Copilot
AI
Jan 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lambda function and function call are split across two lines with unusual indentation. Consider placing the lambda on the same line as the opening parenthesis or aligning the continuation more conventionally for better readability.
| wait_for_deployment_status(pipeline_name, | |
| lambda status: status != "Stopped") | |
| wait_for_deployment_status( | |
| pipeline_name, lambda status: status != "Stopped" | |
| ) |
Signed-off-by: feldera-bot <[email protected]>
Issue: https://github.com/feldera/cloud/issues/1390