> On 8 Aug 2017, at 13:45, Fu, Yong <yong...@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-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-dev-h...@hadoop.apache.org

Reply via email to