Skip to content

Commit

Permalink
test: AcceptTimeoutTest: Don't fail for known errors
Browse files Browse the repository at this point in the history
Don't fail testPendingAcceptCloseServerSocket* when the subclass knows
that there is a problem (e.g. with VSOCK).

As seen with older Linux versions.
  • Loading branch information
kohlschuetter committed Feb 14, 2024
1 parent 1d42c0c commit 3a70a33
Showing 1 changed file with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,15 +255,25 @@ private void testPendingAcceptCloseServerSocket(boolean delayed) throws Exceptio
doClose.run();
}

assertTimeoutPreemptively(Duration.ofSeconds(5), () -> {
// Should be SocketClosedException or InvalidArgumentSocketException, but no guarantee
assertThrows(SocketException.class, () -> {
try (Socket unused = ss.accept()) {
fail("Should not be reached");
} catch (SocketException e) {
throw e;
}
try {
assertTimeoutPreemptively(Duration.ofSeconds(5), () -> {
// Should be SocketClosedException or InvalidArgumentSocketException, but no guarantee
assertThrows(SocketException.class, () -> {
try (Socket unused = ss.accept()) {
fail("Should not be reached");
} catch (SocketException e) {
throw e;
}
});
});
});
} catch (AssertionFailedError e) {
String msg = checkKnownBugAcceptTimeout(addr);
if (msg == null) {
throw e;
} else {
throw new TestAbortedWithImportantMessageException(
MessageType.TEST_ABORTED_SHORT_WITH_ISSUES, msg, summaryImportantMessage(msg), e);
}
}
}
}

0 comments on commit 3a70a33

Please sign in to comment.