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
The following commit(s) were added to refs/heads/8.5.x by this push:
new 33a71ab Change calculation of new file times to avoid Travis failures
33a71ab is described below
commit 33a71ab42ac0a7d37ca39e79bfc8001ed68dd1c8
Author: Mark Thomas <[email protected]>
AuthorDate: Tue Aug 18 16:37:00 2020 +0100
Change calculation of new file times to avoid Travis failures
Sometimes deployment would take ~8s on Travis. Using a new modification
time of current time - 10 seconds meant the new time was within 1s of
the old time and, therefore, not seen as different by Tomcat.
---
.../startup/TestHostConfigAutomaticDeployment.java | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git
a/test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java
b/test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java
index d37b765..9769f77 100644
--- a/test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java
+++ b/test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java
@@ -1090,6 +1090,8 @@ public class TestHostConfigAutomaticDeployment extends
TomcatBaseTest {
File war = null;
File dir = null;
+ long testStartTime = System.currentTimeMillis();
+
if (startXml && !startExternalWar && !startExternalDir) {
xml = createXmlInConfigBaseForAppbase();
}
@@ -1117,14 +1119,16 @@ public class TestHostConfigAutomaticDeployment extends
TomcatBaseTest {
host.backgroundProcess();
// Update the last modified time. Make sure that the OS reports a
change
- // in modification time that HostConfig can detect.
+ // in modification time that HostConfig can detect. Change is made
+ // relative to test start time to ensure new modification times are
+ // sufficiently different.
switch (toModify) {
case XML:
if (xml == null) {
Assert.fail();
} else {
Assert.assertTrue("Failed to set last modified for [" +
xml + "]", xml.setLastModified(
- System.currentTimeMillis() - 10 *
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
+ testStartTime - 10 *
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
}
break;
case EXT:
@@ -1132,7 +1136,7 @@ public class TestHostConfigAutomaticDeployment extends
TomcatBaseTest {
Assert.fail();
} else {
Assert.assertTrue("Failed to set last modified for [" +
ext + "]", ext.setLastModified(
- System.currentTimeMillis() - 10 *
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
+ testStartTime - 10 *
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
}
break;
case WAR:
@@ -1140,7 +1144,7 @@ public class TestHostConfigAutomaticDeployment extends
TomcatBaseTest {
Assert.fail();
} else {
Assert.assertTrue("Failed to set last modified for [" +
war + "]", war.setLastModified(
- System.currentTimeMillis() - 10 *
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
+ testStartTime - 10 *
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
}
break;
case DIR:
@@ -1148,7 +1152,7 @@ public class TestHostConfigAutomaticDeployment extends
TomcatBaseTest {
Assert.fail();
} else {
Assert.assertTrue("Failed to set last modified for [" +
dir + "]", dir.setLastModified(
- System.currentTimeMillis() - 10 *
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
+ testStartTime - 10 *
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
}
break;
default:
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]