sadanand48 commented on code in PR #5885:
URL: https://github.com/apache/hadoop/pull/5885#discussion_r1275096942
##########
hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/TestCopyListing.java:
##########
@@ -167,6 +169,77 @@ public void testDuplicates() {
}
}
+ @Test(expected = DuplicateFileException.class, timeout = 10000)
+ public void testDiffBasedSimpleCopyListing() throws IOException {
+ FileSystem fs = null;
+ Configuration configuration = getConf();
+ DistCpSync distCpSync = Mockito.mock(DistCpSync.class);
+ Path listingFile = new Path("/tmp/list");
+ // Throws DuplicateFileException as it recursively traverses src3 directory
+ // and also adds 3.txt,4.txt twice
+ configuration.setBoolean(
+ DistCpConstants.CONF_LABEL_DIFF_COPY_LISTING_TRAVERSE_DIRECTORY, true);
+ try {
+ fs = FileSystem.get(getConf());
+ buildListingUsingSnapshotDiff(fs, configuration, distCpSync,
listingFile);
+ } catch (IOException e) {
+ LOG.error("Exception encountered in test", e);
Review Comment:
done.
##########
hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/TestCopyListing.java:
##########
@@ -167,6 +169,77 @@ public void testDuplicates() {
}
}
+ @Test(expected = DuplicateFileException.class, timeout = 10000)
+ public void testDiffBasedSimpleCopyListing() throws IOException {
+ FileSystem fs = null;
+ Configuration configuration = getConf();
+ DistCpSync distCpSync = Mockito.mock(DistCpSync.class);
+ Path listingFile = new Path("/tmp/list");
+ // Throws DuplicateFileException as it recursively traverses src3 directory
+ // and also adds 3.txt,4.txt twice
+ configuration.setBoolean(
+ DistCpConstants.CONF_LABEL_DIFF_COPY_LISTING_TRAVERSE_DIRECTORY, true);
+ try {
+ fs = FileSystem.get(getConf());
+ buildListingUsingSnapshotDiff(fs, configuration, distCpSync,
listingFile);
+ } catch (IOException e) {
+ LOG.error("Exception encountered in test", e);
+ Assert.fail("Test failed " + e.getMessage());
+ } finally {
+ TestDistCpUtils.delete(fs, "/tmp");
+ }
+ }
+
+ @Test(timeout=10000)
+ public void testDiffBasedSimpleCopyListingWithoutTraverseDirectory() {
+ FileSystem fs = null;
+ Configuration configuration = getConf();
+ DistCpSync distCpSync = Mockito.mock(DistCpSync.class);
+ Path listingFile = new Path("/tmp/list");
+ // no exception expected in this case
+ configuration.setBoolean(
+ DistCpConstants.CONF_LABEL_DIFF_COPY_LISTING_TRAVERSE_DIRECTORY,
false);
+ try {
+ fs = FileSystem.get(getConf());
+ buildListingUsingSnapshotDiff(fs, configuration, distCpSync,
listingFile);
+ } catch (IOException e) {
+ LOG.error("Exception encountered in test", e);
Review Comment:
done.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]