meethngala commented on code in PR #3542:
URL: https://github.com/apache/gobblin/pull/3542#discussion_r963805094


##########
gobblin-data-management/src/test/java/org/apache/gobblin/data/management/copy/CopySourceTest.java:
##########
@@ -339,4 +344,39 @@ public void testDefaultHiveDatasetShardTempPaths()
       Assert.assertEquals(datasetPaths.contains(tempDirRoot + 
"/targetPath/testDB/table" + i), true);
     }
   }
+
+  @Test (expectedExceptions = RuntimeException.class)
+  public void testGetWorkUnitsExecutionFastFailure() {
+
+    SourceState state = new SourceState();
+
+    state.setProp(ConfigurationKeys.SOURCE_FILEBASED_FS_URI, "file:///");
+    state.setProp(ConfigurationKeys.WRITER_FILE_SYSTEM_URI, "file:///");
+    state.setProp(ConfigurationKeys.DATA_PUBLISHER_FINAL_DIR, "/target/dir");
+    state.setProp(DatasetUtils.DATASET_PROFILE_CLASS_KEY,
+        TestCopyablePartitionableDatasedFinder.class.getCanonicalName());
+    state.setProp(ConfigurationKeys.COPY_SOURCE_FILESET_WU_GENERATOR_CLASS, 
MockedFileSetWorkUnitGenerator.class.getName());
+    state.setProp(ConfigurationKeys.WORK_UNIT_FAST_FAIL_ENABLED, true);
+
+    CopySource source = new CopySource();
+
+    List<WorkUnit> workunits = source.getWorkunits(state);
+    Assert.assertNull(workunits);
+  }
+
+  class MockedFileSetWorkUnitGenerator extends 
CopySource.FileSetWorkUnitGenerator {
+
+    public MockedFileSetWorkUnitGenerator(CopyableDatasetBase copyableDataset, 
FileSet<CopyEntity> fileSet, State state,
+        FileSystem targetFs, SetMultimap<FileSet<CopyEntity>, WorkUnit> 
workUnitList,
+        Optional<CopyableFileWatermarkGenerator> watermarkGenerator, long 
minWorkUnitWeight,
+        Optional<LineageInfo> lineageInfo) {
+      super(copyableDataset, fileSet, state, targetFs, workUnitList, 
watermarkGenerator, minWorkUnitWeight,
+          lineageInfo);
+    }
+
+    @Override
+    public Void call(){
+      return null;

Review Comment:
   Yes, that makes sense! I have taken your suggestion and updated my PR 
accordingly



-- 
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]

Reply via email to