This is an automated email from the ASF dual-hosted git repository.
eolivelli pushed a commit to branch branch-3.6
in repository https://gitbox.apache.org/repos/asf/zookeeper.git
The following commit(s) were added to refs/heads/branch-3.6 by this push:
new aa930d8 ZOOKEEPER-3813: FileChangeWatcherTest is broken on Mac
aa930d8 is described below
commit aa930d8757d2e300fe86a6e17e3eddbe9b276e91
Author: Andor Molnar <andor@apache.org>
AuthorDate: Mon May 4 14:17:33 2020 +0200
ZOOKEEPER-3813: FileChangeWatcherTest is broken on Mac
This patch will increase the FS wait timeout to give Mac OSX longer time to detect file
modifications.
Author: Andor Molnar <andor@apache.org>
Reviewers: Enrico Olivelli <eolivelli@apache.org>, Christopher Tubbs, Mate Szalay-Beko
Closes #1345 from anmolnar/ZOOKEEPER-3813
(cherry picked from commit 391cb4aa6b54e19a028215e1340232a114c23ed3)
Signed-off-by: Enrico Olivelli <eolivelli@apache.org>
---
.../org/apache/zookeeper/common/FileChangeWatcherTest.java | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/zookeeper-server/src/test/java/org/apache/zookeeper/common/FileChangeWatcherTest.java
b/zookeeper-server/src/test/java/org/apache/zookeeper/common/FileChangeWatcherTest.java
index bbac072..619ab1d 100644
--- a/zookeeper-server/src/test/java/org/apache/zookeeper/common/FileChangeWatcherTest.java
+++ b/zookeeper-server/src/test/java/org/apache/zookeeper/common/FileChangeWatcherTest.java
@@ -45,6 +45,8 @@ public class FileChangeWatcherTest extends ZKTestCase {
private static final Logger LOG = LoggerFactory.getLogger(FileChangeWatcherTest.class);
+ private static final long FS_TIMEOUT = 30000L;
+
@BeforeClass
public static void createTempFile() throws IOException {
tempDir = ClientBase.createEmptyTestDir();
@@ -87,7 +89,7 @@ public class FileChangeWatcherTest extends ZKTestCase {
FileUtils.writeStringToFile(tempFile, "Hello world " + i + "\n", StandardCharsets.UTF_8,
true);
synchronized (events) {
if (events.size() < i + 1) {
- events.wait(3000L);
+ events.wait(FS_TIMEOUT);
}
assertEquals("Wrong number of events", i + 1, events.size());
WatchEvent<?> event = events.get(i);
@@ -128,7 +130,7 @@ public class FileChangeWatcherTest extends ZKTestCase {
FileUtils.touch(tempFile);
synchronized (events) {
if (events.isEmpty()) {
- events.wait(3000L);
+ events.wait(FS_TIMEOUT);
}
assertFalse(events.isEmpty());
WatchEvent<?> event = events.get(0);
@@ -162,7 +164,7 @@ public class FileChangeWatcherTest extends ZKTestCase {
tempFile2.deleteOnExit();
synchronized (events) {
if (events.isEmpty()) {
- events.wait(3000L);
+ events.wait(FS_TIMEOUT);
}
assertFalse(events.isEmpty());
WatchEvent<?> event = events.get(0);
@@ -201,7 +203,7 @@ public class FileChangeWatcherTest extends ZKTestCase {
tempFile.delete();
synchronized (events) {
if (events.isEmpty()) {
- events.wait(3000L);
+ events.wait(FS_TIMEOUT);
}
assertFalse(events.isEmpty());
WatchEvent<?> event = events.get(0);
@@ -239,14 +241,14 @@ public class FileChangeWatcherTest extends ZKTestCase {
FileUtils.writeStringToFile(tempFile, "Hello world\n", StandardCharsets.UTF_8,
true);
synchronized (callCount) {
while (callCount.get() == 0) {
- callCount.wait(3000L);
+ callCount.wait(FS_TIMEOUT);
}
}
LOG.info("Modifying file again");
FileUtils.writeStringToFile(tempFile, "Hello world again\n", StandardCharsets.UTF_8,
true);
synchronized (callCount) {
if (callCount.get() == 1) {
- callCount.wait(3000L);
+ callCount.wait(FS_TIMEOUT);
}
}
// The value of callCount can exceed 1 only if the callback thread
|