-
Notifications
You must be signed in to change notification settings - Fork 751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GOBBLIN-1582] Fill low/high watermark info in SourceState for QueryBasedSource #3436
Changes from all commits
7955422
ad140d2
22ad917
c541824
9643f15
b1e1156
614c214
a33eb2f
738e7e8
5c39233
ecbe466
4d6e4fa
7829349
1c3b568
b058034
adc7c88
1267f3d
c4d39fb
f7bdf3f
9f186b7
8315039
20f38cb
3ac49b1
54d15f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. minor, but for clarity I might replace with: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case I want to test whether the job can fail as expected. But assert.fail will not test anything and directly fail the test which is not what I want. Please let me know if I miss something here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I figured with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually... looks like it throws just prior to the (final) |
||
} | ||
}); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may not be an issue... just curious: when do we use
""
and when insteadUNKNOWN_VALUE
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me I think UNKONW_VALUE is not expected in most cases and indicate there is something wrong, but "" just indicate we don't set it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds reasonable