This is an automated email from the ASF dual-hosted git repository.
markt 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 002d38647f Review and fix edge cases after CI failure.
002d38647f is described below
commit 002d38647fc1c2491907cfeeeb8197fd343ab48b
Author: Mark Thomas <[email protected]>
AuthorDate: Fri Sep 27 11:05:51 2024 +0100
Review and fix edge cases after CI failure.
---
.../apache/tomcat/util/http/TestFastHttpDateFormat.java | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/test/org/apache/tomcat/util/http/TestFastHttpDateFormat.java
b/test/org/apache/tomcat/util/http/TestFastHttpDateFormat.java
index e50a60cc9f..20e771ef1e 100644
--- a/test/org/apache/tomcat/util/http/TestFastHttpDateFormat.java
+++ b/test/org/apache/tomcat/util/http/TestFastHttpDateFormat.java
@@ -38,16 +38,18 @@ public class TestFastHttpDateFormat {
String d1 = FastHttpDateFormat.getCurrentDate();
long start = System.currentTimeMillis() / 1000;
- long t1 = 0;
+ long t1 = start;
long t2 = 0;
- long t3 = start;
+ long t3 = 0;
String d2 = d1;
/*
- * Run this test for 3s. Should normally see 3 changes of date.
May, very rarely, see 2.
+ * Run this test for 3s. Should normally see 3 changes of date.
Because d1 and t1 are not set atomically,
+ * it is possible for them to be inconsistent. That inconsistency
can lead to one more or one less change
+ * than typically expected. Therefore, the test accepts 2, 3 or 4
changes.
*/
int changes = 0;
- while (t3 - start < 3) {
+ while (t1 - start < 3) {
// Copy results to next slot, dropping the oldest (t3 and d2)
d2 = d1;
@@ -63,11 +65,11 @@ public class TestFastHttpDateFormat {
changes++;
// Then the second must have changed
if (t1 == t2 && t2 == t3) {
- Assert.fail("Formatted date changed withint the same
second");
+ Assert.fail("Formatted date changed within the same
second");
}
}
}
- Assert.assertTrue("Saw [" + changes + "] in formatted date",
changes > 1 && changes < 4);
+ Assert.assertTrue("Saw [" + changes + "] changes in formatted
date", changes > 1 && changes < 5);
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]