mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-02 21:53:30 +00:00
minor: added entity type support in dq dashboard API (#18977)
This commit is contained in:
parent
5263858067
commit
83f094e286
@ -1,5 +1,3 @@
|
|||||||
import { TestSummary } from '../../generated/tests/testCase';
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2023 Collate.
|
* Copyright 2023 Collate.
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -12,6 +10,10 @@ import { TestSummary } from '../../generated/tests/testCase';
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { EntityType } from '../../enums/entity.enum';
|
||||||
|
import { TestSummary } from '../../generated/tests/testCase';
|
||||||
|
|
||||||
export enum DataQualityPageTabs {
|
export enum DataQualityPageTabs {
|
||||||
TEST_SUITES = 'test-suites',
|
TEST_SUITES = 'test-suites',
|
||||||
TABLES = 'tables',
|
TABLES = 'tables',
|
||||||
@ -32,4 +34,5 @@ export type DataQualityDashboardChartFilters = {
|
|||||||
startTs?: number;
|
startTs?: number;
|
||||||
endTs?: number;
|
endTs?: number;
|
||||||
entityFQN?: string;
|
entityFQN?: string;
|
||||||
|
entityType?: EntityType;
|
||||||
};
|
};
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
/* eslint-disable max-len */
|
/* eslint-disable max-len */
|
||||||
import { IncidentTimeMetricsType } from '../components/DataQuality/DataQuality.interface';
|
import { IncidentTimeMetricsType } from '../components/DataQuality/DataQuality.interface';
|
||||||
|
import { EntityType } from '../enums/entity.enum';
|
||||||
import { TestCaseStatus } from '../generated/tests/testCase';
|
import { TestCaseStatus } from '../generated/tests/testCase';
|
||||||
import { TestCaseResolutionStatusTypes } from '../generated/tests/testCaseResolutionStatus';
|
import { TestCaseResolutionStatusTypes } from '../generated/tests/testCaseResolutionStatus';
|
||||||
import {
|
import {
|
||||||
@ -1209,5 +1210,84 @@ describe('dataQualityDashboardAPI', () => {
|
|||||||
'bucketName=byDay:aggType=date_histogram:field=timestamp&calendar_interval=day,bucketName=newIncidents:aggType=cardinality:field=testCase.fullyQualifiedName',
|
'bucketName=byDay:aggType=date_histogram:field=timestamp&calendar_interval=day,bucketName=newIncidents:aggType=cardinality:field=testCase.fullyQualifiedName',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should call getDataQualityReport with provided entityType', async () => {
|
||||||
|
const status = TestCaseStatus.Success;
|
||||||
|
const filters = {
|
||||||
|
entityType: EntityType.TABLE,
|
||||||
|
entityFQN: 'entityFQN',
|
||||||
|
startTs: 1729073964962,
|
||||||
|
endTs: 1729678764965,
|
||||||
|
};
|
||||||
|
|
||||||
|
await fetchTestCaseStatusMetricsByDays(status, filters);
|
||||||
|
|
||||||
|
expect(getDataQualityReport).toHaveBeenCalledWith({
|
||||||
|
q: JSON.stringify({
|
||||||
|
query: {
|
||||||
|
bool: {
|
||||||
|
must: [
|
||||||
|
{ term: { testCaseStatus: status } },
|
||||||
|
{
|
||||||
|
range: {
|
||||||
|
timestamp: {
|
||||||
|
lte: filters.endTs,
|
||||||
|
gte: filters.startTs,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
term: {
|
||||||
|
'table.fullyQualifiedName.keyword': 'entityFQN',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
index: 'testCaseResult',
|
||||||
|
aggregationQuery:
|
||||||
|
'bucketName=byDay:aggType=date_histogram:field=timestamp&calendar_interval=day,bucketName=newIncidents:aggType=cardinality:field=testCase.fullyQualifiedName',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should call getDataQualityReport with normal entity fqn if entityType not provided', async () => {
|
||||||
|
const status = TestCaseStatus.Success;
|
||||||
|
const filters = {
|
||||||
|
entityFQN: 'entityFQN',
|
||||||
|
startTs: 1729073964962,
|
||||||
|
endTs: 1729678764965,
|
||||||
|
};
|
||||||
|
|
||||||
|
await fetchTestCaseStatusMetricsByDays(status, filters);
|
||||||
|
|
||||||
|
expect(getDataQualityReport).toHaveBeenCalledWith({
|
||||||
|
q: JSON.stringify({
|
||||||
|
query: {
|
||||||
|
bool: {
|
||||||
|
must: [
|
||||||
|
{ term: { testCaseStatus: status } },
|
||||||
|
{
|
||||||
|
range: {
|
||||||
|
timestamp: {
|
||||||
|
lte: filters.endTs,
|
||||||
|
gte: filters.startTs,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
term: {
|
||||||
|
'testCase.entityFQN': 'entityFQN',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
index: 'testCaseResult',
|
||||||
|
aggregationQuery:
|
||||||
|
'bucketName=byDay:aggType=date_histogram:field=timestamp&calendar_interval=day,bucketName=newIncidents:aggType=cardinality:field=testCase.fullyQualifiedName',
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -317,7 +317,9 @@ export const fetchTestCaseStatusMetricsByDays = (
|
|||||||
if (filters?.entityFQN) {
|
if (filters?.entityFQN) {
|
||||||
mustFilter.push({
|
mustFilter.push({
|
||||||
term: {
|
term: {
|
||||||
'testCase.entityFQN': filters.entityFQN,
|
[filters.entityType
|
||||||
|
? `${filters.entityType}.fullyQualifiedName.keyword`
|
||||||
|
: 'testCase.entityFQN']: filters.entityFQN,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user