HyukjinKwon opened a new pull request, #542:
URL: https://github.com/apache/spark-connect-rust/pull/542

   ### What changes were proposed in this pull request?
   
   Two test-only fixes of flaky tests.
   
   - **Core client tests** (`crates/spark-connect-core/src/client.rs`): four 
tests removed `SPARK_CONNECT_AUTHENTICATE_TOKEN` from the environment only 
while they parsed their URL. They now keep it removed until 
`SparkConnectClient::connect` returns. The tests:
     - `recorded_client` of `request_fields_tests`;
     - `release_session_is_retried_on_unavailable_as_the_reference`;
     - `the_plan_that_a_hook_puts_in_is_compressed_as_pyspark`;
     - 
`requests_carry_the_client_type_extensions_and_observed_session_of_pyspark`.
   - **ML offline tests** (`python/tests/test_ml_offline.py`): the checks that 
read the command of an evaluate, a fit or a cache query by its position among 
the received requests now skip the Deletes of models that earlier tests 
released. They use two helpers next to `_requests_but_deletes`: 
`_commands_but_deletes` and `_last_request_but_deletes`.
   
   ### Why are the changes needed?
   
   - **The token race.** `connect` reads the token of the environment again 
(`ChannelBuilder::token`, through `secure()`). With a token there, a channel to 
`127.0.0.1` is TLS: as in PySpark, only `localhost` stays plaintext with a 
token. Tests that set a token run in parallel, and their guard can hold one in 
the environment while one of these tests connects. The client then speaks TLS 
to the plaintext test server, and its request fails with UNAVAILABLE `received 
corrupt message of type InvalidContentType`, after 611 s of retries. This 
happened to `test_interrupt_all_request_structure` in a run of the lib tests.
   - **The Delete race.** A model that a test drops is released without waiting 
for it, so its Delete can reach the shared mock server during a later test, 
between that test's request and its check. 
`test_ml_connect_evaluators_take_the_signatures_and_defaults_of_pyspark` then 
read the Delete at the index of the evaluate, and failed once in a full run.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No, test-only.
   
   ### How was this patch tested?
   
   - With `SPARK_CONNECT_AUTHENTICATE_TOKEN=ENV` exported to the whole run, 
`cargo test -p apache-spark-connect-core --release --lib -- 
request_fields_tests:: 
release_session_is_retried_on_unavailable_as_the_reference`:
     - before: 3 of the 12 tests failed with `InvalidContentType`, after 611 s;
     - after: 12 passed in 0.01 s.
   - `python/tests/test_ml_offline.py`: 111 passed.
   - `cargo fmt --all --check` and `ruff check` are clean, and the trial of the 
merge runs every suite.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Opus 5.5
   
   This pull request and its description were written by Isaac.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to