mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-22 15:32:48 +00:00
Fix Test Issues (#12320)
This commit is contained in:
parent
ebc3d55240
commit
065a4c9ed3
@ -173,7 +173,7 @@ public class ListFilter {
|
|||||||
return "json->>'executable' = 'true'";
|
return "json->>'executable' = 'true'";
|
||||||
case ("logical"):
|
case ("logical"):
|
||||||
if (DatasourceConfig.getInstance().isMySQL()) {
|
if (DatasourceConfig.getInstance().isMySQL()) {
|
||||||
return "JSON_UNQUOTE(JSON_EXTRACT(json, '$.executable')) = 'false'";
|
return "JSON_UNQUOTE(JSON_EXTRACT(json, '$.executable')) = 'false' OR JSON_UNQUOTE(JSON_EXTRACT(json, '$.executable')) IS NULL";
|
||||||
}
|
}
|
||||||
return "json->>'executable' = 'false'";
|
return "json->>'executable' = 'false'";
|
||||||
default:
|
default:
|
||||||
|
@ -382,18 +382,35 @@ public class MigrationUtil {
|
|||||||
MessageParser.EntityLink entityLink = MessageParser.EntityLink.parse(test.getEntityLink());
|
MessageParser.EntityLink entityLink = MessageParser.EntityLink.parse(test.getEntityLink());
|
||||||
// Create new Logical Test Suite
|
// Create new Logical Test Suite
|
||||||
String testSuiteFqn = entityLink.getEntityFQN() + ".testSuite";
|
String testSuiteFqn = entityLink.getEntityFQN() + ".testSuite";
|
||||||
|
TestSuite stored;
|
||||||
|
try {
|
||||||
|
// If entity is found by Hash it is already migrated
|
||||||
|
testSuiteRepository.getByName(
|
||||||
|
null,
|
||||||
|
EntityInterfaceUtil.quoteName(FullyQualifiedName.buildHash(testSuiteFqn)),
|
||||||
|
new EntityUtil.Fields(List.of("id")),
|
||||||
|
Include.ALL);
|
||||||
|
} catch (EntityNotFoundException entityNotFoundException) {
|
||||||
try {
|
try {
|
||||||
// Check if the test Suite Exists, this brings the data on nameHash basis
|
// Check if the test Suite Exists, this brings the data on nameHash basis
|
||||||
TestSuite stored =
|
stored =
|
||||||
testSuiteRepository.getByName(
|
testSuiteRepository.getByName(
|
||||||
null, FullyQualifiedName.quoteName(testSuiteFqn), new EntityUtil.Fields(List.of("id")), Include.ALL);
|
null, EntityInterfaceUtil.quoteName(testSuiteFqn), new EntityUtil.Fields(List.of("id")), Include.ALL);
|
||||||
testSuiteRepository.addRelationship(stored.getId(), test.getId(), TEST_SUITE, TEST_CASE, Relationship.CONTAINS);
|
testSuiteRepository.addRelationship(
|
||||||
|
stored.getId(), test.getId(), TEST_SUITE, TEST_CASE, Relationship.CONTAINS);
|
||||||
|
stored.setExecutable(true);
|
||||||
|
stored.setName(FullyQualifiedName.buildHash(testSuiteFqn));
|
||||||
|
// the update() method here internally calls FullyQualifiedName.buildHash so not adding it
|
||||||
|
stored.setFullyQualifiedName(EntityInterfaceUtil.quoteName(FullyQualifiedName.buildHash(testSuiteFqn)));
|
||||||
|
stored.setDisplayName(testSuiteFqn);
|
||||||
|
testSuiteRepository.getDao().update(stored);
|
||||||
} catch (EntityNotFoundException ex) {
|
} catch (EntityNotFoundException ex) {
|
||||||
TestSuite newExecutableTestSuite =
|
TestSuite newExecutableTestSuite =
|
||||||
getTestSuite(
|
getTestSuite(
|
||||||
collectionDAO,
|
collectionDAO,
|
||||||
new CreateTestSuite()
|
new CreateTestSuite()
|
||||||
.withName(testSuiteFqn)
|
.withName(FullyQualifiedName.buildHash(testSuiteFqn))
|
||||||
|
.withDisplayName(testSuiteFqn)
|
||||||
.withExecutableEntityReference(entityLink.getEntityFQN()),
|
.withExecutableEntityReference(entityLink.getEntityFQN()),
|
||||||
"ingestion-bot")
|
"ingestion-bot")
|
||||||
.withExecutable(false);
|
.withExecutable(false);
|
||||||
@ -416,11 +433,12 @@ public class MigrationUtil {
|
|||||||
TestSuite temp =
|
TestSuite temp =
|
||||||
testSuiteRepository
|
testSuiteRepository
|
||||||
.getDao()
|
.getDao()
|
||||||
.findEntityByName(FullyQualifiedName.quoteName(newExecutableTestSuite.getName()));
|
.findEntityByName(EntityInterfaceUtil.quoteName(FullyQualifiedName.buildHash(testSuiteFqn)));
|
||||||
temp.setExecutable(true);
|
temp.setExecutable(true);
|
||||||
testSuiteRepository.getDao().update(temp);
|
testSuiteRepository.getDao().update(temp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Update Test Suites
|
// Update Test Suites
|
||||||
ListFilter filter = new ListFilter(Include.ALL);
|
ListFilter filter = new ListFilter(Include.ALL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user