grundprinzip commented on code in PR #46297:
URL: https://github.com/apache/spark/pull/46297#discussion_r1584356038
##########
python/pyspark/sql/tests/connect/client/test_client.py:
##########
@@ -340,6 +353,71 @@ def check():
eventually(timeout=1, catch_assertions=True)(check)()
+ @parameterized.expand(
+ [
+ ("session", "INVALID_HANDLE.SESSION_NOT_FOUND"),
+ ("operation", "INVALID_HANDLE.OPERATION_NOT_FOUND"),
+ ]
+ )
+ def test_not_found_recovers(self, _, error_msg: str):
+ # Assert that the client recovers from session or operation not found
error
+ # if no partial responses were previously received.
+
+ def not_found():
+ raise TestException(
+ error_msg,
+ grpc.StatusCode.UNAVAILABLE,
+ trailing_status=status_pb2.Status(code=14, message=error_msg,
details=""),
+ )
+
+ stub = self._stub_with([not_found, self.finished])
+ ite = ExecutePlanResponseReattachableIterator(self.request, stub,
self.retrying, [])
+
+ for _ in ite:
+ pass
+
+ def checks():
+ self.assertEquals(2, stub.execute_calls)
+ self.assertEquals(0, stub.attach_calls)
+ self.assertEquals(0, stub.release_calls)
+ self.assertEquals(0, stub.release_until_calls)
+
+ eventually(timeout=1, catch_assertions=True)(checks)()
+
+ @parameterized.expand(
+ [
+ ("session", "INVALID_HANDLE.SESSION_NOT_FOUND"),
+ ("operation", "INVALID_HANDLE.OPERATION_NOT_FOUND"),
+ ]
+ )
+ def test_not_found_fails(self, _, error_msg: str):
+ # Assert that the client fails from session or operation not found
error
Review Comment:
nit: use """ """ for documentation of the test ideally something along the
lines of this:
```suggestion
""" SPARK-48056: Assert that the client fails from session or
operation not found error
"""
```
--
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]