rich7420 commented on code in PR #11195:
URL: https://github.com/apache/ozone/pull/11195#discussion_r4000304922
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestXceiverClientGrpc.java:
##########
@@ -315,21 +315,37 @@ public void testStreamReadSendsImmediatelyWhenReady()
throws Exception {
"isReady() must be checked exactly once when stream is immediately
ready");
}
- /** streamRead() spin-waits until isReady() becomes true, then calls
onNext(). */
+ /** streamRead() blocks until the onReadyHandler fires and isReady() becomes
true, then calls onNext(). */
@Test
public void testStreamReadWaitsUntilReadyThenSends() throws Exception {
- TrackingStreamObserver obs = new TrackingStreamObserver(3);
+ TrackingStreamObserver obs = new TrackingStreamObserver(false);
StreamingReadResponse response = new StreamingReadResponse(
MockDatanodeDetails.randomDatanodeDetails(), obs);
+ // mirrors what ReadyAwareResponseObserver.beforeStart() registers on a
real call
+ obs.setOnReadyHandler(response::signalReady);
Review Comment:
This test covers the waiting behavior, but it duplicates the [production
`setOnReadyHandler`
registration](https://github.com/apache/ozone/blob/d7ffda77725ddec18df2310ebf6778655b3beb15/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientGrpc.java#L657-L660).
It would still pass if that registration were removed, and `readyCalls >= 2`
also passes with the previous polling implementation. Please exercise the
production observer path and assert a bounded `isReady()` call count so the
test fails without the callback-driven implementation.
--
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]