Repository navigation
Description
Affected module
Backend
Describe the bug
When a test case is read with fields=testSuites, each embedded test suite keeps its incrementalChangeDescription. Only changeDescription is cleared.
incrementalChangeDescription is part of the stored suite JSON, so whatever the last change to the suite was is copied into every test case of that suite. For a logical suite this can be a list of all its test cases (for example after the PUT described in #38798), which makes every test case payload carry a copy of the whole suite's test list.
This copy does not stay in the API response. It also ends up in the test case's stored versions and events: on 2.0.1, every test case result write (POST /api/v1/dataQuality/testCases/testCaseResults/{fqn}) stored the test case with this embedded suite in change_event, successful_sent_change_events (one row per subscription), audit_log_event and entity_extension. With a 5 MB incrementalChangeDescription on a logical suite, each result write stored hundreds of KB (compressed) in each of these tables.
To Reproduce
- Create a logical test suite with some test cases and make a change to the suite that records a large change, for example the PUT in Logical test suite PUT records every test case as removed from tests #38798.
GET /api/v1/dataQuality/testSuites/{id}:incrementalChangeDescriptionholds that change.GET /api/v1/dataQuality/testCases/{id}?fields=testSuitesfor one of its test cases: the logical suite intestSuiteshaschangeDescription: nullbut still has the sameincrementalChangeDescription.- Post a result for that test case and look at the test case's
entityUpdatedrow in thechange_eventtable: the embedded suite, including theincrementalChangeDescription, is in the stored event.
Expected behavior
The embedded test suites carry no change history: both changeDescription and incrementalChangeDescription are cleared, as the code already intends for changeDescription.
OS
N/A (server behavior, not OS-specific)
Python version
N/A
OpenMetadata version
2.0.1 (observed). By reading the code, the same behavior is expected on 2.0.10 and main (6c23808).
OpenMetadata Ingestion package version
N/A
Additional context
Where it happens (from reading the code)
Both paths that fill testSuites call only .withChangeDescription(null):
- Single test case (
getTestSuites):- 2.0.10: https://github.com/open-metadata/OpenMetadata/blob/2.0.10-release/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseRepository.java#L910-L923
- main:
Lines 1020 to 1033 in 6c23808
private List<TestSuite> getTestSuites(TestCase test) { // `testSuites` field returns all the `testSuite` (executable and logical) linked to that // testCase List<CollectionDAO.EntityRelationshipRecord> records = findFromRecords(test.getId(), entityType, Relationship.CONTAINS, TEST_SUITE); List<TestSuite> suites = new ArrayList<>(records.size()); for (CollectionDAO.EntityRelationshipRecord record : records) { try { TestSuite suite = Entity.<TestSuite>getEntity( TEST_SUITE, record.getId(), "owners,domains,reviewers", Include.ALL, false) .withInherited(true) .withChangeDescription(null); suites.add(suite);
- Bulk (
setFieldsInBulk):- 2.0.10: https://github.com/open-metadata/OpenMetadata/blob/2.0.10-release/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseRepository.java#L430-L438
- main:
Lines 524 to 534 in 6c23808
UUID suiteId = UUID.fromString(record.getFromId()); TestSuite suite = suiteMap.get(suiteId); if (suite != null) { TestSuite copy = JsonUtils.readValue(JsonUtils.pojoToJson(suite), TestSuite.class) .withInherited(true) .withChangeDescription(null); testCaseToTestSuites.computeIfAbsent(testCaseId, k -> new ArrayList<>()).add(copy); } } for (TestCase testCase : testCases) {
Possible fix
Add .withIncrementalChangeDescription(null) next to .withChangeDescription(null) in both places.
Related
- Logical test suite PUT records every test case as removed from tests #38798: a PUT on a logical test suite records every test case as removed, which is what made the
incrementalChangeDescriptionlarge in our case.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNo status
Activity