Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIXES #14049 - Split test case resolution status from test case result #14204

Merged
merged 29 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ebff098
refactor: entityFQN as ListFilter condition
TeddyCr Nov 23, 2023
e17efb5
feat: implement resolution entity timeseries
TeddyCr Nov 29, 2023
1f7398d
Merge remote-tracking branch 'upstream/main' into issue-14049
TeddyCr Nov 29, 2023
f42620c
Merge remote-tracking branch 'upstream/main' into issue-14049
TeddyCr Nov 29, 2023
4fcfefc
fix: rename to testCaseResolutionStatus
TeddyCr Nov 29, 2023
2987ee2
ref: extracted ES query builder into private method
TeddyCr Nov 30, 2023
ec673ba
ref: extract OS query builder in its own method
TeddyCr Nov 30, 2023
63f9531
ref: remove ingestion logic for test case resolution
TeddyCr Nov 30, 2023
b8dd6bb
fix: reorganize json schemas to fix circular import in Python
TeddyCr Nov 30, 2023
39be0fc
ref: object names in typescript code
TeddyCr Nov 30, 2023
fac0cdb
feat: added indexing of test case resolution
TeddyCr Dec 1, 2023
2a45863
feat: added test case resolution sample data
TeddyCr Dec 1, 2023
0d96ee5
fix: test case resolution api logic
TeddyCr Dec 1, 2023
794ec35
fix: audit logger for entityTimeSeriesInterface
TeddyCr Dec 1, 2023
dcb864f
Merge remote-tracking branch 'upstream/main' into issue-14049
TeddyCr Dec 1, 2023
218cdb7
fix: DDL generation
TeddyCr Dec 1, 2023
6b74e3d
Merge remote-tracking branch 'upstream/main' into issue-14049
TeddyCr Dec 1, 2023
4d72454
style: python linting
TeddyCr Dec 1, 2023
4fb6cbf
fix: skip UI test case resolution tests
TeddyCr Dec 1, 2023
015bc73
Merge remote-tracking branch 'upstream/main' into issue-14049
TeddyCr Dec 4, 2023
0fc8fc7
fix: remove extension field
TeddyCr Dec 4, 2023
1a129ac
fix: renamed testCaseFailureStatus to testCaseResolutionStatus
TeddyCr Dec 4, 2023
6753e60
fix: remove reviewer
TeddyCr Dec 4, 2023
3728fb8
fix: rename sequenceId to stateId
TeddyCr Dec 4, 2023
3c178c4
fix: re adjust search weights
TeddyCr Dec 4, 2023
f8a3b65
Merge remote-tracking branch 'upstream/main' into issue-14049
TeddyCr Dec 4, 2023
e553082
Merge remote-tracking branch 'upstream/main' into issue-14049
TeddyCr Dec 4, 2023
6becea5
fix: removed InReview status
TeddyCr Dec 4, 2023
1fa1e49
style: ran python linting
TeddyCr Dec 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions bootstrap/sql/migrations/native/1.3.0/mysql/schemaChanges.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
-- Data quality failure status extension time series
CREATE TABLE test_case_resolution_status_time_series (
id varchar(36) GENERATED ALWAYS AS (json_unquote(json_extract(json,'$.id'))) VIRTUAL NOT NULL,
stateId varchar(36) GENERATED ALWAYS AS (json_unquote(json_extract(json,'$.stateId'))) VIRTUAL NOT NULL,
assignee varchar(256) GENERATED ALWAYS AS (json_unquote(json_extract(json,'$.testCaseResolutionStatusDetails.assignee.name'))) VIRTUAL NULL,
timestamp bigint unsigned GENERATED ALWAYS AS (json_unquote(json_extract(json,'$.timestamp'))) VIRTUAL NOT NULL,
testCaseResolutionStatusType varchar(36) GENERATED ALWAYS AS (json_unquote(json_extract(json,'$.testCaseResolutionStatusType'))) VIRTUAL NOT NULL,
jsonSchema varchar(256) NOT NULL,
json json NOT NULL,
entityFQNHash varchar(768) CHARACTER SET ascii COLLATE ascii_bin DEFAULT NULL,
CONSTRAINT test_case_resolution_status_unique_constraint UNIQUE (id,timestamp,entityFQNHash),
INDEX (id),
INDEX(testCaseResolutionStatusType),
INDEX(id, testCaseResolutionStatusType)

) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- DataInsightsApplication should not allow configuration
update apps_marketplace
set json = JSON_INSERT(
Expand Down
24 changes: 24 additions & 0 deletions bootstrap/sql/migrations/native/1.3.0/postgres/schemaChanges.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
-- Data quality failure status extension time series
CREATE TABLE test_case_resolution_status_time_series (
id varchar(36) GENERATED ALWAYS AS (json ->> 'id') STORED NOT NULL,
stateId varchar(36) GENERATED ALWAYS AS (json ->> 'stateId') STORED NOT NULL,
assignee varchar(256) GENERATED ALWAYS AS (
CASE
WHEN json->'testCaseResolutionStatusDetails' IS NOT NULL AND
json->'testCaseResolutionStatusDetails'->'assignee' IS NOT NULL AND
json->'testCaseResolutionStatusDetails'->'assignee'->>'name' IS NOT NULL
THEN json->'testCaseResolutionStatusDetails'->'assignee'->>'name'
ELSE NULL
END
) STORED NULL,
timestamp bigint GENERATED ALWAYS AS ((json ->> 'timestamp')::bigint) STORED NOT NULL,
testCaseResolutionStatusType varchar(36) GENERATED ALWAYS AS (json ->> 'testCaseResolutionStatusType') STORED NOT NULL,
jsonSchema varchar(256) NOT NULL,
json jsonb NOT NULL,
entityFQNHash varchar(768) COLLATE "C" DEFAULT NULL,
CONSTRAINT test_case_resolution_status_unique_constraint UNIQUE (id, timestamp, entityFQNHash)
);
create index test_case_resolution_status_time_series_id on test_case_resolution_status_time_series (id);
create index test_case_resolution_status_time_series_status_type on test_case_resolution_status_time_series (testCaseResolutionStatusType);
create index test_case_resolution_status_time_series_id_status_type on test_case_resolution_status_time_series (id, testCaseResolutionStatusType);

-- DataInsightsApplication should not allow configuration
UPDATE apps_marketplace
SET json = jsonb_set(
Expand Down
272 changes: 267 additions & 5 deletions ingestion/examples/sample_data/tests/testSuites.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,80 @@
"name": "columnCount",
"value": 10
}
]
],
"resolutions": {
"sequenceOne": [
{
"testCaseResolutionStatusType": "New",
"severity": "Severity1"
},
{
"testCaseResolutionStatusType": "Ack",
"severity": "Severity1"
},
{
"testCaseResolutionStatusType": "Assigned",
"severity": "Severity1",
"assignee": "aaron_johnson0"
},
{
"testCaseResolutionStatusType": "Resolved",
"severity": "Severity1",
"resolver": "aaron_johnson0"
}
],
"sequenceTwo": [
{
"testCaseResolutionStatusType": "New",
"severity": "Severity1"
},
{
"testCaseResolutionStatusType": "Ack",
"severity": "Severity1"
},
{
"testCaseResolutionStatusType": "Assigned",
"severity": "Severity1",
"assignee": "christopher_campbell7"
},
{
"testCaseResolutionStatusType": "Resolved",
"severity": "Severity1",
"resolver": "christopher_campbell7"
}
],
"sequenceThree": [
{
"testCaseResolutionStatusType": "New",
"severity": "Severity3"
},
{
"testCaseResolutionStatusType": "Ack",
"severity": "Severity3"
},
{
"testCaseResolutionStatusType": "Assigned",
"severity": "Severity3",
"assignee": "christopher_campbell7"
},
{
"testCaseResolutionStatusType": "Assigned",
"severity": "Severity3",
"assignee": "aaron_johnson0"
},
{
"testCaseResolutionStatusType": "Resolved",
"severity": "Severity3",
"resolver": "aaron_johnson0"
}
],
"sequenceFour": [
{
"testCaseResolutionStatusType": "New",
"severity": "Severity5"
}
]
}
},
{
"name": "table_column_count_between",
Expand All @@ -32,7 +105,69 @@
"name": "maxColValue",
"value": 10
}
]
],
"resolutions": {
"sequenceOne": [
{
"testCaseResolutionStatusType": "New",
"severity": "Severity1"
},
{
"testCaseResolutionStatusType": "Ack",
"severity": "Severity1"
},
{
"testCaseResolutionStatusType": "Assigned",
"severity": "Severity1",
"assignee": "aaron_johnson0"
},
{
"testCaseResolutionStatusType": "Resolved",
"severity": "Severity1",
"resolver": "christine_day7"
}
],
"sequenceTwo": [
{
"testCaseResolutionStatusType": "New",
"severity": "Severity1"
},
{
"testCaseResolutionStatusType": "Ack",
"severity": "Severity1"
},
{
"testCaseResolutionStatusType": "Assigned",
"severity": "Severity1",
"assignee": "christopher_campbell7"
},
{
"testCaseResolutionStatusType": "Resolved",
"severity": "Severity1",
"resolver": "christopher_campbell7"
}
],
"sequenceThree": [
{
"testCaseResolutionStatusType": "New",
"severity": "Severity3"
},
{
"testCaseResolutionStatusType": "Ack",
"severity": "Severity3"
},
{
"testCaseResolutionStatusType": "Assigned",
"severity": "Severity3",
"assignee": "christopher_campbell7"
},
{
"testCaseResolutionStatusType": "Assigned",
"severity": "Severity3",
"assignee": "aaron_johnson0"
}
]
}
},
{
"name": "column_value_max_to_be_between",
Expand All @@ -48,7 +183,29 @@
"name": "maxValueForMaxInCol",
"value": 100
}
]
],
"resolutions": {
"sequenceOne": [
{
"testCaseResolutionStatusType": "New",
"severity": "Severity1"
},
{
"testCaseResolutionStatusType": "Ack",
"severity": "Severity1"
},
{
"testCaseResolutionStatusType": "Assigned",
"severity": "Severity1",
"assignee": "aaron_johnson0"
},
{
"testCaseResolutionStatusType": "Resolved",
"severity": "Severity1",
"resolver": "aaron_johnson0"
}
]
}
},
{
"name": "column_values_to_match_regex",
Expand All @@ -60,7 +217,35 @@
"name": "regex",
"value": "Doe.*"
}
]
],
"resolutions": {
"sequenceOne": [
{
"testCaseResolutionStatusType": "New",
"severity": "Severity5"
},
{
"testCaseResolutionStatusType": "Ack",
"severity": "Severity5"
},
{
"testCaseResolutionStatusType": "Assigned",
"severity": "Severity5",
"assignee": "aaron_johnson0"
},
{
"testCaseResolutionStatusType": "Resolved",
"severity": "Severity5",
"resolver": "aaron_johnson0"
}
],
"sequenceFour": [
{
"testCaseResolutionStatusType": "New",
"severity": "Severity5"
}
]
}
},
{
"name": "column_values_to_be_between",
Expand All @@ -76,7 +261,84 @@
"name": "max",
"value": 96162
}
]
],
"resolutions": {
"sequenceOne": [
{
"testCaseResolutionStatusType": "New",
"severity": "Severity1"
},
{
"testCaseResolutionStatusType": "Ack",
"severity": "Severity1"
},
{
"testCaseResolutionStatusType": "Assigned",
"severity": "Severity1",
"assignee": "aaron_johnson0"
},
{
"testCaseResolutionStatusType": "Resolved",
"severity": "Severity1",
"resolver": "aaron_johnson0"
}
],
"sequenceTwo": [
{
"testCaseResolutionStatusType": "New",
"severity": "Severity1"
},
{
"testCaseResolutionStatusType": "Ack",
"severity": "Severity1"
},
{
"testCaseResolutionStatusType": "Assigned",
"severity": "Severity1",
"assignee": "christopher_campbell7"
},
{
"testCaseResolutionStatusType": "Resolved",
"severity": "Severity1",
"resolver": "christopher_campbell7"
}
],
"sequenceThree": [
{
"testCaseResolutionStatusType": "New",
"severity": "Severity3"
},
{
"testCaseResolutionStatusType": "Ack",
"severity": "Severity3"
},
{
"testCaseResolutionStatusType": "Assigned",
"severity": "Severity3",
"assignee": "christopher_campbell7"
},
{
"testCaseResolutionStatusType": "Assigned",
"severity": "Severity3",
"assignee": "aaron_johnson0"
},
{
"testCaseResolutionStatusType": "Resolved",
"severity": "Severity3",
"resolver": "aaron_johnson0"
}
],
"sequenceFour": [
{
"testCaseResolutionStatusType": "New",
"severity": "Severity5"
},
{
"testCaseResolutionStatusType": "Ack",
"severity": "Severity5"
}
]
}
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,11 @@
from typing import Callable, List, Optional, TypeVar, Union

from metadata.generated.schema.tests.basic import (
TestCaseFailureStatus,
TestCaseFailureStatusType,
TestCaseResult,
TestCaseStatus,
TestResultValue,
)
from metadata.generated.schema.tests.testCase import TestCase, TestCaseParameterValue
from metadata.generated.schema.type.basic import Timestamp
from metadata.profiler.processor.runner import QueryRunner

T = TypeVar("T", bound=Callable)
Expand Down Expand Up @@ -105,24 +102,12 @@ def get_test_case_result_object(
Returns:
TestCaseResult:
"""
if status == TestCaseStatus.Failed:
test_case_failure_status = TestCaseFailureStatus(
testCaseFailureStatusType=TestCaseFailureStatusType.New,
testCaseFailureReason=None,
testCaseFailureComment=None,
updatedAt=Timestamp(__root__=int(datetime.utcnow().timestamp() * 1000)),
updatedBy=None,
)
else:
test_case_failure_status = None

return TestCaseResult(
timestamp=execution_date, # type: ignore
testCaseStatus=status,
result=result,
testResultValue=test_result_value,
sampleData=None,
testCaseFailureStatus=test_case_failure_status,
)

def format_column_list(self, status: TestCaseStatus, cols: List):
Expand Down
Loading
Loading