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 13:29:10 UTC

[tomcat] branch master updated: 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 master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
     new d397523  Refactor wait to make test failure due to timing issues less likely
d397523 is described below

commit d397523b1397a642729ed541332b58c3afc13e96
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..7a2ee32 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