mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-25 17:04:54 +00:00
fix: alerting for entiyFQN filter and testResult filter for test cases (#13113)
* fix: alerting for entiyFQN filter and testResult filter for test cases * fix: handle empty array
This commit is contained in:
parent
b6bab6c7dd
commit
5d780dc8eb
@ -10,6 +10,7 @@ import static org.openmetadata.service.Entity.TEST_CASE;
|
|||||||
import static org.openmetadata.service.Entity.USER;
|
import static org.openmetadata.service.Entity.USER;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -19,6 +20,7 @@ import org.openmetadata.schema.entity.services.ingestionPipelines.PipelineStatus
|
|||||||
import org.openmetadata.schema.entity.services.ingestionPipelines.PipelineStatusType;
|
import org.openmetadata.schema.entity.services.ingestionPipelines.PipelineStatusType;
|
||||||
import org.openmetadata.schema.entity.teams.Team;
|
import org.openmetadata.schema.entity.teams.Team;
|
||||||
import org.openmetadata.schema.entity.teams.User;
|
import org.openmetadata.schema.entity.teams.User;
|
||||||
|
import org.openmetadata.schema.tests.TestCase;
|
||||||
import org.openmetadata.schema.tests.type.TestCaseResult;
|
import org.openmetadata.schema.tests.type.TestCaseResult;
|
||||||
import org.openmetadata.schema.tests.type.TestCaseStatus;
|
import org.openmetadata.schema.tests.type.TestCaseStatus;
|
||||||
import org.openmetadata.schema.type.ChangeEvent;
|
import org.openmetadata.schema.type.ChangeEvent;
|
||||||
@ -100,6 +102,9 @@ public class AlertsRuleEvaluator {
|
|||||||
}
|
}
|
||||||
EntityInterface entity = getEntity(changeEvent);
|
EntityInterface entity = getEntity(changeEvent);
|
||||||
for (String name : entityNames) {
|
for (String name : entityNames) {
|
||||||
|
if (changeEvent.getEntityType().equals(TEST_CASE) && ((TestCase) entity).getEntityFQN().equals(name)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (entity.getFullyQualifiedName().equals(name)) {
|
if (entity.getFullyQualifiedName().equals(name)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -159,7 +164,14 @@ public class AlertsRuleEvaluator {
|
|||||||
// in case the entity is not test case return since the filter doesn't apply
|
// in case the entity is not test case return since the filter doesn't apply
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
for (FieldChange fieldChange : changeEvent.getChangeDescription().getFieldsUpdated()) {
|
|
||||||
|
// we need to handle both fields updated and fields added
|
||||||
|
List<FieldChange> fieldChanges = changeEvent.getChangeDescription().getFieldsUpdated();
|
||||||
|
if (!changeEvent.getChangeDescription().getFieldsAdded().isEmpty()) {
|
||||||
|
fieldChanges.addAll(changeEvent.getChangeDescription().getFieldsAdded());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (FieldChange fieldChange : fieldChanges) {
|
||||||
if (fieldChange.getName().equals("testCaseResult") && fieldChange.getNewValue() != null) {
|
if (fieldChange.getName().equals("testCaseResult") && fieldChange.getNewValue() != null) {
|
||||||
TestCaseResult testCaseResult = (TestCaseResult) fieldChange.getNewValue();
|
TestCaseResult testCaseResult = (TestCaseResult) fieldChange.getNewValue();
|
||||||
TestCaseStatus status = testCaseResult.getTestCaseStatus();
|
TestCaseStatus status = testCaseResult.getTestCaseStatus();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user