Re: Handling files and user.dir in tests

2018-01-22 Thread Bruce Schuchardt
+1 to not modifying user.dir We should remove the unit test Rules that are doing this. On 1/22/18 10:00 AM, Kirk Lund wrote: I started filing subtasks for GEODE-4180, but I came to the conclusion that I don't really want to be involved in this. I'd rather see tests be changed to not mutate "us

Re: Handling files and user.dir in tests

2018-01-22 Thread Kirk Lund
I started filing subtasks for GEODE-4180, but I came to the conclusion that I don't really want to be involved in this. I'd rather see tests be changed to not mutate "user.dir". I think the test authors should find a different way to test Geode. I've renamed the test summary: GEODE-4180: Tests sh

Re: Handling files and user.dir in tests

2018-01-09 Thread Kirk Lund
Looks like everyone supports this change. I’m going to change the Jira ticket into an epic and create a few sub-tasks. I’ll also specify going through some centralized mechanism that determines the parent dir. Thanks for all the input! On Mon, Jan 8, 2018 at 11:47 AM Darrel Schneider wrote: > S

Re: Handling files and user.dir in tests

2018-01-08 Thread Kirk Lund
Actually, that's what is causing the problem. Those Rules are mutating the system property "user.dir" at runtime which is not supposed to be mutated. However, if we change all new File calls in product code to use System.getProperty("user.dir") as the parent dir then the problem is fixed. Another

Re: Handling files and user.dir in tests

2018-01-08 Thread Anilkumar Gingade
+1 for using @Rule for any file creation... -Anil. On Mon, Jan 8, 2018 at 11:26 AM, Patrick Rhomberg wrote: > The ClusterStartupRule, LocatorStarterRule, and ServerStarterRule rules all > have withTempWorkingDir methods that should take care of this, as well. > These temporary directories shou

Re: Handling files and user.dir in tests

2018-01-08 Thread Darrel Schneider
Should geode have a single method it uses to create File instances? That way the code that determines the parent dir could be in one place. On Mon, Jan 8, 2018 at 11:26 AM, Patrick Rhomberg wrote: > The ClusterStartupRule, LocatorStarterRule, and ServerStarterRule rules all > have withTempWorki

Re: Handling files and user.dir in tests

2018-01-08 Thread Patrick Rhomberg
The ClusterStartupRule, LocatorStarterRule, and ServerStarterRule rules all have withTempWorkingDir methods that should take care of this, as well. These temporary directories should be removed as part of the rules @After invocation. On Mon, Jan 8, 2018 at 10:23 AM, Jinmei Liao wrote: > +1 for

Re: Handling files and user.dir in tests

2018-01-08 Thread Jinmei Liao
+1 for always using absolute path in our product code. Also the server/locator launchers should be able to take a working-dir as parameter to store all the stat/logs/config files. On Fri, Jan 5, 2018 at 3:49 PM, Kirk Lund wrote: > The from should be: > > this.viewFile = new File("locator" +

Re: Handling files and user.dir in tests

2018-01-05 Thread Kirk Lund
The from should be: this.viewFile = new File("locator" + server.getPort() + "view.dat"); On Fri, Jan 5, 2018 at 3:48 PM, Kirk Lund wrote: > Just to help facilitate the discussion, here's a pull request that changes > GMSLocator from: > > this.viewFile = new File(System.getProperty("user

Re: Handling files and user.dir in tests

2018-01-05 Thread Kirk Lund
Just to help facilitate the discussion, here's a pull request that changes GMSLocator from: this.viewFile = new File(System.getProperty("user.dir"), "locator" + server.getPort() + "view.dat"); ...to: this.viewFile = new File(System.getProperty("user.dir"), "locator" + server.getPort() +

Handling files and user.dir in tests

2018-01-05 Thread Kirk Lund
Any calls such as: File file = new File("myfile"); ...results in creating a file in the current working directory of IntelliJ or Gradle when executing the test. I previously made a change to Gfsh so that tests can pass in a parent directory which will be used instead. This allowed me to chan