mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-10-29 17:49:14 +00:00
MINOR - fix test definition deletion (#15203)
* fix: added provider for testDefinition entities * fix: changed testDefinition <-> testCase relationship + allow recursive deletion of testDefinition * fix: added migration steps * style: ran java linting
This commit is contained in:
parent
49dd0e8683
commit
e72c80f264
@ -0,0 +1,13 @@
|
|||||||
|
-- Update the relation between testDefinition and testCase to 0 (CONTAINS)
|
||||||
|
UPDATE entity_relationship
|
||||||
|
SET relation = 0
|
||||||
|
WHERE fromEntity = 'testDefinition' AND toEntity = 'testCase' AND relation != 0;
|
||||||
|
|
||||||
|
-- Update the test definition provider
|
||||||
|
-- If the test definition has OpenMetadata as a test platform, then the provider is system, else it is user
|
||||||
|
UPDATE test_definition
|
||||||
|
SET json = CASE
|
||||||
|
WHEN JSON_CONTAINS(json, '"OpenMetadata"', '$.testPlatforms') THEN JSON_INSERT(json,'$.provider','system')
|
||||||
|
ELSE JSON_INSERT(json,'$.provider','user')
|
||||||
|
END
|
||||||
|
;
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
-- Update the relation between testDefinition and testCase to 0 (CONTAINS)
|
||||||
|
UPDATE entity_relationship
|
||||||
|
SET relation = 0
|
||||||
|
WHERE fromEntity = 'testDefinition' AND toEntity = 'testCase' AND relation != 0;
|
||||||
|
|
||||||
|
-- Update the test definition provider
|
||||||
|
-- If the test definition has OpenMetadata as a test platform, then the provider is system, else it is user
|
||||||
|
UPDATE test_definition
|
||||||
|
SET json =
|
||||||
|
case
|
||||||
|
when json->'testPlatforms' @> '"OpenMetadata"' then jsonb_set(json,'{provider}','"system"',true)
|
||||||
|
else jsonb_set(json,'{provider}','"user"', true)
|
||||||
|
end;
|
||||||
@ -193,7 +193,7 @@ public class TestCaseRepository extends EntityRepository<TestCase> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private EntityReference getTestDefinition(TestCase test) {
|
private EntityReference getTestDefinition(TestCase test) {
|
||||||
return getFromEntityRef(test.getId(), Relationship.APPLIED_TO, TEST_DEFINITION, true);
|
return getFromEntityRef(test.getId(), Relationship.CONTAINS, TEST_DEFINITION, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateTestParameters(
|
private void validateTestParameters(
|
||||||
@ -247,7 +247,7 @@ public class TestCaseRepository extends EntityRepository<TestCase> {
|
|||||||
test.getId(),
|
test.getId(),
|
||||||
TEST_DEFINITION,
|
TEST_DEFINITION,
|
||||||
TEST_CASE,
|
TEST_CASE,
|
||||||
Relationship.APPLIED_TO);
|
Relationship.CONTAINS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -900,7 +900,7 @@ public class TestCaseRepository extends EntityRepository<TestCase> {
|
|||||||
TEST_DEFINITION,
|
TEST_DEFINITION,
|
||||||
original.getTestDefinition(),
|
original.getTestDefinition(),
|
||||||
updated.getTestDefinition(),
|
updated.getTestDefinition(),
|
||||||
Relationship.APPLIED_TO,
|
Relationship.CONTAINS,
|
||||||
TEST_CASE,
|
TEST_CASE,
|
||||||
updated.getId());
|
updated.getId());
|
||||||
recordChange("parameterValues", original.getParameterValues(), updated.getParameterValues());
|
recordChange("parameterValues", original.getParameterValues(), updated.getParameterValues());
|
||||||
|
|||||||
@ -389,10 +389,15 @@ public class TestDefinitionResource
|
|||||||
@QueryParam("hardDelete")
|
@QueryParam("hardDelete")
|
||||||
@DefaultValue("false")
|
@DefaultValue("false")
|
||||||
boolean hardDelete,
|
boolean hardDelete,
|
||||||
|
@Parameter(
|
||||||
|
description = "Recursively delete this entity and it's children. (Default `false`)")
|
||||||
|
@QueryParam("recursive")
|
||||||
|
@DefaultValue("false")
|
||||||
|
boolean recursive,
|
||||||
@Parameter(description = "Id of the test definition", schema = @Schema(type = "UUID"))
|
@Parameter(description = "Id of the test definition", schema = @Schema(type = "UUID"))
|
||||||
@PathParam("id")
|
@PathParam("id")
|
||||||
UUID id) {
|
UUID id) {
|
||||||
return delete(uriInfo, securityContext, id, false, hardDelete);
|
return delete(uriInfo, securityContext, id, recursive, hardDelete);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@ -414,10 +419,15 @@ public class TestDefinitionResource
|
|||||||
@QueryParam("hardDelete")
|
@QueryParam("hardDelete")
|
||||||
@DefaultValue("false")
|
@DefaultValue("false")
|
||||||
boolean hardDelete,
|
boolean hardDelete,
|
||||||
|
@Parameter(
|
||||||
|
description = "Recursively delete this entity and it's children. (Default `false`)")
|
||||||
|
@QueryParam("recursive")
|
||||||
|
@DefaultValue("false")
|
||||||
|
boolean recursive,
|
||||||
@Parameter(description = "Name of the test definition", schema = @Schema(type = "string"))
|
@Parameter(description = "Name of the test definition", schema = @Schema(type = "string"))
|
||||||
@PathParam("name")
|
@PathParam("name")
|
||||||
String name) {
|
String name) {
|
||||||
return deleteByName(uriInfo, securityContext, name, false, hardDelete);
|
return deleteByName(uriInfo, securityContext, name, recursive, hardDelete);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PUT
|
@PUT
|
||||||
|
|||||||
@ -19,6 +19,7 @@
|
|||||||
"description": "Expected maximum value in the column to be lower or equal than",
|
"description": "Expected maximum value in the column to be lower or equal than",
|
||||||
"dataType": "INT"
|
"dataType": "INT"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"provider": "system"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,7 @@
|
|||||||
"description": "Expected mean value for the column to be lower or equal than",
|
"description": "Expected mean value for the column to be lower or equal than",
|
||||||
"dataType": "INT"
|
"dataType": "INT"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"provider": "system"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19,6 +19,7 @@
|
|||||||
"description": "Expected median value for the column to be lower or equal than",
|
"description": "Expected median value for the column to be lower or equal than",
|
||||||
"dataType": "INT"
|
"dataType": "INT"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"provider": "system"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19,6 +19,7 @@
|
|||||||
"description": "Expect minimum value in the column to be lower or equal than",
|
"description": "Expect minimum value in the column to be lower or equal than",
|
||||||
"dataType": "INT"
|
"dataType": "INT"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"provider": "system"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19,6 +19,7 @@
|
|||||||
"description": "Expected std. dev value for the column to be lower or equal than",
|
"description": "Expected std. dev value for the column to be lower or equal than",
|
||||||
"dataType": "INT"
|
"dataType": "INT"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"provider": "system"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20,5 +20,6 @@
|
|||||||
"dataType": "INT"
|
"dataType": "INT"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"supportsRowLevelPassedFailed": true
|
"supportsRowLevelPassedFailed": true,
|
||||||
|
"provider": "system"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,5 +20,6 @@
|
|||||||
"description": "By default match all null and empty values to be missing. This field allows us to configure additional strings such as N/A, NULL as missing strings as well.",
|
"description": "By default match all null and empty values to be missing. This field allows us to configure additional strings such as N/A, NULL as missing strings as well.",
|
||||||
"dataType": "STRING"
|
"dataType": "STRING"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"provider": "system"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,7 @@
|
|||||||
"description": "Expected sum values in the column to be lower or equal than",
|
"description": "Expected sum values in the column to be lower or equal than",
|
||||||
"dataType": "INT"
|
"dataType": "INT"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"provider": "system"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20,5 +20,6 @@
|
|||||||
"dataType": "INT"
|
"dataType": "INT"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"supportsRowLevelPassedFailed": true
|
"supportsRowLevelPassedFailed": true,
|
||||||
|
"provider": "system"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,5 +15,6 @@
|
|||||||
"required": true
|
"required": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"supportsRowLevelPassedFailed": true
|
"supportsRowLevelPassedFailed": true,
|
||||||
|
"provider": "system"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,5 +15,6 @@
|
|||||||
"required": true
|
"required": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"supportsRowLevelPassedFailed": true
|
"supportsRowLevelPassedFailed": true,
|
||||||
|
"provider": "system"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,5 +6,6 @@
|
|||||||
"entityType": "COLUMN",
|
"entityType": "COLUMN",
|
||||||
"testPlatforms": ["OpenMetadata"],
|
"testPlatforms": ["OpenMetadata"],
|
||||||
"supportedDataTypes": ["NUMBER","TINYINT","SMALLINT","INT","BIGINT","BYTEINT","BYTES","FLOAT","DOUBLE","DECIMAL","NUMERIC","TIMESTAMP","TIMESTAMPZ","TIME","DATE","DATETIME","INTERVAL","STRING","MEDIUMTEXT","TEXT","CHAR","VARCHAR","BOOLEAN","BINARY","VARBINARY","ARRAY","BLOB","LONGBLOB","MEDIUMBLOB","MAP","STRUCT","UNION","SET","GEOGRAPHY","ENUM","JSON","UUID","VARIANT","GEOMETRY","POINT","POLYGON"],
|
"supportedDataTypes": ["NUMBER","TINYINT","SMALLINT","INT","BIGINT","BYTEINT","BYTES","FLOAT","DOUBLE","DECIMAL","NUMERIC","TIMESTAMP","TIMESTAMPZ","TIME","DATE","DATETIME","INTERVAL","STRING","MEDIUMTEXT","TEXT","CHAR","VARCHAR","BOOLEAN","BINARY","VARBINARY","ARRAY","BLOB","LONGBLOB","MEDIUMBLOB","MAP","STRUCT","UNION","SET","GEOGRAPHY","ENUM","JSON","UUID","VARIANT","GEOMETRY","POINT","POLYGON"],
|
||||||
"supportsRowLevelPassedFailed": true
|
"supportsRowLevelPassedFailed": true,
|
||||||
|
"provider": "system"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,5 +6,6 @@
|
|||||||
"entityType": "COLUMN",
|
"entityType": "COLUMN",
|
||||||
"testPlatforms": ["OpenMetadata"],
|
"testPlatforms": ["OpenMetadata"],
|
||||||
"supportedDataTypes": ["NUMBER","TINYINT","SMALLINT","INT","BIGINT","BYTEINT","BYTES","FLOAT","DOUBLE","DECIMAL","NUMERIC","TIMESTAMP","TIMESTAMPZ","TIME","DATE","DATETIME","INTERVAL","STRING","MEDIUMTEXT","TEXT","CHAR","VARCHAR","BOOLEAN","BINARY","VARBINARY","ARRAY","BLOB","LONGBLOB","MEDIUMBLOB","MAP","STRUCT","UNION","SET","GEOGRAPHY","ENUM","JSON","UUID","VARIANT","GEOMETRY","POINT","POLYGON"],
|
"supportedDataTypes": ["NUMBER","TINYINT","SMALLINT","INT","BIGINT","BYTEINT","BYTES","FLOAT","DOUBLE","DECIMAL","NUMERIC","TIMESTAMP","TIMESTAMPZ","TIME","DATE","DATETIME","INTERVAL","STRING","MEDIUMTEXT","TEXT","CHAR","VARCHAR","BOOLEAN","BINARY","VARBINARY","ARRAY","BLOB","LONGBLOB","MEDIUMBLOB","MAP","STRUCT","UNION","SET","GEOGRAPHY","ENUM","JSON","UUID","VARIANT","GEOMETRY","POINT","POLYGON"],
|
||||||
"supportsRowLevelPassedFailed": true
|
"supportsRowLevelPassedFailed": true,
|
||||||
|
"provider": "system"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,5 +15,6 @@
|
|||||||
"required": true
|
"required": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"supportsRowLevelPassedFailed": true
|
"supportsRowLevelPassedFailed": true,
|
||||||
|
"provider": "system"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,5 +15,6 @@
|
|||||||
"required": true
|
"required": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"supportsRowLevelPassedFailed": true
|
"supportsRowLevelPassedFailed": true,
|
||||||
|
"provider": "system"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,5 +18,6 @@
|
|||||||
"description": "Expected number of columns should be less than or equal to {maxValue}. If maxValue is not included, minValue is treated as lowerBound and there will be no maximum number of column",
|
"description": "Expected number of columns should be less than or equal to {maxValue}. If maxValue is not included, minValue is treated as lowerBound and there will be no maximum number of column",
|
||||||
"dataType": "INT"
|
"dataType": "INT"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"provider": "system"
|
||||||
}
|
}
|
||||||
@ -13,5 +13,6 @@
|
|||||||
"dataType": "INT",
|
"dataType": "INT",
|
||||||
"required": true
|
"required": true
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"provider": "system"
|
||||||
}
|
}
|
||||||
@ -13,6 +13,7 @@
|
|||||||
"dataType": "STRING",
|
"dataType": "STRING",
|
||||||
"required": true
|
"required": true
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"provider": "system"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19,6 +19,7 @@
|
|||||||
"description": "Whether or not to considered the order of the list when performing the match check",
|
"description": "Whether or not to considered the order of the list when performing the match check",
|
||||||
"dataType": "BOOLEAN"
|
"dataType": "BOOLEAN"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"provider": "system"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,6 +28,7 @@
|
|||||||
"dataType": "NUMBER",
|
"dataType": "NUMBER",
|
||||||
"required": false
|
"required": false
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"provider": "system"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18,5 +18,6 @@
|
|||||||
"description": "Expected number of columns should be less than or equal to {maxValue}. If maxValue is not included, minValue is treated as lowerBound and there will be no maximum",
|
"description": "Expected number of columns should be less than or equal to {maxValue}. If maxValue is not included, minValue is treated as lowerBound and there will be no maximum",
|
||||||
"dataType": "INT"
|
"dataType": "INT"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"provider": "system"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,5 +13,6 @@
|
|||||||
"dataType": "INT",
|
"dataType": "INT",
|
||||||
"required": true
|
"required": true
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"provider": "system"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,6 +41,7 @@
|
|||||||
"dataType": "INT",
|
"dataType": "INT",
|
||||||
"required": true
|
"required": true
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"provider": "system"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,6 +38,9 @@
|
|||||||
"$ref": "../../entity/data/table.json#/definitions/dataType"
|
"$ref": "../../entity/data/table.json#/definitions/dataType"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"provider" : {
|
||||||
|
"$ref": "../../type/basic.json#/definitions/providerType"
|
||||||
|
},
|
||||||
"parameterDefinition": {
|
"parameterDefinition": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
|
|||||||
@ -131,6 +131,9 @@
|
|||||||
"$ref": "../type/entityReference.json",
|
"$ref": "../type/entityReference.json",
|
||||||
"default": null
|
"default": null
|
||||||
},
|
},
|
||||||
|
"provider" : {
|
||||||
|
"$ref": "../type/basic.json#/definitions/providerType"
|
||||||
|
},
|
||||||
"version": {
|
"version": {
|
||||||
"description": "Metadata version of the entity.",
|
"description": "Metadata version of the entity.",
|
||||||
"$ref": "../type/entityHistory.json#/definitions/entityVersion"
|
"$ref": "../type/entityHistory.json#/definitions/entityVersion"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user