mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-07-08 17:50:28 +00:00

* Add multiple owners * Multi Ownership * Issue #17012: Multi User/Team Ownership * Issue #17012: Multi User/Team Ownership * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 1 * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 2 * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 3 * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 4 * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 5 * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 6 * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 7 * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 8 * Add Migrations for Owner Thread * update ingestion for multi owner * fix pytests * fixed checkstyle * Add Alert Name to Publishers (#17108) * Add Alert Name to Publishers * Fix Test * Add Bound to Setuptools (#17105) * Minor: fixed testSummaryGraph issue (#17115) * feat: updated multi pipeline ui as per new mock (#17106) * feat: updated multi pipeline ui as per new mock * translation sync * fixed failing unit test * fixed playwright test * fixed viewService click issue * sorted pipeline based on test case length * Added domo federated dataset support (#17061) * fix usernames (#17122) * Doc: Updated Doris & Redshift Docs (#17123) Co-authored-by: Prajwal Pandit <prajwalpandit@Prajwals-MacBook-Air.local> * Fix #12677: Added Synapse Connector - docs and side docs (#17041) * Fix #17098: Fixed case sensitive partition column name in Bigquery (#17104) * Fixed case sensitive partiion col name bigquery * update test * #13876: change placement of comment and close button in task approval workflow (#17044) * change placment of comment and close button in task approval workflow * minor change * playwright test for the close and comment function * supported ref in activityFeedEditor * fix playwright test * added playwright test for data steward * fix the test for the data streward user * fix the close button not showing if task has no suggestions and icon fixes * fix sonar issue * change glossary and add suggestion button to dropdown button * fix the glossary failure due to button change * icon change for add tag and description * fix glossary cypress failure due to button chnages * changes as per comments * MINOR: docs links fix (#17125) * alation link fix * dbt yaml config source link fix * bigquery doc fix * Explore tree feedbacks (#17078) * fix explore design * update switcher icon * show menu when search query exists * fix selection of active service * fix type error * fix tests * fix tests * fix tests * MINOR: Databricks view TableType fix (#17124) * Minor: fixed AUT test (#17128) * Fix #16692: Override Lineage Support for View & Dashboard Lineage (#17064) * #17065: fix the tags not rendering in selector after selection in edit tags task (#17107) * fix the tags not rendering in selector after selection in edit tags taks * added playwright test * minor changes * minor fix * fix the tags not updating in edit and accept tag * fix explore type changes for collate (#17131) * MINOR: changed log level to debug (#17126) * changed log level to debug * fixed type * changed type to optional * Get feed and count data of soft deleted user (#17135) * Doc: Adding OIDC Docs (#17139) Co-authored-by: Prajwal Pandit <prajwalpandit@Prajwals-MacBook-Air.local> * Doc: Updating Profiler Workflow Docs URL (#17140) Co-authored-by: Prajwal Pandit <prajwalpandit@Prajwals-MacBook-Air.local> * fix playwright and cypress (#17138) * Minor: fixed edit modal issue for sql test case (#17132) * Minor: fixed edit modal issue for sql test case * fixed test * Minor: Added whats new content for 1.4.6 release (#17148) * MINOR [GEN-799]: add option to disable manual trigger using scheduleType (#17031) * fix: raise for triggering system app * added scheduleType ScheduledOrManual * minor: remove "service" field from required properties in createAPIEndpoint schema (#17147) * initial commit multi ownership * update glossary and other entities * update owners * fix version pages * fix tests * Update entity_extension to move owner to array (#17200) * fix tests * fix api page errors * fix owner label design * locales * fix owners in elastic search source * fix types * fix tests * fix tests * Updated CustomMetric owner to entityReferenceList. (#17211) * Fix owners field in search mappings * fix search aggregates * fix inherited label * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 9 * Fix QUeries * Fix Mysql Queries * Typo * fix tests * fix tests * fix tests * fix advanced search constants * fix service ingestion tests * fix tests --------- Co-authored-by: mohitdeuex <mohit.y@deuexsolutions.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Mohit Yadav <105265192+mohityadav766@users.noreply.github.com> Co-authored-by: Ayush Shah <ayush@getcollate.io> Co-authored-by: Shailesh Parmar <shailesh.parmar.webdev@gmail.com> Co-authored-by: k.nakagaki <141020064+nakaken-churadata@users.noreply.github.com> Co-authored-by: Prajwal214 <167504578+Prajwal214@users.noreply.github.com> Co-authored-by: Prajwal Pandit <prajwalpandit@Prajwals-MacBook-Air.local> Co-authored-by: Suman Maharana <sumanmaharana786@gmail.com> Co-authored-by: Ashish Gupta <ashish@getcollate.io> Co-authored-by: harshsoni2024 <64592571+harshsoni2024@users.noreply.github.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com> Co-authored-by: Mayur Singal <39544459+ulixius9@users.noreply.github.com> Co-authored-by: Imri Paran <imri.paran@gmail.com> Co-authored-by: sonika-shah <58761340+sonika-shah@users.noreply.github.com> Co-authored-by: Sachin Chaurasiya <sachinchaurasiyachotey87@gmail.com> Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Siddhant <86899184+Siddhanttimeline@users.noreply.github.com>
286 lines
9.4 KiB
Python
286 lines
9.4 KiB
Python
"""
|
|
Test Domo Dashboard using the topology
|
|
"""
|
|
|
|
import json
|
|
from datetime import datetime
|
|
from pathlib import Path
|
|
from unittest import TestCase
|
|
from unittest.mock import patch
|
|
|
|
from metadata.generated.schema.api.data.createPipeline import CreatePipelineRequest
|
|
from metadata.generated.schema.entity.data.pipeline import (
|
|
Pipeline,
|
|
PipelineStatus,
|
|
Task,
|
|
TaskStatus,
|
|
)
|
|
from metadata.generated.schema.entity.services.pipelineService import (
|
|
PipelineConnection,
|
|
PipelineService,
|
|
PipelineServiceType,
|
|
)
|
|
from metadata.generated.schema.metadataIngestion.workflow import (
|
|
OpenMetadataWorkflowConfig,
|
|
)
|
|
from metadata.generated.schema.type.entityReference import EntityReference
|
|
from metadata.ingestion.models.pipeline_status import OMetaPipelineStatus
|
|
from metadata.ingestion.source.pipeline.domopipeline.metadata import DomopipelineSource
|
|
|
|
mock_file_path = (
|
|
Path(__file__).parent.parent.parent / "resources/datasets/domopipeline_dataset.json"
|
|
)
|
|
with open(mock_file_path, encoding="UTF-8") as file:
|
|
mock_data: dict = json.load(file)
|
|
|
|
MOCK_PIPELINE_SERVICE = PipelineService(
|
|
id="86ff3c40-7c51-4ff5-9727-738cead28d9a",
|
|
name="domopipeline_source_test",
|
|
connection=PipelineConnection(),
|
|
serviceType=PipelineServiceType.DomoPipeline,
|
|
)
|
|
|
|
MOCK_PIPELINE = Pipeline(
|
|
id="a58b1856-729c-493b-bc87-6d2269b43ec0",
|
|
name="do_it_all_with_default_config",
|
|
fullyQualifiedName="domopipeline_source_test.do_it_all_with_default_config",
|
|
displayName="do_it_all_with_default_config",
|
|
tasks=[
|
|
Task(
|
|
name="a58b1856-729c-493b-bc87-6d2269b43ec0",
|
|
displayName="do_it_all_with_default_config",
|
|
)
|
|
],
|
|
service=EntityReference(
|
|
id="85811038-099a-11ed-861d-0242ac120002", type="pipelineService"
|
|
),
|
|
)
|
|
|
|
mock_domopipeline_config = {
|
|
"source": {
|
|
"type": "domopipeline",
|
|
"serviceName": "test2",
|
|
"serviceConnection": {
|
|
"config": {
|
|
"type": "DomoPipeline",
|
|
"clientId": "00000",
|
|
"secretToken": "abcdefg",
|
|
"accessToken": "accessTpokem",
|
|
"apiHost": "api.domo.com",
|
|
"instanceDomain": "https://domain.domo.com",
|
|
}
|
|
},
|
|
"sourceConfig": {
|
|
"config": {"dashboardFilterPattern": {}, "chartFilterPattern": {}}
|
|
},
|
|
},
|
|
"sink": {"type": "metadata-rest", "config": {}},
|
|
"workflowConfig": {
|
|
"openMetadataServerConfig": {
|
|
"hostPort": "http://localhost:8585/api",
|
|
"authProvider": "openmetadata",
|
|
"securityConfig": {
|
|
"jwtToken": "eyJraWQiOiJHYjM4OWEtOWY3Ni1nZGpzLWE5MmotMDI0MmJrOTQzNTYiLCJ0eXAiOiJKV1QiLCJhbGc"
|
|
"iOiJSUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImlzQm90IjpmYWxzZSwiaXNzIjoib3Blbi1tZXRhZGF0YS5vcmciLCJpYXQiOjE"
|
|
"2NjM5Mzg0NjIsImVtYWlsIjoiYWRtaW5Ab3Blbm1ldGFkYXRhLm9yZyJ9.tS8um_5DKu7HgzGBzS1VTA5uUjKWOCU0B_j08WXB"
|
|
"iEC0mr0zNREkqVfwFDD-d24HlNEbrqioLsBuFRiwIWKc1m_ZlVQbG7P36RUxhuv2vbSp80FKyNM-Tj93FDzq91jsyNmsQhyNv_fN"
|
|
"r3TXfzzSPjHt8Go0FMMP66weoKMgW2PbXlhVKwEuXUHyakLLzewm9UMeQaEiRzhiTMU3UkLXcKbYEJJvfNFcLwSl9W8JCO_l0Yj3u"
|
|
"d-qt_nQYEZwqW6u5nfdQllN133iikV4fM5QZsMCnm8Rq1mvLR0y9bmJiD7fwM1tmJ791TUWqmKaTnP49U493VanKpUAfzIiOiIbhg"
|
|
},
|
|
}
|
|
},
|
|
}
|
|
|
|
|
|
EXPECTED_PIPELINE_STATUS = [
|
|
OMetaPipelineStatus(
|
|
pipeline_fqn="domopipeline_source_test.do_it_all_with_default_config",
|
|
pipeline_status=PipelineStatus(
|
|
timestamp=1665476792000,
|
|
executionStatus="Successful",
|
|
taskStatus=[
|
|
TaskStatus(
|
|
name="1",
|
|
executionStatus="Successful",
|
|
startTime=1665476783000,
|
|
endTime=1665476792000,
|
|
logLink=None,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
OMetaPipelineStatus(
|
|
pipeline_fqn="domopipeline_source_test.do_it_all_with_default_config",
|
|
pipeline_status=PipelineStatus(
|
|
timestamp=1665470252000,
|
|
executionStatus="Successful",
|
|
taskStatus=[
|
|
TaskStatus(
|
|
name="1",
|
|
executionStatus="Successful",
|
|
startTime=1665470244000,
|
|
endTime=1665470252000,
|
|
logLink=None,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
OMetaPipelineStatus(
|
|
pipeline_fqn="domopipeline_source_test.do_it_all_with_default_config",
|
|
pipeline_status=PipelineStatus(
|
|
timestamp=1665148827000,
|
|
executionStatus="Successful",
|
|
taskStatus=[
|
|
TaskStatus(
|
|
name="1",
|
|
executionStatus="Successful",
|
|
startTime=1665148818000,
|
|
endTime=1665148827000,
|
|
logLink=None,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
]
|
|
|
|
EXPECTED_PIPELINE = [
|
|
CreatePipelineRequest(
|
|
name="1",
|
|
displayName="Nihar Dataflows",
|
|
description="THis is description for Nihar dataflow",
|
|
sourceUrl=None,
|
|
concurrency=None,
|
|
pipelineLocation=None,
|
|
startDate=datetime(2022, 10, 7, 13, 20, 16),
|
|
tasks=[
|
|
Task(
|
|
name="1",
|
|
displayName="Nihar Dataflows",
|
|
fullyQualifiedName=None,
|
|
description="THis is description for Nihar dataflow",
|
|
sourceUrl=None,
|
|
downstreamTasks=None,
|
|
taskType=None,
|
|
taskSQL=None,
|
|
startDate=None,
|
|
endDate=None,
|
|
tags=None,
|
|
)
|
|
],
|
|
tags=None,
|
|
owners=None,
|
|
service="domopipeline_source_test",
|
|
extension=None,
|
|
)
|
|
]
|
|
|
|
MOCK_PIPELINE_DETAILS = {
|
|
"id": 1,
|
|
"name": "Nihar Dataflows",
|
|
"description": "THis is description for Nihar dataflow",
|
|
"dapDataFlowId": "06996c5f-20ec-4814-8309-2aeb8028875f",
|
|
"responsibleUserId": 1027954122,
|
|
"runState": "ENABLED",
|
|
"lastExecution": {
|
|
"id": 3,
|
|
"onboardFlowId": 1,
|
|
"previewRows": 0,
|
|
"dapDataFlowExecutionId": "9cc03a9d-124b-491e-8579-657fc51d497e",
|
|
"beginTime": 1665476783000,
|
|
"endTime": 1665476792000,
|
|
"lastUpdated": 1665476792000,
|
|
"failed": False,
|
|
"state": "SUCCESS",
|
|
"dataFlowVersion": 0,
|
|
},
|
|
"created": 1665148816000,
|
|
"modified": 1665470784000,
|
|
"engineProperties": {"kettle.mode": "STRICT"},
|
|
"inputs": [
|
|
{
|
|
"dataSourceId": "2e41e76b-fc02-480d-a932-91bdbea40fe5",
|
|
"executeFlowWhenUpdated": False,
|
|
"dataSourceName": "Milan Datasets",
|
|
}
|
|
],
|
|
"outputs": [
|
|
{
|
|
"onboardFlowId": None,
|
|
"dataSourceId": "dedf9fe6-2544-44b6-9129-d5c313b0ec67",
|
|
"dataSourceName": "Milan Output",
|
|
"versionChainType": "REPLACE",
|
|
}
|
|
],
|
|
"executionCount": 3,
|
|
"executionSuccessCount": 3,
|
|
"hydrationState": "DEHYDRATED",
|
|
"useLegacyTriggerBehavior": False,
|
|
"passwordProtected": False,
|
|
"deleted": False,
|
|
"abandoned": False,
|
|
"neverAbandon": False,
|
|
"paused": False,
|
|
"magic": True,
|
|
"restricted": False,
|
|
"editable": True,
|
|
"enabled": True,
|
|
"container": False,
|
|
"databaseType": "MAGIC",
|
|
"triggeredByInput": False,
|
|
"draft": False,
|
|
"numInputs": 1,
|
|
"numOutputs": 1,
|
|
}
|
|
|
|
|
|
class DomoPipelineUnitTest(TestCase):
|
|
"""
|
|
Implements the necessary methods to extract
|
|
Domo Pipeline Unit Test
|
|
"""
|
|
|
|
@patch(
|
|
"metadata.ingestion.source.pipeline.pipeline_service.PipelineServiceSource.test_connection"
|
|
)
|
|
@patch("pydomo.Domo")
|
|
def __init__(self, methodName, domo_client, test_connection) -> None:
|
|
super().__init__(methodName)
|
|
test_connection.return_value = False
|
|
domo_client.return_value = False
|
|
self.config = OpenMetadataWorkflowConfig.model_validate(
|
|
mock_domopipeline_config
|
|
)
|
|
self.domopipeline = DomopipelineSource.create(
|
|
mock_domopipeline_config["source"],
|
|
self.config.workflowConfig.openMetadataServerConfig,
|
|
)
|
|
self.domopipeline.context.get().__dict__["pipeline"] = MOCK_PIPELINE.name.root
|
|
self.domopipeline.context.get().__dict__[
|
|
"pipeline_service"
|
|
] = MOCK_PIPELINE_SERVICE.name.root
|
|
|
|
@patch("metadata.clients.domo_client.DomoClient.get_runs")
|
|
def test_pipeline(self, get_runs):
|
|
get_runs.return_value = mock_data
|
|
results = self.domopipeline.yield_pipeline(MOCK_PIPELINE_DETAILS)
|
|
pipeline_list = []
|
|
for result in results:
|
|
if isinstance(result, CreatePipelineRequest):
|
|
pipeline_list.append(result)
|
|
for _, (expected, original) in enumerate(zip(EXPECTED_PIPELINE, pipeline_list)):
|
|
self.assertEqual(expected, original)
|
|
|
|
@patch("metadata.clients.domo_client.DomoClient.get_runs")
|
|
def test_yield_pipeline_status(self, get_runs):
|
|
get_runs.return_value = mock_data
|
|
pipeline_status_list = []
|
|
results = self.domopipeline.yield_pipeline_status(MOCK_PIPELINE_DETAILS)
|
|
for result in results:
|
|
if isinstance(result.right, OMetaPipelineStatus):
|
|
pipeline_status_list.append(result.right)
|
|
|
|
for _, (expected, original) in enumerate(
|
|
zip(EXPECTED_PIPELINE_STATUS, pipeline_status_list)
|
|
):
|
|
self.assertEqual(expected, original)
|