You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2019/12/07 17:14:21 UTC
[tomcat] 18/18: Refactor wait to make test failure due to timing
issues less likely
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 1f9d3e6500fb8543493f20c958dc59cbb3415dfa
Author: god <go...@win-10-x64-dev.homeinbox.net>
AuthorDate: Sat Dec 7 13:27:54 2019 +0000
Refactor wait to make test failure due to timing issues less likely
---
test/org/apache/tomcat/util/net/TestSsl.java | 29 +++++++++-------------------
1 file changed, 9 insertions(+), 20 deletions(-)
diff --git a/test/org/apache/tomcat/util/net/TestSsl.java b/test/org/apache/tomcat/util/net/TestSsl.java
index 8e815f2..b777f2c 100644
--- a/test/org/apache/tomcat/util/net/TestSsl.java
+++ b/test/org/apache/tomcat/util/net/TestSsl.java
@@ -136,28 +136,17 @@ public class TestSsl extends TomcatBaseTest {
socket.startHandshake();
- // One request should be sufficient
- int requestCount = 0;
- int listenerComplete = 0;
- try {
- while (requestCount < 10) {
- requestCount++;
- doRequest(os, r);
- Assert.assertTrue("Checking no client issuer has been requested",
- TesterSupport.getLastClientAuthRequestedIssuerCount() == 0);
- if (listener.isComplete() && listenerComplete == 0) {
- listenerComplete = requestCount;
- }
- }
- } catch (AssertionError | IOException e) {
- String message = "Failed on request number " + requestCount
- + " after startHandshake(). " + e.getMessage();
- log.error(message, e);
- Assert.fail(message);
+ doRequest(os, r);
+ // Handshake complete appears to be called asynchronously
+ int wait = 0;
+ while (wait < 5000 && !listener.isComplete()) {
+ wait += 50;
+ Thread.sleep(50);
}
-
+ Assert.assertTrue("Checking no client issuer has been requested",
+ TesterSupport.getLastClientAuthRequestedIssuerCount() == 0);
Assert.assertTrue(listener.isComplete());
- System.out.println("Renegotiation completed after " + listenerComplete + " requests");
+ System.out.println("Renegotiation completed after " + wait + " ms");
}
private void doRequest(OutputStream os, Reader r) throws IOException {
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org