Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-26069][TESTS]Fix flaky test: RpcIntegrationSuite.sendRpcWithStreamFailures #23041

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -371,23 +371,29 @@ private void assertErrorsContain(Set<String> errors, Set<String> contains) {

private void assertErrorAndClosed(RpcResult result, String expectedError) {
assertTrue("unexpected success: " + result.successMessages, result.successMessages.isEmpty());
// we expect 1 additional error, which contains *either* "closed" or "Connection reset"
// we expect 1 additional error, which should contain one of the follow messages:
// - "closed"
// - "Connection reset"
// - "java.nio.channels.ClosedChannelException"
Set<String> errors = result.errorMessages;
assertEquals("Expected 2 errors, got " + errors.size() + "errors: " +
errors, 2, errors.size());

Set<String> containsAndClosed = Sets.newHashSet(expectedError);
containsAndClosed.add("closed");
containsAndClosed.add("Connection reset");
containsAndClosed.add("java.nio.channels.ClosedChannelException");

Pair<Set<String>, Set<String>> r = checkErrorsContain(errors, containsAndClosed);

Set<String> errorsNotFound = r.getRight();
assertEquals(1, errorsNotFound.size());
String err = errorsNotFound.iterator().next();
assertTrue(err.equals("closed") || err.equals("Connection reset"));
assertTrue("Got a non-empty set " + r.getLeft(), r.getLeft().isEmpty());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this check here so that we can see what's the error that causes the test failure.


assertTrue(r.getLeft().isEmpty());
Set<String> errorsNotFound = r.getRight();
assertEquals(
"The size of " + errorsNotFound.toString() + " was not 2", 2, errorsNotFound.size());
for (String err: errorsNotFound) {
assertTrue("Found a wrong error " + err, containsAndClosed.contains(err));
}
}

private Pair<Set<String>, Set<String>> checkErrorsContain(
Expand Down