You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by Steve Loughran <st...@hortonworks.com> on 2017/08/08 19:19:41 UTC
Re: How can i understand parent is file
> On 8 Aug 2017, at 13:45, Fu, Yong <yo...@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