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 CBE90200BFE for ; Mon, 16 Jan 2017 14:45:45 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id CA70F160B30; Mon, 16 Jan 2017 13:45:45 +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 EC2FB160B22 for ; Mon, 16 Jan 2017 14:45:44 +0100 (CET) Received: (qmail 32454 invoked by uid 500); 16 Jan 2017 13:45:44 -0000 Mailing-List: contact dev-help@datafu.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@datafu.incubator.apache.org Delivered-To: mailing list dev@datafu.incubator.apache.org Received: (qmail 32443 invoked by uid 99); 16 Jan 2017 13:45:43 -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; Mon, 16 Jan 2017 13:45:43 +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 589E9C0C80 for ; Mon, 16 Jan 2017 13:45:43 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -2.794 X-Spam-Level: X-Spam-Status: No, score=-2.794 tagged_above=-999 required=6.31 tests=[DKIM_ADSP_CUSTOM_MED=0.001, FORGED_YAHOO_RCVD=1.022, HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=2, KAM_LAZY_DOMAIN_SECURITY=1, NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-2.999, URIBL_BLOCKED=0.001] 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 Z3jFGy_R_c35 for ; Mon, 16 Jan 2017 13:45:41 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 2AAAC5F297 for ; Mon, 16 Jan 2017 13:45:39 +0000 (UTC) Received: (qmail 32422 invoked by uid 99); 16 Jan 2017 13:45:39 -0000 Received: from reviews-vm.apache.org (HELO reviews.apache.org) (140.211.11.40) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jan 2017 13:45:39 +0000 Received: from reviews.apache.org (localhost [127.0.0.1]) by reviews.apache.org (Postfix) with ESMTP id AEA0B31499C; Mon, 16 Jan 2017 13:45:38 +0000 (UTC) Content-Type: multipart/alternative; boundary="===============3940964797607055001==" MIME-Version: 1.0 Subject: Re: Review Request 55110: DATAFU-106 Test files are currently created in the subdirectory folder (e.g. datafu-pig/input*). For better organization, they should be created in a subdirectory. From: Eyal Allweil To: Matthew Hayes Cc: DataFu , Piyush Sharma , Eyal Allweil Date: Mon, 16 Jan 2017 13:45:38 -0000 Message-ID: <20170116134538.28414.29129@reviews.apache.org> X-ReviewBoard-URL: https://reviews.apache.org/ Auto-Submitted: auto-generated Sender: Eyal Allweil X-ReviewGroup: DataFu X-Auto-Response-Suppress: DR, RN, OOF, AutoReply X-ReviewRequest-URL: https://reviews.apache.org/r/55110/ X-Sender: Eyal Allweil References: <20170102092943.5940.12327@reviews.apache.org> In-Reply-To: <20170102092943.5940.12327@reviews.apache.org> X-ReviewBoard-Diff-For: datafu-pig/src/test/java/datafu/test/pig/test_filesSubdir/TestFilesSubdirTest.java Reply-To: Eyal Allweil X-ReviewRequest-Repository: datafu archived-at: Mon, 16 Jan 2017 13:45:46 -0000 --===============3940964797607055001== MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit > On Jan. 2, 2017, 11:29 a.m., Eyal Allweil wrote: > > Hi Piyush, > > > > Thank you for your patch! It looks to me that it works fine - I ran our tests on Ubuntu, both from Eclipse and from the command line. > > > > I have two comments, one "real" and one just a typo: > > > > 1) From [this question](http://stackoverflow.com/a/840229/150992), it appears that changing the *user.dir* property in this way can be unpredictable - that it won't affect FileOutputStreams, for example. So although this works for our current tests (the FileOutputStream used in datafu.pig.linkanalysis.PageRank uses *File.createTempFile* instead of the working dir, so it's fine) I worry that this might not work in the future. Maybe add a comment about this in the *beforeClass* method? > > > > 2) "Location" is spelled as "loaction" in PigTests.java > > > > Cheers, > > Eyal > > Piyush Sharma wrote: > Hi Eyal, > > Thank you for reviewing it. > > 1) I've actually tried doing it without changing user.dir. The pigtests don't actually work that way (for eg: LOAD 'input'... searches for the file in the working directory and it apparently deciphers it to be the same as that of the jvm). Hence, this was the only possible way to solve the issue that I could think of. > > I also went through that stackoverflow question whilst creating the patch to resolve my suspicions about the same. Actually, as even the accepted answer says it does affect the subsequent file creations, which happens via a call to writeLinesToFile defined in the PigTests.java which always creates a new file, deleting the existing one if necessary, and then writes to it. Now since writeLinesToFile also implicitly uses FileOutputStream (via a FileWriter object) to write to files just created in the new user.dir, it seemed like changing the working directory did actually affect the FileOutPutStreams, atleast as far as our project goes it did. Moreover the afterMethod resets the user.dir so hopefully there aren't any consequences at all. > > I can add some comment like "//Only some classes reflect the changes in working directory" or something like "//Developers are requested to just work with absoluteFiles and absolutePaths to avoid IOExceptions and such" but I feel it throws up a red flag unnecessarily, so should I ? > > 2) I will surely correct the typo, thank you. > > Cheerio, > Piyush I think this is fine - after all, all existing tests pass. One more very minor comment - I think I'd just put the test in the main java/datafu/test dir - I don't think there's a need for a subdirectory for it. - Eyal ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/55110/#review160317 ----------------------------------------------------------- On Jan. 6, 2017, 10:51 p.m., Piyush Sharma wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/55110/ > ----------------------------------------------------------- > > (Updated Jan. 6, 2017, 10:51 p.m.) > > > Review request for DataFu and Matthew Hayes. > > > Repository: datafu > > > Description > ------- > > DATAFU-106: Test files are currently created in the subdirectory folder (e.g. datafu-pig/input*). For better organization, they should be created in a subdirectory. This also makes it easier to exclude them all with gitignore. > (issue: https://issues.apache.org/jira/browse/DATAFU-106) > > > Diffs > ----- > > datafu-pig/src/test/java/datafu/test/pig/PigTests.java d1d6fcc > datafu-pig/src/test/java/datafu/test/pig/test_filesSubdir/TestFilesSubdirTest.java PRE-CREATION > > Diff: https://reviews.apache.org/r/55110/diff/ > > > Testing > ------- > > unit tests passed. > > > Thanks, > > Piyush Sharma > > --===============3940964797607055001==--