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) {
|
||||
return getFromEntityRef(test.getId(), Relationship.APPLIED_TO, TEST_DEFINITION, true);
|
||||
return getFromEntityRef(test.getId(), Relationship.CONTAINS, TEST_DEFINITION, true);
|
||||
}
|
||||
|
||||
private void validateTestParameters(
|
||||
@ -247,7 +247,7 @@ public class TestCaseRepository extends EntityRepository<TestCase> {
|
||||
test.getId(),
|
||||
TEST_DEFINITION,
|
||||
TEST_CASE,
|
||||
Relationship.APPLIED_TO);
|
||||
Relationship.CONTAINS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -900,7 +900,7 @@ public class TestCaseRepository extends EntityRepository<TestCase> {
|
||||
TEST_DEFINITION,
|
||||
original.getTestDefinition(),
|
||||
updated.getTestDefinition(),
|
||||
Relationship.APPLIED_TO,
|
||||
Relationship.CONTAINS,
|
||||
TEST_CASE,
|
||||
updated.getId());
|
||||
recordChange("parameterValues", original.getParameterValues(), updated.getParameterValues());
|
||||
|
||||
@ -389,10 +389,15 @@ public class TestDefinitionResource
|
||||
@QueryParam("hardDelete")
|
||||
@DefaultValue("false")
|
||||
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"))
|
||||
@PathParam("id")
|
||||
UUID id) {
|
||||
return delete(uriInfo, securityContext, id, false, hardDelete);
|
||||
return delete(uriInfo, securityContext, id, recursive, hardDelete);
|
||||
}
|
||||
|
||||
@DELETE
|
||||
@ -414,10 +419,15 @@ public class TestDefinitionResource
|
||||
@QueryParam("hardDelete")
|
||||
@DefaultValue("false")
|
||||
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"))
|
||||
@PathParam("name")
|
||||
String name) {
|
||||
return deleteByName(uriInfo, securityContext, name, false, hardDelete);
|
||||
return deleteByName(uriInfo, securityContext, name, recursive, hardDelete);
|
||||
}
|
||||
|
||||
@PUT
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
"description": "Expected maximum value in the column to be lower or equal than",
|
||||
"dataType": "INT"
|
||||
}
|
||||
]
|
||||
],
|
||||
"provider": "system"
|
||||
}
|
||||
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
"description": "Expected mean value for the column to be lower or equal than",
|
||||
"dataType": "INT"
|
||||
}
|
||||
]
|
||||
],
|
||||
"provider": "system"
|
||||
}
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
"description": "Expected median value for the column to be lower or equal than",
|
||||
"dataType": "INT"
|
||||
}
|
||||
]
|
||||
],
|
||||
"provider": "system"
|
||||
}
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
"description": "Expect minimum value in the column to be lower or equal than",
|
||||
"dataType": "INT"
|
||||
}
|
||||
]
|
||||
],
|
||||
"provider": "system"
|
||||
}
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
"description": "Expected std. dev value for the column to be lower or equal than",
|
||||
"dataType": "INT"
|
||||
}
|
||||
]
|
||||
],
|
||||
"provider": "system"
|
||||
}
|
||||
|
||||
@ -20,5 +20,6 @@
|
||||
"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.",
|
||||
"dataType": "STRING"
|
||||
}
|
||||
]
|
||||
],
|
||||
"provider": "system"
|
||||
}
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
"description": "Expected sum values in the column to be lower or equal than",
|
||||
"dataType": "INT"
|
||||
}
|
||||
]
|
||||
],
|
||||
"provider": "system"
|
||||
}
|
||||
|
||||
@ -20,5 +20,6 @@
|
||||
"dataType": "INT"
|
||||
}
|
||||
],
|
||||
"supportsRowLevelPassedFailed": true
|
||||
"supportsRowLevelPassedFailed": true,
|
||||
"provider": "system"
|
||||
}
|
||||
|
||||
@ -15,5 +15,6 @@
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"supportsRowLevelPassedFailed": true
|
||||
"supportsRowLevelPassedFailed": true,
|
||||
"provider": "system"
|
||||
}
|
||||
|
||||
@ -15,5 +15,6 @@
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"supportsRowLevelPassedFailed": true
|
||||
"supportsRowLevelPassedFailed": true,
|
||||
"provider": "system"
|
||||
}
|
||||
|
||||
@ -6,5 +6,6 @@
|
||||
"entityType": "COLUMN",
|
||||
"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"],
|
||||
"supportsRowLevelPassedFailed": true
|
||||
"supportsRowLevelPassedFailed": true,
|
||||
"provider": "system"
|
||||
}
|
||||
|
||||
@ -6,5 +6,6 @@
|
||||
"entityType": "COLUMN",
|
||||
"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"],
|
||||
"supportsRowLevelPassedFailed": true
|
||||
"supportsRowLevelPassedFailed": true,
|
||||
"provider": "system"
|
||||
}
|
||||
|
||||
@ -15,5 +15,6 @@
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"supportsRowLevelPassedFailed": true
|
||||
"supportsRowLevelPassedFailed": true,
|
||||
"provider": "system"
|
||||
}
|
||||
|
||||
@ -15,5 +15,6 @@
|
||||
"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",
|
||||
"dataType": "INT"
|
||||
}
|
||||
]
|
||||
],
|
||||
"provider": "system"
|
||||
}
|
||||
@ -13,5 +13,6 @@
|
||||
"dataType": "INT",
|
||||
"required": true
|
||||
}
|
||||
]
|
||||
],
|
||||
"provider": "system"
|
||||
}
|
||||
@ -13,6 +13,7 @@
|
||||
"dataType": "STRING",
|
||||
"required": true
|
||||
}
|
||||
]
|
||||
],
|
||||
"provider": "system"
|
||||
}
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
"description": "Whether or not to considered the order of the list when performing the match check",
|
||||
"dataType": "BOOLEAN"
|
||||
}
|
||||
]
|
||||
],
|
||||
"provider": "system"
|
||||
}
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
"dataType": "NUMBER",
|
||||
"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",
|
||||
"dataType": "INT"
|
||||
}
|
||||
]
|
||||
],
|
||||
"provider": "system"
|
||||
}
|
||||
|
||||
@ -13,5 +13,6 @@
|
||||
"dataType": "INT",
|
||||
"required": true
|
||||
}
|
||||
]
|
||||
],
|
||||
"provider": "system"
|
||||
}
|
||||
|
||||
@ -41,6 +41,7 @@
|
||||
"dataType": "INT",
|
||||
"required": true
|
||||
}
|
||||
]
|
||||
],
|
||||
"provider": "system"
|
||||
}
|
||||
|
||||
@ -38,6 +38,9 @@
|
||||
"$ref": "../../entity/data/table.json#/definitions/dataType"
|
||||
}
|
||||
},
|
||||
"provider" : {
|
||||
"$ref": "../../type/basic.json#/definitions/providerType"
|
||||
},
|
||||
"parameterDefinition": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
||||
@ -131,6 +131,9 @@
|
||||
"$ref": "../type/entityReference.json",
|
||||
"default": null
|
||||
},
|
||||
"provider" : {
|
||||
"$ref": "../type/basic.json#/definitions/providerType"
|
||||
},
|
||||
"version": {
|
||||
"description": "Metadata version of the entity.",
|
||||
"$ref": "../type/entityHistory.json#/definitions/entityVersion"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user