From commits-return-8378-archive-asf-public=cust-asf.ponee.io@zookeeper.apache.org Mon May 4 12:17:57 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 44397180608 for ; Mon, 4 May 2020 14:17:57 +0200 (CEST) Received: (qmail 94103 invoked by uid 500); 4 May 2020 12:17:56 -0000 Mailing-List: contact commits-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zookeeper.apache.org Delivered-To: mailing list commits@zookeeper.apache.org Received: (qmail 94091 invoked by uid 99); 4 May 2020 12:17:56 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 May 2020 12:17:56 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 6C9F38BFAB; Mon, 4 May 2020 12:17:56 +0000 (UTC) Date: Mon, 04 May 2020 12:17:56 +0000 To: "commits@zookeeper.apache.org" Subject: [zookeeper] branch branch-3.6 updated: ZOOKEEPER-3813: FileChangeWatcherTest is broken on Mac MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <158859467628.9665.6790419293567930002@gitbox.apache.org> From: eolivelli@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: zookeeper X-Git-Refname: refs/heads/branch-3.6 X-Git-Reftype: branch X-Git-Oldrev: 6f23dfbbe3684092cb645d52b718c8f99902cff2 X-Git-Newrev: aa930d8757d2e300fe86a6e17e3eddbe9b276e91 X-Git-Rev: aa930d8757d2e300fe86a6e17e3eddbe9b276e91 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated 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 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 Reviewers: Enrico Olivelli , Christopher Tubbs, Mate Szalay-Beko Closes #1345 from anmolnar/ZOOKEEPER-3813 (cherry picked from commit 391cb4aa6b54e19a028215e1340232a114c23ed3) Signed-off-by: Enrico Olivelli --- .../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