hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@hortonworks.com>
Subject Re: How can i understand parent is file
Date Tue, 08 Aug 2017 19:19:41 GMT

> On 8 Aug 2017, at 13:45, Fu, Yong <yong.fu@intel.com> wrote:
> 
> When test my code, I found this case failed, but can't understand why a parent can be
a file(org.apache.hadoop.fs.s3a. ITestS3AMiscOperations
> ) .
> 

Is this AWS S3 or another S3-compatible endpoint?

The test is expecting the test to fail with a FileAlreadyExistsException, that is: you can't
create a file under a file. If the test is passing, there's a problem, because the HEAD on
the parent entry wasn't interpreted as a file. Either it wasn't there, or it was mistaken
as a directory

Best fix here is to add some more assertions to see what's happening, then consider setting
a breakpoint on the test in your IDE

> @Test(expected = FileAlreadyExistsException.class)
> public void testCreateNonRecursiveParentIsFile() throws IOException {
>  Path parent = path("/file.txt");
>  ContractTestUtils.touch(getFileSystem(), parent);

add
ContractTestUtils.assertIsFile(getFileSystem(), parent);

>  createNonRecursive(new Path(parent, "fail"));

add 
ContractTestUtils.assertPathDoesNotExist(getFileSystem(), new Path(parent, "fail"));

> }
> 
> 
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: common-dev-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-dev-help@hadoop.apache.org


Mime
View raw message