use of org.apache.gobblin.runtime.troubleshooter.Issue in project incubator-gobblin by apache.
the class MySqlMultiContextIssueRepositoryTest method willPreserveIssueOrder.
@Test
public void willPreserveIssueOrder() throws Exception {
Random random = new Random(1);
List<Issue> issues = new ArrayList<>();
String contextId = "context-" + testId;
for (int i = 0; i < 100; i++) {
Issue issue = getTestIssue("test-" + random.nextInt(), "code-" + random.nextInt());
issues.add(issue);
repository.put(contextId, issue);
}
List<Issue> retrievedIssues = repository.getAll(contextId);
assertThat(retrievedIssues).usingRecursiveComparison().isEqualTo(issues);
}
use of org.apache.gobblin.runtime.troubleshooter.Issue in project incubator-gobblin by apache.
the class MySqlMultiContextIssueRepositoryTest method canRemoveOlderIssues.
@Test
public void canRemoveOlderIssues() throws Exception {
String contextId = "context-" + testId;
int issueCount = 100;
ZonedDateTime startTime = ZonedDateTime.now().withNano(0).withZoneSameInstant(ZoneOffset.UTC);
for (int i = 0; i < 100; i++) {
Issue issue = Issue.builder().summary("test summary").code("code-" + i).time(startTime.minus(Duration.ofDays(issueCount - i))).severity(IssueSeverity.ERROR).build();
repository.put(contextId, issue);
}
repository.deleteIssuesOlderThan(startTime.minus(Duration.ofDays(20).plus(Duration.ofHours(1))));
List<Issue> retrievedIssues = repository.getAll(contextId);
assertThat(retrievedIssues).hasSize(20);
}
use of org.apache.gobblin.runtime.troubleshooter.Issue in project incubator-gobblin by apache.
the class FlowExecutionResourceLocalHandler method convertIssueToRestApiObject.
private static org.apache.gobblin.service.Issue convertIssueToRestApiObject(Issue issues) {
org.apache.gobblin.service.Issue converted = new org.apache.gobblin.service.Issue();
converted.setCode(issues.getCode()).setSummary(ObjectUtils.firstNonNull(issues.getSummary(), "")).setDetails(ObjectUtils.firstNonNull(issues.getDetails(), "")).setSeverity(IssueSeverity.valueOf(issues.getSeverity().name())).setTime(issues.getTime().toInstant().toEpochMilli());
if (issues.getProperties() != null) {
converted.setProperties(new StringMap(issues.getProperties()));
} else {
converted.setProperties(new StringMap());
}
return converted;
}
use of org.apache.gobblin.runtime.troubleshooter.Issue in project gobblin by apache.
the class MySqlMultiContextIssueRepositoryTest method canPutIssueRepeatedly.
@Test
public void canPutIssueRepeatedly() throws Exception {
Issue issue = getTestIssue("test", "test1");
String contextId = "context-" + testId;
repository.put(contextId, issue);
repository.put(contextId, issue);
List<Issue> issues = repository.getAll(contextId);
assertThat(issues).hasSize(1);
assertThat(issues.get(0)).usingRecursiveComparison().isEqualTo(issue);
}
use of org.apache.gobblin.runtime.troubleshooter.Issue in project gobblin by apache.
the class MySqlMultiContextIssueRepositoryTest method canPutIssueWithMaximumFieldLengths.
@Test
public void canPutIssueWithMaximumFieldLengths() throws Exception {
// summary and details are bounded at 16MB, so we just put reasonably large values there
Issue issue = Issue.builder().summary(StringUtils.repeat("s", 100000)).details(StringUtils.repeat("s", 100000)).code(StringUtils.repeat("c", Issue.MAX_ISSUE_CODE_LENGTH)).exceptionClass(StringUtils.repeat("e", Issue.MAX_CLASSNAME_LENGTH)).sourceClass(StringUtils.repeat("s", Issue.MAX_CLASSNAME_LENGTH)).time(ZonedDateTime.now().withNano(0).withZoneSameInstant(ZoneOffset.UTC)).severity(IssueSeverity.WARN).build();
String contextId = TroubleshooterUtils.getContextIdForJob(StringUtils.repeat("g", ServiceConfigKeys.MAX_FLOW_GROUP_LENGTH), StringUtils.repeat("f", ServiceConfigKeys.MAX_FLOW_NAME_LENGTH), String.valueOf(Long.MAX_VALUE), StringUtils.repeat("j", ServiceConfigKeys.MAX_JOB_NAME_LENGTH));
repository.put(contextId, issue);
List<Issue> issues = repository.getAll(contextId);
assertThat(issues).hasSize(1);
assertThat(issues.get(0)).usingRecursiveComparison().isEqualTo(issue);
}
Aggregations