[ 
https://issues.apache.org/jira/browse/GOBBLIN-1582?focusedWorklogId=685501&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-685501
 ]

ASF GitHub Bot logged work on GOBBLIN-1582:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 23/Nov/21 21:00
            Start Date: 23/Nov/21 21:00
    Worklog Time Spent: 10m 
      Work Description: phet commented on a change in pull request #3436:
URL: https://github.com/apache/gobblin/pull/3436#discussion_r755499839



##########
File path: 
gobblin-utility/src/test/java/org/apache/gobblin/util/test/TestStressTestingSource.java
##########
@@ -168,4 +168,37 @@ public void testRunDuration() throws DataRecordException, 
IOException {
     Assert.assertTrue(Math.abs(timeSpentMicro - (RUN_DURATION_SECS * 1000000)) 
< (1000000),
         "Time spent " + timeSpentMicro);
   }
+
+  @Test
+  public void testThrowException() throws DataRecordException, IOException {
+    final int MEM_ALLOC_BYTES = 100;
+    final int NUM_WORK_UNITS = 1;
+    final int SLEEP_TIME_MICRO = 1000;
+    final int NUM_RECORDS = 30; // this config is ignored since the duration 
is set
+    final int RUN_DURATION_SECS = 5;
+
+    SourceState state = new SourceState();
+    state.setProp(StressTestingSource.NUM_WORK_UNITS_KEY, NUM_WORK_UNITS);
+    state.setProp(StressTestingSource.MEM_ALLOC_BYTES_KEY, MEM_ALLOC_BYTES);
+    state.setProp(StressTestingSource.SLEEP_TIME_MICRO_KEY, SLEEP_TIME_MICRO);
+    state.setProp(StressTestingSource.NUM_RECORDS_KEY, NUM_RECORDS);
+    state.setProp(StressTestingSource.RUN_DURATION_KEY, RUN_DURATION_SECS);
+    state.setProp(StressTestingSource.THROW_EXCEPTION, true);
+
+    StressTestingSource source = new StressTestingSource();
+
+    List<WorkUnit> wus = source.getWorkunits(state);
+    Assert.assertEquals(wus.size(), NUM_WORK_UNITS);
+
+    WorkUnit wu = wus.get(0);
+    WorkUnitState wuState = new WorkUnitState(wu, state);
+    Extractor<String, byte[]> extractor = source.getExtractor(wuState);
+
+    Assert.expectThrows(IOException.class, () -> {
+      byte[] record;
+      while ((record = extractor.readRecord(null)) != null) {
+        Assert.assertEquals(record.length, 100);

Review comment:
       actually... looks like it throws just prior to the (final) 
`extractor.readRecord(null)` call that would first return `null`.  so in that 
case, yes, leave as is and ignore my `Assert.fail` recommendation.




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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 685501)
    Time Spent: 1h 10m  (was: 1h)

> Fill low/high watermark info in SourceState for QueryBasedSource
> ----------------------------------------------------------------
>
>                 Key: GOBBLIN-1582
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-1582
>             Project: Apache Gobblin
>          Issue Type: Improvement
>            Reporter: Zihan Li
>            Priority: Major
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to