Fix #5831: Add pipeline to testsuite (#6756)

* Fix #5831: Add pipeline to testsuite

* Fix #5831: Add pipeline to testsuite
This commit is contained in:
Sriharsha Chintalapani 2022-08-17 23:49:32 -07:00 committed by GitHub
parent b70f49e5a8
commit 8943e3bb7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 41 additions and 14 deletions

View File

@ -3,9 +3,11 @@ package org.openmetadata.catalog.jdbi3;
import static org.openmetadata.catalog.Entity.TEST_SUITE;
import java.io.IOException;
import org.openmetadata.catalog.Entity;
import org.openmetadata.catalog.resources.dqtests.TestSuiteResource;
import org.openmetadata.catalog.tests.TestSuite;
import org.openmetadata.catalog.type.EntityReference;
import org.openmetadata.catalog.type.Relationship;
import org.openmetadata.catalog.util.EntityUtil;
public class TestSuiteRepository extends EntityRepository<TestSuite> {
@ -26,6 +28,7 @@ public class TestSuiteRepository extends EntityRepository<TestSuite> {
@Override
public TestSuite setFields(TestSuite entity, EntityUtil.Fields fields) throws IOException {
entity.setOwner(fields.contains("owner") ? getOwner(entity) : null);
entity.setPipeline(fields.contains("pipelines") ? getIngestionPipeline(entity) : null);
return entity;
}
@ -50,6 +53,10 @@ public class TestSuiteRepository extends EntityRepository<TestSuite> {
storeOwner(entity, entity.getOwner());
}
private EntityReference getIngestionPipeline(TestSuite testSuite) throws IOException {
return getToEntityRef(testSuite.getId(), Relationship.CONTAINS, Entity.INGESTION_PIPELINE, false);
}
public class TestSuiteUpdater extends EntityUpdater {
public TestSuiteUpdater(TestSuite original, TestSuite updated, Operation operation) {
super(original, updated, operation);

View File

@ -337,7 +337,6 @@ public class TestSuiteResource extends EntityResource<TestSuite, TestSuiteReposi
private TestSuite getTestSuite(CreateTestSuite create, String user) throws IOException {
return copy(new TestSuite(), create, user)
.withDescription(create.getDescription())
.withScheduleInterval(create.getScheduleInterval())
.withDisplayName(create.getDisplayName())
.withName(create.getName());
}

View File

@ -1,5 +1,5 @@
{
"$id": "https://open-metadata.org/schema/entity/services/ingestionPipelines/dashboardServiceMetadataPipeline.json",
"$id": "https://open-metadata.org/schema/metadataIngestion/dashboardServiceMetadataPipeline.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "DashboardServiceMetadataPipeline",
"description": "DashboardService Metadata Pipeline Configuration.",

View File

@ -1,5 +1,5 @@
{
"$id": "https://open-metadata.org//schema/entity/services/ingestionPipelines/databaseServiceMetadataPipeline.json",
"$id": "https://open-metadata.org/schema/metadataIngestion/databaseServiceMetadataPipeline.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "DatabaseServiceMetadataPipeline",
"description": "DatabaseService Metadata Pipeline Configuration.",

View File

@ -1,5 +1,5 @@
{
"$id": "https://open-metadata.org/schema/entity/services/ingestionPipelines/databaseServiceProfilerPipeline.json",
"$id": "https://open-metadata.org/schema/metadataIngestion/databaseServiceProfilerPipeline.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "DatabaseServiceProfilerPipeline",
"description": "DatabaseService Profiler Pipeline Configuration.",

View File

@ -1,5 +1,5 @@
{
"$id": "https://open-metadata.org/schema/entity/services/ingestionPipelines/databaseServiceQueryLineagePipeline.json",
"$id": "https://open-metadata.org/schema/metadataIngestion/databaseServiceQueryLineagePipeline.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "DatabaseServiceQueryLineagePipeline",
"description": "DatabaseService Query Lineage Pipeline Configuration.",

View File

@ -1,5 +1,5 @@
{
"$id": "https://open-metadata.org/schema/entity/services/ingestionPipelines/databaseServiceQueryUsagePipeline.json",
"$id": "https://open-metadata.org/schema/metadataIngestion/databaseServiceQueryUsagePipeline.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "DatabaseServiceQueryUsagePipeline",
"description": "DatabaseService Query Usage Pipeline Configuration.",

View File

@ -1,5 +1,5 @@
{
"$id": "https://open-metadata.org/schema/entities/services/ingestionPipelines/messagingServiceMetadataPipeline.json",
"$id": "https://open-metadata.org/schema/metadataIngestion/messagingServiceMetadataPipeline.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "MessagingServiceMetadataPipeline",
"description": "MessagingService Metadata Pipeline Configuration.",

View File

@ -1,5 +1,5 @@
{
"$id": "https://open-metadata.org/schema/entity/services/ingestionPipelines/mlmodelServiceMetadataPipeline.json",
"$id": "https://open-metadata.org/schema/metadataIngestion/mlmodelServiceMetadataPipeline.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "MlModelServiceMetadataPipeline",
"description": "MlModelService Metadata Pipeline Configuration.",

View File

@ -1,5 +1,5 @@
{
"$id": "https://open-metadata.org/schema/entity/services/ingestionPipelines/pipelineServiceMetadataPipeline.json",
"$id": "https://open-metadata.org/schema/metadataIngestion/pipelineServiceMetadataPipeline.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "PipelineServiceMetadataPipeline",
"description": "PipelineService Metadata Pipeline Configuration.",

View File

@ -0,0 +1,22 @@
{
"$id": "https://open-metadata.org/schema/metadataIngestion/testSuitePipeline.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "TestSuitePipeline",
"description": "TestSuite Pipeline Configuration.",
"definitions": {
"pipelineMetadataConfigType": {
"description": "Pipeline Source Config Metadata Pipeline type",
"type": "string",
"enum": ["TestSuite"],
"default": "TestSuite"
}
},
"properties": {
"type": {
"description": "Pipeline type",
"$ref": "#/definitions/pipelineMetadataConfigType",
"default": "TestSuite"
}
},
"additionalProperties": false
}

View File

@ -35,9 +35,10 @@
},
"default": null
},
"scheduleInterval": {
"description": "TestSuite schedule interval in cron format.",
"type": "string"
"pipeline": {
"description": "References to pipelines deployed for this database service to extract metadata, usage, lineage etc..",
"$ref": "../type/entityReference.json",
"default": null
},
"owner": {
"description": "Owner of this TestCase definition.",

View File

@ -58,7 +58,6 @@ public class TestSuiteResourceTest extends EntityResourceTest<TestSuite, CreateT
throws HttpResponseException {
assertEquals(request.getName(), createdEntity.getName());
assertEquals(request.getDescription(), createdEntity.getDescription());
assertEquals(request.getScheduleInterval(), createdEntity.getScheduleInterval());
}
@Override
@ -66,7 +65,6 @@ public class TestSuiteResourceTest extends EntityResourceTest<TestSuite, CreateT
throws HttpResponseException {
assertEquals(expected.getName(), updated.getName());
assertEquals(expected.getDescription(), updated.getDescription());
assertEquals(expected.getScheduleInterval(), updated.getScheduleInterval());
}
@Override