Repository navigation
Conversation
Add real HiveServer2 coverage for GSSAPI, verified TLS, their combination, and NOSASL with separate Ray driver and worker nodes. Reuse Hive test helpers, add isolated security fixtures and bounded orchestration, register executable pytest targets, and document credential requirements. Add a dedicated CI job and dependency lock. Local validation passed: 26 service cases, 66 helper/orchestration tests, 18 no-replay/lifecycle tests, and pytest_format. Upstream Python 3.10 CI with a Core build from the checkout has not run. Signed-off-by: jiangxt2 <[email protected]>
Translate pytest status 1 to RayCI status 42 inside the driver container after pytest returns, and retain the original status as an event artifact. Preserve Docker exec errors before pytest starts and let RayCI manage job retries without a separate approval gate. Remove the unused killed-producer evidence path and the Docker COPY shadowed by Compose mounts. Add runner and real pytest subprocess coverage, and document the exit-code artifact. Validation: 37 orchestration and 24 helper cases passed; a real Compose exec probe returned 1 before pytest started. Upstream CI validation for these changes is pending. Signed-off-by: jiangxt2 <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request introduces comprehensive integration tests for Hive authentication and TLS in Ray Data, covering GSSAPI, verified TLS, and NOSASL profiles. It adds a dedicated Docker Compose-based test runner, updates Buildkite CI configurations, refactors existing Hive tests to share utilities, and updates the documentation. The feedback highlights a fragile date parsing logic in the Kerberos ticket preparation script that could fail depending on the Kerberos client version's year format, recommending a more robust parsing strategy.
| matches = re.findall(r"\d\d/\d\d/\d\d \d\d:\d\d:\d\d", listing) | ||
| ends = [ | ||
| datetime.strptime(v, "%m/%d/%y %H:%M:%S") | ||
| .replace(tzinfo=timezone.utc) | ||
| .timestamp() | ||
| for v in matches[1::2] | ||
| ] |
There was a problem hiding this comment.
The regular expression and date parsing format for klist output are fragile because different versions of MIT Kerberos or Heimdal (and different OS environments) can output either 2-digit (YY) or 4-digit (YYYY) years. Using a fixed 2-digit year pattern (\d\d/\d\d/\d\d and %m/%d/%y) can cause unexpected test failures when run in environments with newer Kerberos clients. We should support both 2-digit and 4-digit years.
matches = re.findall(r"\d\d/\d\d/\d{2,4} \d\d:\d\d:\d\d", listing)
ends = []
for v in matches[1::2]:
year_part = v.split()[0].split("/")[-1]
fmt = "%m/%d/%Y %H:%M:%S" if len(year_part) == 4 else "%m/%d/%y %H:%M:%S"
ends.append(datetime.strptime(v, fmt).replace(tzinfo=timezone.utc).timestamp())There was a problem hiding this comment.
Expired-ticket validation has been deferred, and its klist parsing and short-lived-ticket fixture have been removed. This date-format assumption is no longer present.
Use native CI image builds and completed connection summaries while preserving all 26 security integration cases. Restore the existing Hive integration tests and retain exit-code and scoped cleanup checks. Signed-off-by: jiangxt2 <[email protected]>
Keep the dedicated runtime image as root so the downstream CI environment can create /rayci and update copied sources when installing checkout Core. Signed-off-by: jiangxt2 <[email protected]>
Keep 19 real-service cases for GSSAPI, verified TLS, combined GSSAPI/TLS, and NOSASL with independent driver/worker and complete RPC evidence. Remove automatic security CI, expired-ticket probes, and repeated worker-table failure cases. Use a standalone Python 3.12 dependency lock and return raw Docker/pytest statuses from the manual runner. Signed-off-by: jiangxt2 <[email protected]>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Rely on exact case counts, JSON parsing, and completed connection summaries for the existing security validation. Drop internal UUID and preliminary write-access checks. Keep malformed JSON rejection and verify aggregation of completed summaries without a trailing newline. Signed-off-by: jiangxt2 <[email protected]>
Merge upstream master at 891a5a8 and pin the matching Ray runtime for the Hive security fixture. Disable Ray token authentication within the isolated Compose cluster. Signed-off-by: jiangxt2 <[email protected]>
Resolve the log directory against the caller working directory before invoking Compose. Cover relative and absolute destinations in the runner tests. Signed-off-by: jiangxt2 <[email protected]>
Use Python 3.11 for the shuffle_batches benchmark to match its inherited torch-cu128 image and release configuration validation. Signed-off-by: jiangxt2 <[email protected]>
Merge upstream master at a83e55e, including the independent shuffle benchmark configuration fix. Signed-off-by: jiangxt2 <[email protected]>
Merge master at 74b21dc and reuse the Hive integration fixture for focused TLS validation. Signed-off-by: jiangxt2 <[email protected]>
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 8b2096c. Configure here.
Signed-off-by: jiangxt2 <[email protected]>
Signed-off-by: jiangxt2 <[email protected]>
Signed-off-by: jiangxt2 <[email protected]>
Signed-off-by: jiangxt2 <[email protected]>
|
Thanks for these! The team is aligning on some Ray Data test conventions (#67919 / #67928). In short: each test should fail if the change is reverted, extend or parametrize existing tests before adding new ones, test through the public read_* APIs rather than asserting on internal mock calls, and use ray_start_regular_shared instead of starting new clusters. This PR has about 2.6× more test lines than code. Could you trim it to the tests that catch a revert, and note in the description which revert each one catches? |
Signed-off-by: jiangxt2 <[email protected]>
Signed-off-by: jiangxt2 <[email protected]>
Signed-off-by: jiangxt2 <[email protected]>
Signed-off-by: jiangxt2 <[email protected]>
Signed-off-by: jiangxt2 <[email protected]>
Signed-off-by: jiangxt2 <[email protected]>
abhishekverma-ray
left a comment
There was a problem hiding this comment.
Could you link one real Buildkite run of run_hive_integration.sh --tls? So far the runner path has only been tested with stubs. Please also list the exact test commands, and say which regression each new test would catch.
| not os.environ.get("RAY_HIVE_CA_PEM_B64"), | ||
| reason="Set RAY_HIVE_CA_PEM_B64 to run the Hive TLS integration suite", | ||
| ) | ||
| class TestHiveTLS: |
There was a problem hiding this comment.
Thanks for digging into TLS! A design question before the details. This class only runs when someone starts run_hive_integration.sh --tls by hand. No CI step calls it, and it needs ECR access, so outside contributors can't run it either. Meanwhile test_hive_auth_utils.py runs in every Data premerge step, but it only tests the test helper.
Also, master already has test_hive_tls_rejects_untrusted_or_mismatched_server (line 275), which makes the same checks (right CA works, untrusted CA fails, wrong host fails). It still never runs, in either mode.
Could we instead run the existing Hive premerge job against your TLS server, with RAY_HIVE_TEST_USE_SSL=true and RAY_HIVE_TEST_CA_CERT set to the decoded CA? Then every existing read test runs over verified TLS, the existing negative test finally runs, and we can drop _hive_test_utils.py, test_hive_auth_utils.py, _EnsureCases and this class.
There was a problem hiding this comment.
The existing Hive premerge job is now configured to run against the TLS-enabled server. The existing read and certificate checks are reused, and the dedicated test class and helpers have been removed.
| return None | ||
|
|
||
|
|
||
| def _hostname_mismatch(error): |
There was a problem hiding this comment.
This looks for an ssl.match_hostname frame, but ssl.match_hostname was removed in Python 3.12. On 3.12, thrift 0.16 falls back to a check that raises a plain TTransportException. I ran this helper against a local TLS server on 3.12. The client correctly rejected the host, but the helper recorded certificate_error=False, hostname_mismatch=False, so test_hostname_worker would fail there. The unit test at test_hive_auth_utils.py:79 monkeypatches ssl.match_hostname, which thrift no longer reads after import, so it passes anyway. Could we assert on the visible result instead (the read fails, and the same read with the right CA passes)?
There was a problem hiding this comment.
Removed the hostname helper and reused the existing connection checks. They verify that the trusted connection succeeds and that an untrusted CA or mismatched hostname is rejected.
| Configure authentication, transport, TLS certificate verification, and client retries in the factory. Choose `auth_mechanism` explicitly when calling `impala.dbapi.connect()`. Use `NOSASL` only with a HiveServer2 configured for `NOSASL`. Hive server mode `NONE` uses `PLAIN`, a Simple Authentication and Security Layer (SASL) mechanism. Use a non-sensitive placeholder password because that server mode doesn't check it. `PLAIN` doesn't encrypt the password without TLS. For TLS connections, set `verify_cert=True` or provide a trusted `ca_cert`. For `GSSAPI`, install `impyla[kerberos]`, set `kerberos_service_name="hive"`, and configure authentication credentials on the driver and read worker. | ||
|
|
||
| The real-server integration test verifies the `PLAIN` mechanism with HiveServer2 in server mode `NONE`. It doesn't cover `NOSASL` or `GSSAPI`. | ||
| Configure authentication, transport, TLS certificate verification, and client retries in the factory. Choose `auth_mechanism` explicitly when calling `impala.dbapi.connect()`. Use `NOSASL` only with a HiveServer2 configured for `NOSASL`. Hive server mode `NONE` uses `PLAIN`, a Simple Authentication and Security Layer (SASL) mechanism. Use a non-sensitive placeholder password because that server mode doesn't check it. `PLAIN` doesn't encrypt the password without TLS. For TLS, set `use_ssl=True` and provide a trusted certificate authority (CA) file with `ca_cert`. The host name must match the server certificate. |
There was a problem hiding this comment.
Thanks for removing the verify_cert=True advice; I confirmed it gives an empty trust store on binary transport. One more sentence would help users a lot. With use_ssl=True and no ca_cert, impyla doesn't check the certificate at all, on both binary and HTTP transport (I tested this with a server signed by a private CA). The PLAIN password then goes to whatever server answers. Could you add that warning, plus a small factory example with use_ssl=True, ca_cert="/path/ca.pem"?
There was a problem hiding this comment.
Added the warning for Impyla 0.23.0 without a ca_cert and with the default verify_cert=False, along with a factory example that passes a trusted ca_cert.
| (read-hive-auth-tls)= | ||
| #### Configure TLS certificate verification | ||
|
|
||
| Configure TLS inside `connection_factory` and make any CA file available wherever the factory runs. For GSSAPI, install `impyla[kerberos]`, set `kerberos_service_name` to the service component of the server principal (for example, `"hive"` for `hive/host@REALM`), and provide credentials wherever the factory runs. |
There was a problem hiding this comment.
Could you add a short troubleshooting note here?
- With an untrusted CA, the error is only
Could not connect to any of [...], the same as a wrong port. The real certificate error is logged at INFO onthrift.transport.TSocket. - A missing CA file shows
No such file or directorywith no path. The CA must be at the same path on every node. - impyla has no timeout by default, so a port that never replies hangs the read task. Consider
timeout=. - On Python 3.12+, thrift 0.16 checks the hostname only against the certificate's CN, not its SANs.
There was a problem hiding this comment.
Added a note that an error for a missing CA file may omit the path.
| The real-server integration test covers ``PLAIN`` with HiveServer2 in | ||
| server mode ``NONE``. It doesn't cover ``NOSASL`` or ``GSSAPI``. | ||
| Real-server TLS validation of HS2 mode uses ``PLAIN`` with HiveServer2 in | ||
| server mode ``NONE``. GSSAPI and NOSASL aren't covered by this TLS suite. |
There was a problem hiding this comment.
Small one: "this TLS suite" points at test infrastructure users can't see. Could this say what to do instead, for example "pass ca_cert; it must exist on every node"? Keep the :ref: link.
There was a problem hiding this comment.
Updated the docstring to tell users to pass a trusted CA in the factory and make it available wherever the factory runs. The documentation link is retained.
Signed-off-by: jiangxt2 <[email protected]>
Signed-off-by: jiangxt2 <[email protected]>
|
The Buildkite Hive TLS job passed with |
Signed-off-by: jiangxt2 <[email protected]>

Description
Add real-service validation for
read_hive()verified TLS through the existingconnection_factoryAPI. Extend the HiveServer2 integration fixture to exercise connections on the driver and a separate Ray worker process.Before: Documented real-server coverage was limited to Impyla
PLAINwith HiveServer2 inNONEmode, which does not validate passwords.After: The existing Hive premerge job is configured to run table and query reads over verified TLS and check untrusted CAs and hostname mismatches at the connection boundary. Production reading behavior and the public API remain unchanged.
Subsystems: IO (Hive datasource tests), API (docstring only), plus supporting test infrastructure, CI, and documentation.
Related issues
Part of #67072
The existing #67144 Hive premerge job is configured to run PLAIN/NONE over TLS. GSSAPI and NOSASL remain in the scope of #67072.
Additional information
Coverage and execution
PLAINand server modeNONE; verified TLS is configured by the caller's connection factory.read_hivecalls or assert zero data RPCs after a TLS failure.Validation
Local checks on the consolidated Hive fixture:
bash ci/ray_ci/data/run_hive_integration.sh --tls— the//python/ray/data:test_hive_integrationtarget passed.The local Hive run invoked
run_hive_integration.sh --tlsin a Linuxcontainer. A local adapter replaced its Bazel invocation and ran the Hive
test module with the checkout's Data sources and a Ray wheel Core.
Runner test command:
Pre-commit and Pyrefly checks passed using a local Python 3.10/Arrow 17 Pyrefly configuration.
In a prepared RayCI environment, run the Hive suite with:
Validation environment and scope
The real-service run used Linux ARM64, Python 3.10.19, PyArrow 25.0.1, Hive 4.2.0, Impyla 0.23.0, checkout Data and test sources, and an official Ray wheel Core. The runner tests used macOS and Python 3.10.18.
See
ci/ray_ci/data/README.mdfor the manual runner's required environment.AI assistance
Codex assisted with implementation, testing, documentation, and review.