Repository navigation
[serve] Deflake test_cli by adding explicit wait timeouts and stopping tracing config leak - #65432
Merged
abrarsheikh merged 2 commits intoAug 13, 2026
Merged
Conversation
…ing across tests 17 of 41 wait_for_condition calls in test_cli.py had an effective timeout of 10s, 12 of them bare calls inheriting the default. Give every call an explicit timeout and double the existing values, matching the convention already used elsewhere in this file. Also stop test_deploy_config_tracing_config_declarative_flow from leaking global tracing config into the rest of the file. The controller only ever sets global_tracing_config (deploy_config never resets it) and the Serve instance is session-scoped, so every later test ran with tracing enabled at sampling_ratio 1.0, exporting a span per request. Reset it to disabled in the teardown. Fragility and isolation cleanup; not a fix for a specific known flake. Co-Authored-By: Claude <[email protected]> Signed-off-by: John Taylor <[email protected]>
Contributor
There was a problem hiding this comment.
Code Review
This pull request increases the timeouts for various wait_for_condition calls in python/ray/serve/tests/test_cli.py to mitigate test flakiness. Additionally, it introduces a teardown step in a finally block to disable tracing and redeploy the configuration, ensuring subsequent tests are unaffected. The reviewer suggested wrapping the teardown subprocess.check_output call in a try...except block to prevent masking any original test exceptions if the teardown fails.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit c75ddfd. Configure here.
… clean up Address review feedback on the tracing cleanup. The reset lived in a finally around the last wait only, so a failure in check_running, the tracing assertions, or the HTTP check skipped it and left global tracing enabled for the rest of the session-scoped Serve instance. Registering it with request.addfinalizer before the enabling deploy covers every exit path, and running it as a finalizer rather than in finally means a teardown error is reported separately instead of masking the real failure. Co-Authored-By: Claude <[email protected]> Signed-off-by: John Taylor <[email protected]>
abrarsheikh
approved these changes
Aug 13, 2026
400Ping
pushed a commit
to 400Ping/ray
that referenced
this pull request
Aug 18, 2026
…g tracing config leak (ray-project#65432) Two independent cleanups to `python/ray/serve/tests/test_cli.py`. **1. Explicit wait timeouts.** 17 of the file's 41 `wait_for_condition` calls had an effective timeout of 10s, and 12 of those were bare calls inheriting the default rather than stating one. Every call now carries an explicit timeout, and existing values are doubled, matching the convention already used elsewhere in this file. **2. Stop global tracing config leaking across tests.** `test_deploy_config_tracing_config_declarative_flow` deploys a config with `tracing_config: {enabled: true, sampling_ratio: 1.0}`. `ServeController.deploy_config` only ever *sets* `global_tracing_config` — there is no reset path — and the `serve_instance` fixture is session-scoped, its teardown only deleting apps. Every subsequent test in the file therefore ran with tracing enabled at ratio 1.0, exporting a span per request. The test now resets tracing to disabled in its teardown. ## Testing - 114 unloaded full-file runs, all green. - Under induced CPU contention, the timeout change fixed 3 previously-failing tests (`test_deploy_multi_app_basic`, `test_deploy_multi_app_builder_with_args`, `test_status_multi_app`); tests that wait for a terminal `DEPLOY_FAILED` state are unaffected, as that duration is governed by replica retry exhaustion rather than the wait timeout. - Tracing leak fix verified directly: a probe test in the same session now observes `enabled=False` where it previously saw `enabled=True`. --------- Signed-off-by: John Taylor <[email protected]> Co-authored-by: Claude <[email protected]> Signed-off-by: 400Ping <[email protected]>
nadongjun
pushed a commit
to nadongjun/ray
that referenced
this pull request
Oct 6, 2026
…g tracing config leak (ray-project#65432) Two independent cleanups to `python/ray/serve/tests/test_cli.py`. **1. Explicit wait timeouts.** 17 of the file's 41 `wait_for_condition` calls had an effective timeout of 10s, and 12 of those were bare calls inheriting the default rather than stating one. Every call now carries an explicit timeout, and existing values are doubled, matching the convention already used elsewhere in this file. **2. Stop global tracing config leaking across tests.** `test_deploy_config_tracing_config_declarative_flow` deploys a config with `tracing_config: {enabled: true, sampling_ratio: 1.0}`. `ServeController.deploy_config` only ever *sets* `global_tracing_config` — there is no reset path — and the `serve_instance` fixture is session-scoped, its teardown only deleting apps. Every subsequent test in the file therefore ran with tracing enabled at ratio 1.0, exporting a span per request. The test now resets tracing to disabled in its teardown. ## Testing - 114 unloaded full-file runs, all green. - Under induced CPU contention, the timeout change fixed 3 previously-failing tests (`test_deploy_multi_app_basic`, `test_deploy_multi_app_builder_with_args`, `test_status_multi_app`); tests that wait for a terminal `DEPLOY_FAILED` state are unaffected, as that duration is governed by replica retry exhaustion rather than the wait timeout. - Tracing leak fix verified directly: a probe test in the same session now observes `enabled=False` where it previously saw `enabled=True`. --------- Signed-off-by: John Taylor <[email protected]> Co-authored-by: Claude <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Two independent cleanups to
python/ray/serve/tests/test_cli.py.1. Explicit wait timeouts. 17 of the file's 41
wait_for_conditioncalls had aneffective timeout of 10s, and 12 of those were bare calls inheriting the default rather
than stating one. Every call now carries an explicit timeout, and existing values are
doubled, matching the convention already used elsewhere in this file.
2. Stop global tracing config leaking across tests.
test_deploy_config_tracing_config_declarative_flowdeploys a config withtracing_config: {enabled: true, sampling_ratio: 1.0}.ServeController.deploy_configonly ever sets
global_tracing_config— there is no reset path — and theserve_instancefixture is session-scoped, its teardown only deleting apps. Everysubsequent test in the file therefore ran with tracing enabled at ratio 1.0, exporting a
span per request. The test now resets tracing to disabled in its teardown.
Testing
(
test_deploy_multi_app_basic,test_deploy_multi_app_builder_with_args,test_status_multi_app); tests that wait for a terminalDEPLOY_FAILEDstate areunaffected, as that duration is governed by replica retry exhaustion rather than the
wait timeout.
enabled=Falsewhere it previously sawenabled=True.