ITTLSTest: Retry on "Connection reset by peer". (#6406)

* ITTLSTest: Retry on "Connection reset by peer".

This sometimes happens and causes tests to fail spuriously.

* Better error messages when retries are exhausted.
This commit is contained in:
Gian Merlino 2018-09-30 12:30:10 -07:00 committed by Fangjin Yang
parent 9fa4afdb8e
commit 6e878249a0
1 changed files with 5 additions and 4 deletions

View File

@ -62,7 +62,7 @@ public class ITTLSTest
private static final Duration SSL_HANDSHAKE_TIMEOUT = new Duration(30 * 1000);
private static final int MAX_BROKEN_PIPE_RETRIES = 30;
private static final int MAX_CONNECTION_EXCEPTION_RETRIES = 30;
@Inject
IntegrationTestingConfig config;
@ -396,10 +396,11 @@ public class ITTLSTest
catch (RuntimeException re) {
Throwable rootCause = Throwables.getRootCause(re);
if (rootCause instanceof IOException && "Broken pipe".equals(rootCause.getMessage())) {
if (retries > MAX_BROKEN_PIPE_RETRIES) {
if (rootCause instanceof IOException && ("Broken pipe".equals(rootCause.getMessage())
|| "Connection reset by peer".contains(rootCause.getMessage()))) {
if (retries > MAX_CONNECTION_EXCEPTION_RETRIES) {
Assert.fail(StringUtils.format(
"Broken pipe retries exhausted, test failed, did not get %s.",
"Broken pipe / connection reset retries exhausted, test failed, did not get %s.",
expectedException
));
} else {