Repository navigation
Expose test case definitions to Data Insights so charts can count them - #37459
Conversation
Code Review ✅ Approved 1 closed / 1 findings🟡 Medium risk · Aliasing live test cases into Data Insights and rewriting chart scopes could miscount data-asset totals if filters diverge. Exposes test case definitions to Data Insights through the ✅ 1 closedClosed: Quality: No decision record for how test cases are exposed to Data Insights
VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
| "parentAliases": ["testSuite", "all", "dataAssetEmbeddings"], | ||
| "childAliases": ["testCaseResolutionStatus", "testCaseResult"] | ||
| "childAliases": ["testCaseResolutionStatus", "testCaseResult"], | ||
| "dataInsightAliases": ["di-data-assets-testcase"] |
There was a problem hiding this comment.
Charts built on Test Case always come back empty.
Only non-live charts read this alias, and they filter di-data-assets-* on an @timestamp range (OpenSearchLineChartAggregator.java#L198-L209). Test case documents have no @timestamp, so they never match. Live charts don't read this alias either: they query searchIndex (here testCase) or all (getLiveSearchIndex), and both already held test cases before this PR. So in practice, all the alias does is add test case fields to /charts/fields.
How to hit it: the custom chart builder in Collate builds its asset picker from that field catalog, so it now offers Test Case. Its preview calls buildDIChart(chart, start, end), which runs with live=false (DataInsightAggregatorClient.java#L20-L22), and the builder has no way to set live mode or searchIndex. Every chart built on Test Case shows no data.
This is the open [high] finding listed in the PR description.
| "tag", | ||
| "metric", | ||
| "apiEndpoint", | ||
| "testCase", |
There was a problem hiding this comment.
generate-types was failing when this merged (run), and generated/dataInsight/custom/dataAssetType.ts on main still has no TestCase value. The job regenerates every type and fails on any diff, so the next PR that triggers it will fail on this file, even if that PR never touched it.
| .withFilter( | ||
| "{\"query\":{\"terms\":{\"originEntityFQN\":[" + fqns + "]}}}"))) | ||
| .withxAxisField("originEntityFQN") | ||
| .withSearchIndex(Entity.TEST_CASE); |
There was a problem hiding this comment.
This test doesn't go through the new alias. With live=true and searchIndex: testCase, the chart reads the testCase alias directly, so the test would also pass on main from before this PR. The same is true of the two new live tests in DataAssetChartScopeTest. Nothing covers the field catalog or the preview path, which is where the alias changes behaviour.
Also, the integration test lanes were skipped on this PR, so this IT and the updated DataInsightAliasReconciliationIT haven't run yet.
Summary
Test cases are now exposed to Data Insights through the test case alias, so charts can count them and group them by table, test suite, and test definition without changing
total_data_assets. The chart query and migration SQL changes support table test coverage across existing data; reviewers should look first at the MySQL and PostgreSQL migration scripts and the coverage integration test.Plan
indexMapping.json: add"dataInsightAliases": ["di-data-assets-testcase"]to thetestCaseentry, mirroringtestCaseResult. Do not touchparentAliases/childAliases.SearchRepository(~l.786),OpenSearchIndexManager/ElasticSearchIndexManager,DefaultRecreateHandlerandSearchIndexUtilsalready attach, re-attach and exclude these aliases generically, so no Java is needed for the alias wiring.dataAssetType.json: add"testCase"to the enum, after"apiEndpoint"and before"testCaseResult". The catalog order test pins the enum order. Update the description to say test cases are also supplied bydataInsightAliasesand the app must never create or delete data streams for them. This is what makesDataInsightsApp.getDataAssetTypes()skip testCase, becauseisAliasedFromLiveIndexis true. Do not addtestCasetodataInsights/config.json;theTwoCoverageMechanismsDoNotOverlapforbids it. The generated Java enum and the UIgenerated/dataInsight/custom/dataAssetType.tscome from regeneration (mvn -pl openmetadata-spec installormake generate); never hand-edit them.fetchDIChartFields()in the OpenSearch and Elasticsearch aggregator managers iteratesDataInsightSystemChartRepository.dataAssetTypesand reads the mapping ofdi-data-assets-testcase. Adding the enum value therefore exposesoriginEntityFQN(the table FQN, also set for column tests),table.fullyQualifiedName/table.name,testSuite.*,testSuites.*,testDefinition.name.keyword,testDefinition.fullyQualifiedName,testCaseType,entityFQNanddataQualityDimensionNameas leaf fields. Check in the mapping that the grouping fields are keyword-typed and nottextwithout a keyword subfield.originEntityFQN,table.fullyQualifiedName,testDefinition.fullyQualifiedNameandtestSuite.fullyQualifiedNameare keyword-typed. Fix any gap in the test-case mapping rather than adding grouping config in Java.@timestampoverdi-data-assets-*, and the live test case index has no@timestamp(theen/test_case_index_mapping.jsonhas no occurrences of it; result and resolution-status docs do). Add"@timestamp": {"type": "date"}totest_case_index_mapping.jsonin en, jp, ko, ru and zh. InTestCaseIndex.buildSearchIndexDocInternal(orbuildSearchIndexDoc),doc.put("@timestamp", testCase.getUpdatedAt()). Keep it small, and check howTestCaseResultIndexwrites it for the same pattern.entityType: "testCase"(set bypopulateCommonFields). The storedDATA_ASSET_FILTERonly excludes tag, glossaryTerm and dataProduct, so test cases would leak intototal_data_assetsand the summary card. InDataInsightSystemChartRepository:NON_DATA_ASSET_ENTITY_TYPES.entityType.keywordalowercase_normalizer. Atermquery normVerification
Review findings left for your review (astra)
The reviewer and the implementer disagree on the findings marked disputed; the implementer's answer is quoted below.
Files
Closes #33432
Opened by taskr run 0179.