mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-31 04:14:34 +00:00
fix: handle potential null pointer in test case reindex (#17100)
This commit is contained in:
parent
b1abb7cced
commit
b568444d5e
@ -26,8 +26,10 @@ public record TestCaseIndex(TestCase testCase) implements SearchIndex {
|
|||||||
public void removeNonIndexableFields(Map<String, Object> esDoc) {
|
public void removeNonIndexableFields(Map<String, Object> esDoc) {
|
||||||
SearchIndex.super.removeNonIndexableFields(esDoc);
|
SearchIndex.super.removeNonIndexableFields(esDoc);
|
||||||
List<Map<String, Object>> testSuites = (List<Map<String, Object>>) esDoc.get("testSuites");
|
List<Map<String, Object>> testSuites = (List<Map<String, Object>>) esDoc.get("testSuites");
|
||||||
for (Map<String, Object> testSuite : testSuites) {
|
if (testSuites != null) {
|
||||||
SearchIndexUtils.removeNonIndexableFields(testSuite, excludeFields);
|
for (Map<String, Object> testSuite : testSuites) {
|
||||||
|
SearchIndexUtils.removeNonIndexableFields(testSuite, excludeFields);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2049,6 +2049,12 @@ public class TestCaseResourceTest extends EntityResourceTest<TestCase, CreateTes
|
|||||||
assertNull(doc.get("changeDescription"));
|
assertNull(doc.get("changeDescription"));
|
||||||
List<Map<String, Object>> testSuites = (List<Map<String, Object>>) doc.get("testSuites");
|
List<Map<String, Object>> testSuites = (List<Map<String, Object>>) doc.get("testSuites");
|
||||||
assertNull(testSuites.get(0).get("changeDescription"));
|
assertNull(testSuites.get(0).get("changeDescription"));
|
||||||
|
|
||||||
|
// Remove changeDescription logic handles null testSuites
|
||||||
|
testCase.setTestSuites(null);
|
||||||
|
doc = JsonUtils.convertValue(testCase, Map.class);
|
||||||
|
testCaseIndex = new TestCaseIndex(testCase);
|
||||||
|
testCaseIndex.removeNonIndexableFields(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteTestCaseResult(String fqn, Long timestamp, Map<String, String> authHeaders)
|
public void deleteTestCaseResult(String fqn, Long timestamp, Map<String, String> authHeaders)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user