steveloughran commented on a change in pull request #974: HDFS-9913.DispCp
doesn't use Trash with -delete option
URL: https://github.com/apache/hadoop/pull/974#discussion_r302509471
##########
File path:
hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/TestDistCpOptions.java
##########
@@ -225,6 +225,45 @@ public void testSetDeleteMissing() {
}
}
+ @Test
+ public void testDeleteMissingUseTrash() {
+ final DistCpOptions.Builder builder = new DistCpOptions.Builder(
+ Collections.singletonList(new Path("hdfs://localhost:8020/source")),
+ new Path("hdfs://localhost:8020/target/"));
+ Assert.assertFalse(builder.build().shouldDeleteUseTrash());
+
+ DistCpOptions options = builder.withSyncFolder(true)
+ .withDeleteMissing(true)
+ .withDeleteUseTrash(true)
+ .build();
+ Assert.assertTrue(options.shouldSyncFolder());
+ Assert.assertTrue(options.shouldDeleteMissing());
+ Assert.assertTrue(options.shouldDeleteUseTrash());
+
+ options = new DistCpOptions.Builder(
+ Collections.singletonList(new Path("hdfs://localhost:8020/source")),
+ new Path("hdfs://localhost:8020/target/"))
+ .withOverwrite(true)
+ .withDeleteMissing(true)
+ .withDeleteUseTrash(true)
+ .build();
+ Assert.assertTrue(options.shouldDeleteUseTrash());
+ Assert.assertTrue(options.shouldOverwrite());
+ Assert.assertTrue(options.shouldDeleteMissing());
+
+ try {
Review comment:
Use `LambdaTestUtils.intercept()` here; there are plenty other examples in
the code
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]