steveloughran commented on code in PR #5364:
URL: https://github.com/apache/hadoop/pull/5364#discussion_r1146801468
##########
hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/TestDistCpSync.java:
##########
@@ -1303,12 +1303,13 @@ public void testSyncSnapshotDiffWithDummyFileSystem()
throws Exception {
FileSystem dummyFs = FileSystem.get(URI.create("dummy:///"), conf);
Assert.assertTrue(dummyFs instanceof DummyFs);
new DistCp(conf, OptionsParser.parse(args)).execute();
+ } catch (UnsupportedOperationException e) {
+ Assert.fail("Dummy FS supports snapshots," +
Review Comment:
if you just rethrow e here, then the caller gets a full stack.
##########
hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/TestDistCpSync.java:
##########
@@ -1276,4 +1283,64 @@ private void snapshotDiffWithPaths(Path sourceFSPath,
verifyCopyByFs(sourceFS, targetFS, sourceFS.getFileStatus(sourceFSPath),
targetFS.getFileStatus(targetFSPath), false);
}
+
+ @Test
+ public void testSyncSnapshotDiffWithLocalFileSystem() throws Exception {
+ String[] args = new String[]{"-update", "-diff", "s1", "s2",
+ "file:///source", "file:///target"};
+ LambdaTestUtils.intercept(
+ UnsupportedOperationException.class,
+ "The source file system file does not support snapshot",
+ () -> new DistCp(conf, OptionsParser.parse(args)).execute());
+ }
+
+ @Test
+ public void testSyncSnapshotDiffWithDummyFileSystem() throws Exception {
+ String[] args =
+ new String[] { "-update", "-diff", "s1", "s2", "dummy:///source",
+ "dummy:///target" };
+ try {
+ FileSystem dummyFs = FileSystem.get(URI.create("dummy:///"), conf);
+ Assert.assertTrue(dummyFs instanceof DummyFs);
Review Comment:
not very informative. I'd prefer an assertJ assertion that the class is an
instance of,
```
assertThat(dummyfs).isInstanceOf()...
```
--
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]