ISSUE #20962 - Issues with test case alerts (#21253)

* fix: test case alerts and un-indexable fields

* fix: test case alerts and un-indexable fields

(cherry picked from commit b1edb964699c1d365b9e1154f05591e4b26ebb21)
This commit is contained in:
Teddy 2025-05-18 22:59:05 +02:00 committed by Teddy Crepineau
parent 05cb6818ac
commit c804336e66
6 changed files with 25 additions and 4 deletions

View File

@ -3993,7 +3993,7 @@ public abstract class EntityRepository<T extends EntityInterface> {
sessionTimeoutMillis = timeout;
}
private boolean consolidateChanges(T original, T updated, Operation operation) {
protected boolean consolidateChanges(T original, T updated, Operation operation) {
// If user is the same and the new update is with in the user session timeout
return original.getVersion() > 0.1 // First update on an entity that
&& operation == Operation.PATCH

View File

@ -710,6 +710,11 @@ public class TestCaseRepository extends EntityRepository<TestCase> {
super(original, updated, operation);
}
@Override
protected boolean consolidateChanges(TestCase original, TestCase updated, Operation operation) {
return false;
}
@Transaction
@Override
public void entitySpecificUpdate(boolean consolidatingChanges) {
@ -754,6 +759,7 @@ public class TestCaseRepository extends EntityRepository<TestCase> {
original.getUseDynamicAssertion(),
updated.getUseDynamicAssertion());
recordChange("testCaseStatus", original.getTestCaseStatus(), updated.getTestCaseStatus());
recordChange("testCaseResult", original.getTestCaseResult(), updated.getTestCaseResult());
}
}

View File

@ -243,10 +243,17 @@ public class TestCaseResultRepository extends EntityTimeSeriesRepository<TestCas
resultSummaries.stream()
.filter(s -> s.getTestCaseName().equals(testCase.getFullyQualifiedName()))
.findFirst()
.ifPresent(
.ifPresentOrElse(
s -> {
s.setStatus(testCase.getTestCaseStatus());
s.setTimestamp(testCase.getTestCaseResult().getTimestamp());
},
() -> {
resultSummaries.add(
new ResultSummary()
.withTestCaseName(testCase.getFullyQualifiedName())
.withStatus(testCase.getTestCaseStatus())
.withTimestamp(testCase.getTestCaseResult().getTimestamp()));
});
} else {
testSuite.setTestCaseResultSummary(

View File

@ -565,6 +565,12 @@ public class TestSuiteRepository extends EntityRepository<TestSuite> {
super(original, updated, operation);
}
@Override
protected boolean consolidateChanges(
TestSuite original, TestSuite updated, Operation operation) {
return false;
}
@Transaction
@Override
public void entitySpecificUpdate(boolean consolidatingChanges) {

View File

@ -16,7 +16,8 @@ import org.openmetadata.service.search.SearchIndexUtils;
import org.openmetadata.service.search.models.SearchSuggest;
public record TestCaseIndex(TestCase testCase) implements SearchIndex {
private static final Set<String> excludeFields = Set.of("changeDescription", "failedRowsSample");
private static final Set<String> excludeFields =
Set.of("changeDescription", "failedRowsSample", "incrementalChangeDescription");
@Override
public Object getEntity() {

View File

@ -16,7 +16,8 @@ import org.openmetadata.service.search.SearchIndexUtils;
import org.openmetadata.service.util.JsonUtils;
public record TestCaseResultIndex(TestCaseResult testCaseResult) implements SearchIndex {
private static final Set<String> excludeFields = Set.of("changeDescription", "failedRowsSample");
private static final Set<String> excludeFields =
Set.of("changeDescription", "failedRowsSample", "incrementalChangeDescription");
@Override
public Object getEntity() {