HADOOP-17936. Fix test failure after reverting HADOOP-16878 (#3482)

This commit is contained in:
Chao Sun 2021-09-27 13:56:22 -07:00 committed by GitHub
parent ae6cd4cea5
commit 7ed949600d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 5 deletions

View File

@ -27,8 +27,6 @@ import org.apache.hadoop.fs.contract.AbstractContractCopyFromLocalTest;
import org.apache.hadoop.fs.contract.AbstractFSContract; import org.apache.hadoop.fs.contract.AbstractFSContract;
import org.apache.hadoop.fs.contract.localfs.LocalFSContract; import org.apache.hadoop.fs.contract.localfs.LocalFSContract;
import static org.apache.hadoop.test.LambdaTestUtils.intercept;
public class TestLocalFSCopyFromLocal extends AbstractContractCopyFromLocalTest { public class TestLocalFSCopyFromLocal extends AbstractContractCopyFromLocalTest {
@Override @Override
protected AbstractFSContract createContract(Configuration conf) { protected AbstractFSContract createContract(Configuration conf) {
@ -37,14 +35,15 @@ public class TestLocalFSCopyFromLocal extends AbstractContractCopyFromLocalTest
@Test @Test
public void testDestinationFileIsToParentDirectory() throws Throwable { public void testDestinationFileIsToParentDirectory() throws Throwable {
describe("Source is a file and destination is its own parent directory"); describe("Source is a file and destination is its own parent directory. " +
"Copying will cause the source file to be deleted.");
File file = createTempFile("local"); File file = createTempFile("local");
Path dest = new Path(file.getParentFile().toURI()); Path dest = new Path(file.getParentFile().toURI());
Path src = new Path(file.toURI()); Path src = new Path(file.toURI());
intercept(PathOperationException.class, getFileSystem().copyFromLocalFile(true, true, src, dest);
() -> getFileSystem().copyFromLocalFile( true, true, src, dest)); assertPathDoesNotExist("Source found", src);
} }
@Test @Test