(tomcat) branch 11.0.x updated: Add re-try attempt after observing likely timing related test failures

[email protected]
Newsgroups gmane.comp.jakarta.tomcat.devel
Message-ID <178653303641.1300797.14837587862894595845@gitbox3-he-fi.apache.org>
This is an automated email from the ASF dual-hosted git repository.

markt-asf pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/11.0.x by this push:
     new ac875cec95 Add re-try attempt after observing likely timing related test failures
ac875cec95 is described below

commit ac875cec954cdfb8b7c32c108e56a52380475620
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Aug 12 12:10:14 2026 +0100

    Add re-try attempt after observing likely timing related test failures
---
 .../EncryptionInterceptorBaseTest.java             | 26 +++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/test/org/apache/catalina/tribes/group/interceptors/EncryptionInterceptorBaseTest.java b/test/org/apache/catalina/tribes/group/interceptors/EncryptionInterceptorBaseTest.java
index c3db40dc28..124ea16b9e 100644
--- a/test/org/apache/catalina/tribes/group/interceptors/EncryptionInterceptorBaseTest.java
+++ b/test/org/apache/catalina/tribes/group/interceptors/EncryptionInterceptorBaseTest.java
@@ -34,6 +34,7 @@ import org.apache.catalina.tribes.group.ChannelInterceptorBase;
 import org.apache.catalina.tribes.group.InterceptorPayload;
 import org.apache.catalina.tribes.io.ChannelData;
 import org.apache.catalina.tribes.io.XByteBuffer;
+import org.apache.tomcat.util.ExceptionUtils;
 
 public class EncryptionInterceptorBaseTest {
 
@@ -56,9 +57,28 @@ public class EncryptionInterceptorBaseTest {
 
     @AfterClass
     public static void cleanup() {
-        File f = new File(MESSAGE_FILE);
-        if (f.isFile()) {
-            Assert.assertTrue(f.delete());
+        int attempts = 0;
+        int maxAttempts = 2;
+        while (attempts < maxAttempts) {
+            attempts++;
+            try {
+                File f = new File(MESSAGE_FILE);
+                if (f.isFile()) {
+                    Assert.assertTrue(f.delete());
+                }
+            } catch (Throwable t) {
+                ExceptionUtils.handleThrowable(t);
+                if (attempts < maxAttempts) {
+                    // Brief delay before re-try
+                    try {
+                        Thread.sleep(50);
+                    } catch (InterruptedException e) {
+                        // Ignore. The delay will just be shorter than expected.
+                    }
+                } else {
+                    throw t;
+                }
+            }
         }
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.