Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 92E22200CE0 for ; Fri, 11 Aug 2017 02:25:06 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 917FE16C7E2; Fri, 11 Aug 2017 00:25:06 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B1B4916C7E3 for ; Fri, 11 Aug 2017 02:25:05 +0200 (CEST) Received: (qmail 21190 invoked by uid 500); 11 Aug 2017 00:25:04 -0000 Mailing-List: contact issues-help@geode.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@geode.apache.org Delivered-To: mailing list issues@geode.apache.org Received: (qmail 21181 invoked by uid 99); 11 Aug 2017 00:25:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Aug 2017 00:25:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 937CDC05F0 for ; Fri, 11 Aug 2017 00:25:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id YDC4HAiAuPrh for ; Fri, 11 Aug 2017 00:25:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 4C4E45F21F for ; Fri, 11 Aug 2017 00:25:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 79928E065D for ; Fri, 11 Aug 2017 00:25:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 234CD2415E for ; Fri, 11 Aug 2017 00:25:00 +0000 (UTC) Date: Fri, 11 Aug 2017 00:25:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@geode.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (GEODE-3413) Overhaul launcher tests and process tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 11 Aug 2017 00:25:06 -0000 [ https://issues.apache.org/jira/browse/GEODE-3413?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16122598#comment-16122598 ] ASF GitHub Bot commented on GEODE-3413: --------------------------------------- Github user kirklund commented on a diff in the pull request: https://github.com/apache/geode/pull/699#discussion_r132599897 --- Diff: geode-core/src/main/java/org/apache/geode/internal/process/LocalProcessLauncher.java --- @@ -96,33 +117,55 @@ void close() { * @throws IOException if unable to create or write to the file */ private void writePid(final boolean force) throws FileAlreadyExistsException, IOException { - final boolean created = this.pidFile.createNewFile(); - if (!created && !force) { - int otherPid = 0; - try { - otherPid = ProcessUtils.readPid(this.pidFile); - } catch (IOException e) { - // suppress - } catch (NumberFormatException e) { - // suppress - } - boolean ignorePidFile = false; - if (otherPid != 0 && !ignoreIsPidAlive()) { - ignorePidFile = !ProcessUtils.isProcessAlive(otherPid); - } - if (!ignorePidFile) { - throw new FileAlreadyExistsException("Pid file already exists: " + this.pidFile + " for " - + (otherPid > 0 ? "process " + otherPid : "unknown process")); + if (this.pidFile.exists()) { + if (!force) { + checkOtherPid(readOtherPid()); } + this.pidFile.delete(); + } + + assert !this.pidFile.exists(); --- End diff -- Did you like the use of Validate? I'm not sure how I feel about Validate after using it heavily in this package. Jianxia added the asserts when he fixed a bug in this method and I just left them in place. I think we could easily change them to Validate calls or remove them altogether. > Overhaul launcher tests and process tests > ----------------------------------------- > > Key: GEODE-3413 > URL: https://issues.apache.org/jira/browse/GEODE-3413 > Project: Geode > Issue Type: Improvement > Components: gfsh > Reporter: Kirk Lund > Assignee: Kirk Lund > Labels: LauncherTest, ProcessTest > > The launcher and process tests are closely related and in need of overhauling to improve debugging and remove flakiness. > In addition, the org.apache.geode.internal.process package is need of improving the test code coverage. > Launcher tests: > * geode-assembly/src/test/java/org/apache/geode/distributed/LocatorLauncherAssemblyIntegrationTest.java > * geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherIntegrationTest.java > * geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherServiceStatusTest.java > * geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherTest.java > * geode-core/src/test/java/org/apache/geode/distributed/LauncherMemberMXBeanIntegrationTest.java > * geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherIntegrationTest.java > * geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherLocalFileIntegrationTest.java > * geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherLocalIntegrationTest.java > * geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherRemoteFileIntegrationTest.java > * geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherRemoteIntegrationTest.java > * geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherRemoteWithCustomLoggingIntegrationTest.java > * geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java > * geode-core/src/test/java/org/apache/geode/distributed/LocatorStateTest.java > * geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherIntegrationTest.java > * geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherLocalFileIntegrationTest.java > * geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherLocalIntegrationTest.java > * geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherRemoteFileIntegrationTest.java > * geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherRemoteIntegrationTest.java > * geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherRemoteWithCustomLoggingIntegrationTest.java > * geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherRemoteWithCustomLoggingIntegrationTest.java > * geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java > * geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherWithProviderIntegrationTest.java > Process tests: > * geode-core/src/test/java/org/apache/geode/internal/process/BlockingProcessStreamReaderJUnitTest.java > * geode-core/src/test/java/org/apache/geode/internal/process/FileProcessControllerIntegrationJUnitTest.java > * geode-core/src/test/java/org/apache/geode/internal/process/LocalProcessControllerJUnitTest.java > * geode-core/src/test/java/org/apache/geode/internal/process/LocalProcessLauncherDUnitTest.java > * geode-core/src/test/java/org/apache/geode/internal/process/LocalProcessLauncherJUnitTest.java > * geode-core/src/test/java/org/apache/geode/internal/process/NonBlockingProcessStreamReaderJUnitTest.java > * geode-core/src/test/java/org/apache/geode/internal/process/PidFileJUnitTest.java > * geode-core/src/test/java/org/apache/geode/internal/process/ProcessControllerFactoryJUnitTest.java -- This message was sent by Atlassian JIRA (v6.4.14#64029)