LuciferYang commented on code in PR #41859:
URL: https://github.com/apache/spark/pull/41859#discussion_r1252694613
##########
common/network-shuffle/src/test/java/org/apache/spark/network/shuffle/RemoteBlockPushResolverSuite.java:
##########
@@ -262,19 +262,23 @@ public void
testDuplicateBlocksAreIgnoredWhenPrevStreamIsInProgress() throws IOE
validateChunks(TEST_APP, 0, 0, 0, blockMeta, new int[]{4}, new
int[][]{{0}});
}
- @Test
+ @Test(expected = RuntimeException.class)
public void testFailureAfterData() throws IOException {
StreamCallbackWithID stream =
pushResolver.receiveBlockDataAsStream(
new PushBlockStream(TEST_APP, NO_ATTEMPT_ID, 0, 0, 0, 0, 0));
stream.onData(stream.getID(), ByteBuffer.wrap(new byte[4]));
stream.onFailure(stream.getID(), new RuntimeException("Forced Failure"));
pushResolver.finalizeShuffleMerge(new FinalizeShuffleMerge(TEST_APP,
NO_ATTEMPT_ID, 0, 0));
- MergedBlockMeta blockMeta = pushResolver.getMergedBlockMeta(TEST_APP, 0,
0, 0);
- assertEquals("num-chunks", 0, blockMeta.getNumChunks());
+ try {
Review Comment:
Although this is a backport, I prefer to remove `expected =
RuntimeException.class` from `@Test` and use `assertThrows` like:
```
RuntimeException e = assertThrows(RuntimeException.class,
() -> pushResolver.getMergedBlockMeta(TEST_APP, 0, 0, 0));
assertTrue(e.getMessage().contains("is empty"));
```
--
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]