added testResultValue to testCaseResult (#6881)

This commit is contained in:
Teddy 2022-08-23 18:32:15 +02:00 committed by GitHub
parent e52b843548
commit afd12cff04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 423 additions and 52 deletions

View File

@ -4,6 +4,21 @@
"title": "Basic", "title": "Basic",
"description": "This schema defines basic types that are used by other test schemas.", "description": "This schema defines basic types that are used by other test schemas.",
"definitions": { "definitions": {
"testResultValue": {
"description": "Schema to capture test case result values.",
"javaType": "org.openmetadata.catalog.tests.type.TestResultValue",
"type": "object",
"properties": {
"name": {
"description": "name of the value",
"type": "string"
},
"value": {
"description": "test result value",
"type": "string"
}
}
},
"testCaseResult": { "testCaseResult": {
"description": "Schema to capture test case result.", "description": "Schema to capture test case result.",
"javaType": "org.openmetadata.catalog.tests.type.TestCaseResult", "javaType": "org.openmetadata.catalog.tests.type.TestCaseResult",
@ -37,6 +52,12 @@
"sampleData": { "sampleData": {
"description": "sample data to capture rows/columns that didn't match the expressed testcase.", "description": "sample data to capture rows/columns that didn't match the expressed testcase.",
"type": "string" "type": "string"
},
"testResultValue": {
"type": "array",
"items": {
"$ref": "#/definitions/testResultValue"
}
} }
}, },
"additionalProperties": false "additionalProperties": false

View File

@ -5,47 +5,113 @@
"results": [ "results": [
{ {
"result": "Found 10 columns vs. the expected 10", "result": "Found 10 columns vs. the expected 10",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "columnCount",
"value": "10"
}
]
}, },
{ {
"result": "Found 10 columns vs. the expected 10", "result": "Found 10 columns vs. the expected 10",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "columnCount",
"value": "10"
}
]
}, },
{ {
"result": "Found 10 columns vs. the expected 10", "result": "Found 10 columns vs. the expected 10",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "columnCount",
"value": "10"
}
]
}, },
{ {
"result": "Found 10 columns vs. the expected 10", "result": "Found 10 columns vs. the expected 10",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "columnCount",
"value": "10"
}
]
}, },
{ {
"result": "Found 10 columns vs. the expected 10", "result": "Found 10 columns vs. the expected 10",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "columnCount",
"value": "10"
}
]
}, },
{ {
"result": "Found 8 columns vs. the expected 10", "result": "Found 8 columns vs. the expected 10",
"testCaseStatus": "Failed" "testCaseStatus": "Failed",
"testResultValues": [
{
"name": "columnCount",
"value": "8"
}
]
}, },
{ {
"result": "Found 8 columns vs. the expected 10", "result": "Found 8 columns vs. the expected 10",
"testCaseStatus": "Failed" "testCaseStatus": "Failed",
"testResultValues": [
{
"name": "columnCount",
"value": "8"
}
]
}, },
{ {
"result": "columnCount should not be None for TableColumnCountToEqual", "result": "columnCount should not be None for TableColumnCountToEqual",
"testCaseStatus": "Aborted" "testCaseStatus": "Aborted",
"testResultValues": [
{
"name": "columnCount",
"value": "None"
}
]
}, },
{ {
"result": "Found 10 columns vs. the expected 10", "result": "Found 10 columns vs. the expected 10",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "columnCount",
"value": "10"
}
]
}, },
{ {
"result": "Found 10 columns vs. the expected 10", "result": "Found 10 columns vs. the expected 10",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "columnCount",
"value": "10"
}
]
}, },
{ {
"result": "Found 10 columns vs. the expected 10", "result": "Found 10 columns vs. the expected 10",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "columnCount",
"value": "10"
}
]
} }
] ]
}, },
@ -54,43 +120,103 @@
"results": [ "results": [
{ {
"result": "Found 9 column vs. the expected range [1, 10].", "result": "Found 9 column vs. the expected range [1, 10].",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "columnCount",
"value": "9"
}
]
}, },
{ {
"result": "Found 9 column vs. the expected range [1, 10].", "result": "Found 9 column vs. the expected range [1, 10].",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "columnCount",
"value": "9"
}
]
}, },
{ {
"result": "Found 9 column vs. the expected range [1, 10].", "result": "Found 9 column vs. the expected range [1, 10].",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "columnCount",
"value": "9"
}
]
}, },
{ {
"result": "columnCount should not be None for TableColumnCountToBeBetween", "result": "columnCount should not be None for TableColumnCountToBeBetween",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "columnCount",
"value": "9"
}
]
}, },
{ {
"result": "Found 9 column vs. the expected range [1, 10].", "result": "Found 9 column vs. the expected range [1, 10].",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "columnCount",
"value": "9"
}
]
}, },
{ {
"result": "Found 8 column vs. the expected range [1, 10].", "result": "Found 8 column vs. the expected range [1, 10].",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "columnCount",
"value": "8"
}
]
}, },
{ {
"result": "Found 8 column vs. the expected range [1, 10].", "result": "Found 8 column vs. the expected range [1, 10].",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "columnCount",
"value": "8"
}
]
}, },
{ {
"result": "Found 14 column vs. the expected range [1, 10].", "result": "Found 14 column vs. the expected range [1, 10].",
"testCaseStatus": "Failed" "testCaseStatus": "Failed",
"testResultValues": [
{
"name": "columnCount",
"value": "14"
}
]
}, },
{ {
"result": "Found 8 column vs. the expected range [1, 10].", "result": "Found 8 column vs. the expected range [1, 10].",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "columnCount",
"value": "8"
}
]
}, },
{ {
"result": "Found 8 column vs. the expected range [1, 10].", "result": "Found 8 column vs. the expected range [1, 10].",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "columnCount",
"value": "8"
}
]
} }
] ]
}, },
@ -99,43 +225,103 @@
"results": [ "results": [
{ {
"result": "Found max=65 vs. the expected min=50, max=100.", "result": "Found max=65 vs. the expected min=50, max=100.",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "max",
"value": "65"
}
]
}, },
{ {
"result": "Found max=25 vs. the expected min=50, max=100.", "result": "Found max=25 vs. the expected min=50, max=100.",
"testCaseStatus": "Failed" "testCaseStatus": "Failed",
"testResultValues": [
{
"name": "max",
"value": "25"
}
]
}, },
{ {
"result": "Found max=56 vs. the expected min=50, max=100.", "result": "Found max=56 vs. the expected min=50, max=100.",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "max",
"value": "56"
}
]
}, },
{ {
"result": "Found max=99 vs. the expected min=50, max=100.", "result": "Found max=99 vs. the expected min=50, max=100.",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "max",
"value": "99"
}
]
}, },
{ {
"result": "Found max=190 vs. the expected min=50, max=100.", "result": "Found max=190 vs. the expected min=50, max=100.",
"testCaseStatus": "Failed" "testCaseStatus": "Failed",
"testResultValues": [
{
"name": "max",
"value": "190"
}
]
}, },
{ {
"result": "Found max=66 vs. the expected min=50, max=100.", "result": "Found max=66 vs. the expected min=50, max=100.",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "max",
"value": "66"
}
]
}, },
{ {
"result": "Found max=76 vs. the expected min=50, max=100.", "result": "Found max=76 vs. the expected min=50, max=100.",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "max",
"value": "76"
}
]
}, },
{ {
"result": "Found max=46 vs. the expected min=50, max=100.", "result": "Found max=46 vs. the expected min=50, max=100.",
"testCaseStatus": "Failed" "testCaseStatus": "Failed",
"testResultValues": [
{
"name": "max",
"value": "46"
}
]
}, },
{ {
"result": "Found max=100 vs. the expected min=50, max=100.", "result": "Found max=100 vs. the expected min=50, max=100.",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "max",
"value": "100"
}
]
}, },
{ {
"result": "We expect `max` to be informed on the profiler for ColumnValueMaxToBeBetween max=None.", "result": "We expect `max` to be informed on the profiler for ColumnValueMaxToBeBetween max=None.",
"testCaseStatus": "Aborted" "testCaseStatus": "Aborted",
"testResultValues": [
{
"name": "max",
"value": "None"
}
]
} }
] ]
}, },
@ -144,44 +330,104 @@
"results": [ "results": [
{ {
"result": "Found 99 value(s) matching regex pattern vs 99 value(s) in the column.", "result": "Found 99 value(s) matching regex pattern vs 99 value(s) in the column.",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "likeCount",
"value": "65"
}
]
}, },
{ {
"result": "Found 0 value(s) matching regex pattern vs 99 value(s) in the column.", "result": "Found 0 value(s) matching regex pattern vs 99 value(s) in the column.",
"testCaseStatus": "Failed" "testCaseStatus": "Failed",
"testResultValues": [
{
"name": "likeCount",
"value": "0"
}
]
}, },
{ {
"result": "Cannot find the configured column last_name for ColumnValuesToBeNotInSet", "result": "Cannot find the configured column last_name for ColumnValuesToBeNotInSet",
"testCaseStatus": "Aborted" "testCaseStatus": "Aborted",
"testResultValues": [
{
"name": "likeCount",
"value": "None"
}
]
}, },
{ {
"result": "Found 99 value(s) matching regex pattern vs 99 value(s) in the column.", "result": "Found 99 value(s) matching regex pattern vs 99 value(s) in the column.",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "likeCount",
"value": "99"
}
]
}, },
{ {
"result": "Found 5 value(s) matching regex pattern vs 99 value(s) in the column.", "result": "Found 5 value(s) matching regex pattern vs 99 value(s) in the column.",
"testCaseStatus": "Failed" "testCaseStatus": "Failed",
"testResultValues": [
{
"name": "likeCount",
"value": "5"
}
]
}, },
{ {
"result": "Found 2 value(s) matching regex pattern vs 99 value(s) in the column.", "result": "Found 2 value(s) matching regex pattern vs 99 value(s) in the column.",
"testCaseStatus": "Failed" "testCaseStatus": "Failed",
"testResultValues": [
{
"name": "likeCount",
"value": "2"
}
]
}, },
{ {
"result": "Found 99 value(s) matching regex pattern vs 99 value(s) in the column.", "result": "Found 99 value(s) matching regex pattern vs 99 value(s) in the column.",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "likeCount",
"value": "99"
}
]
}, },
{ {
"result": "Error computing ColumnValuesToMatchRegex for last_name - database error", "result": "Error computing ColumnValuesToMatchRegex for last_name - database error",
"testCaseStatus": "Aborted" "testCaseStatus": "Aborted",
"testResultValues": [
{
"name": "likeCount",
"value": "None"
}
]
}, },
{ {
"result": "Found 99 value(s) matching regex pattern vs 99 value(s) in the column.", "result": "Found 99 value(s) matching regex pattern vs 99 value(s) in the column.",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "likeCount",
"value": "99"
}
]
}, },
{ {
"result": "Found 99 value(s) matching regex pattern vs 99 value(s) in the column.", "result": "Found 99 value(s) matching regex pattern vs 99 value(s) in the column.",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "likeCount",
"value": "99"
}
]
} }
] ]
}, },
@ -190,44 +436,144 @@
"results": [ "results": [
{ {
"result": "We expect `min` & `max` to be informed on the profiler for ColumnValuesToBeBetween but got min=None, max=None.", "result": "We expect `min` & `max` to be informed on the profiler for ColumnValuesToBeBetween but got min=None, max=None.",
"testCaseStatus": "Aborted" "testCaseStatus": "Aborted",
"testResultValues": [
{
"name": "min",
"value": "None"
},
{
"name": "max",
"value": "None"
}
]
}, },
{ {
"result": "Found min=35005, max=92808 vs. the expected min=90001, max=96162.", "result": "Found min=35005, max=92808 vs. the expected min=90001, max=96162.",
"testCaseStatus": "Failed" "testCaseStatus": "Failed",
"testResultValues": [
{
"name": "min",
"value": "35005"
},
{
"name": "max",
"value": "92808"
}
]
}, },
{ {
"result": "Found min=90006, max=92808 vs. the expected min=90001, max=96162.", "result": "Found min=90006, max=92808 vs. the expected min=90001, max=96162.",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "min",
"value": "90006"
},
{
"name": "max",
"value": "92808"
}
]
}, },
{ {
"result": "Found min=90002, max=95640 vs. the expected min=90001, max=96162.", "result": "Found min=90002, max=95640 vs. the expected min=90001, max=96162.",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "min",
"value": "90002"
},
{
"name": "max",
"value": "95640"
}
]
}, },
{ {
"result": "Found min=90004, max=99001 vs. the expected min=90001, max=96162.", "result": "Found min=90004, max=99001 vs. the expected min=90001, max=96162.",
"testCaseStatus": "Failed" "testCaseStatus": "Failed",
"testResultValues": [
{
"name": "min",
"value": "90004"
},
{
"name": "max",
"value": "99001"
}
]
}, },
{ {
"result": "Found min=1001, max=2789 vs. the expected min=90001, max=96162.", "result": "Found min=1001, max=2789 vs. the expected min=90001, max=96162.",
"testCaseStatus": "Failed" "testCaseStatus": "Failed",
"testResultValues": [
{
"name": "min",
"value": "1001"
},
{
"name": "max",
"value": "2789"
}
]
}, },
{ {
"result": "Found min=91009, max=92808 vs. the expected min=90001, max=96162.", "result": "Found min=91009, max=92808 vs. the expected min=90001, max=96162.",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "min",
"value": "91009"
},
{
"name": "max",
"value": "92808"
}
]
}, },
{ {
"result": "Found min=90008, max=92808 vs. the expected min=90001, max=96162.", "result": "Found min=90008, max=92808 vs. the expected min=90001, max=96162.",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "min",
"value": "90008"
},
{
"name": "max",
"value": "92808"
}
]
}, },
{ {
"result": "Found min=92000, max=92808 vs. the expected min=90001, max=96162.", "result": "Found min=92000, max=92808 vs. the expected min=90001, max=96162.",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "min",
"value": "92000"
},
{
"name": "max",
"value": "92808"
}
]
}, },
{ {
"result": "Found min=90001, max=96612 vs. the expected min=90001, max=96162.", "result": "Found min=90001, max=96612 vs. the expected min=90001, max=96162.",
"testCaseStatus": "Success" "testCaseStatus": "Success",
"testResultValues": [
{
"name": "min",
"value": "90001"
},
{
"name": "max",
"value": "96612"
}
]
} }
] ]
} }

View File

@ -75,7 +75,7 @@ from metadata.generated.schema.entity.teams.user import User
from metadata.generated.schema.metadataIngestion.workflow import ( from metadata.generated.schema.metadataIngestion.workflow import (
Source as WorkflowSource, Source as WorkflowSource,
) )
from metadata.generated.schema.tests.basic import TestCaseResult from metadata.generated.schema.tests.basic import TestCaseResult, TestResultValue
from metadata.generated.schema.tests.columnTest import ColumnTestCase from metadata.generated.schema.tests.columnTest import ColumnTestCase
from metadata.generated.schema.tests.tableTest import TableTestCase from metadata.generated.schema.tests.tableTest import TableTestCase
from metadata.generated.schema.tests.testCase import TestCase, TestCaseParameterValue from metadata.generated.schema.tests.testCase import TestCase, TestCaseParameterValue
@ -914,6 +914,10 @@ class SampleDataSource(Source[Entity]):
timestamp=(datetime.now() - timedelta(days=i)).timestamp(), timestamp=(datetime.now() - timedelta(days=i)).timestamp(),
testCaseStatus=result["testCaseStatus"], testCaseStatus=result["testCaseStatus"],
result=result["result"], result=result["result"],
testResultValue=[
TestResultValue.parse_obj(res_value)
for res_value in result["testResultValues"]
],
), ),
test_case_name=case.fullyQualifiedName.__root__, test_case_name=case.fullyQualifiedName.__root__,
) )