Files
wehub-resource-sync bf2343b7e4
Integration Tests - MySQL + Elasticsearch / Detect Changes (push) Has been cancelled
Integration Tests - MySQL + Elasticsearch / integration-tests-mysql-elasticsearch (push) Has been cancelled
Integration Tests - PostgreSQL + Elasticsearch + Redis / Detect Changes (push) Has been cancelled
Integration Tests - PostgreSQL + Elasticsearch + Redis / integration-tests-postgres-elasticsearch-redis (push) Has been cancelled
Integration Tests - PostgreSQL + OpenSearch / Detect Changes (push) Has been cancelled
Integration Tests - PostgreSQL + OpenSearch / integration-tests-postgres-opensearch (push) Has been cancelled
Java Checkstyle / java-checkstyle (push) Has been cancelled
Maven Collate Tests / maven-collate-ci (push) Has been cancelled
OpenMetadata Service Unit Tests / openmetadata-service-unit-tests-status (push) Has been cancelled
Publish Package to Maven Central Repository / publish-maven-packages (push) Has been cancelled
OpenMetadata Service Unit Tests / Detect Changes (push) Has been cancelled
OpenMetadata Service Unit Tests / openmetadata-service-unit-tests (push) Has been cancelled
OpenMetadata Service Unit Tests / k8s_operator-unit-tests (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:35:45 +08:00

145 lines
5.0 KiB
Python

# Copyright 2022 Collate
# Licensed under the Collate Community License, Version 1.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# https://github.com/open-metadata/OpenMetadata/blob/main/ingestion/LICENSE
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Test dashboard connectors with CLI
"""
from abc import abstractmethod
from typing import List # noqa: UP035
from unittest import TestCase
import pytest
from metadata.ingestion.api.status import Status
from .e2e_types import E2EType # noqa: TID252
from .test_cli import CliBase # noqa: TID252
class CliDashboardBase(TestCase):
"""
CLI Dashboard Base class
"""
class TestSuite(TestCase, CliBase): # pylint: disable=too-many-public-methods
"""
TestSuite class to define test structure
"""
# 1. deploy without including tags and data models
@pytest.mark.order(1)
def test_not_including(self) -> None:
# do anything need before running first test
self.prepare()
# build config file for ingest without including data models and tags
self.build_config_file(
E2EType.INGEST_DASHBOARD_NOT_INCLUDING,
{
"includeTags": "False",
"includeDataModels": "False",
},
)
# run ingest
result = self.run_command()
sink_status, source_status = self.retrieve_statuses(result)
self.assert_not_including(source_status, sink_status)
# 2. deploy vanilla ingestion including lineage, tags and data models
@pytest.mark.order(2)
def test_vanilla_ingestion(self) -> None:
# build config file for ingest
self.build_config_file(E2EType.INGEST)
# run ingest
result = self.run_command()
sink_status, source_status = self.retrieve_statuses(result)
self.assert_for_vanilla_ingestion(source_status, sink_status)
# 3. deploy with mixed filter patterns
@pytest.mark.order(3)
def test_filter_mix(self) -> None:
# build config file for ingest with filters
self.build_config_file(
E2EType.INGEST_DASHBOARD_FILTER_MIX,
{
"dashboards": {
"includes": self.get_includes_dashboards(),
"excludes": self.get_excludes_dashboards(),
},
"charts": {
"includes": self.get_includes_charts(),
"excludes": self.get_excludes_charts(),
},
"dataModels": {
"includes": self.get_includes_datamodels(),
"excludes": self.get_excludes_datamodels(),
},
},
)
# run ingest
result = self.run_command()
sink_status, source_status = self.retrieve_statuses(result)
self.assert_filtered_mix(source_status, sink_status)
@staticmethod
@abstractmethod
def get_connector_name() -> str:
raise NotImplementedError()
@abstractmethod
def assert_not_including(self, source_status: Status, sink_status: Status):
raise NotImplementedError()
@abstractmethod
def assert_for_vanilla_ingestion(self, source_status: Status, sink_status: Status) -> None:
raise NotImplementedError()
@abstractmethod
def assert_filtered_mix(self, source_status: Status, sink_status: Status):
raise NotImplementedError()
@staticmethod
@abstractmethod
def get_includes_dashboards() -> List[str]: # noqa: UP006
raise NotImplementedError()
@staticmethod
@abstractmethod
def get_excludes_dashboards() -> List[str]: # noqa: UP006
raise NotImplementedError()
@staticmethod
@abstractmethod
def get_includes_charts() -> List[str]: # noqa: UP006
raise NotImplementedError()
@staticmethod
@abstractmethod
def get_excludes_charts() -> List[str]: # noqa: UP006
raise NotImplementedError()
@staticmethod
@abstractmethod
def get_includes_datamodels() -> List[str]: # noqa: UP006
raise NotImplementedError()
@staticmethod
@abstractmethod
def get_excludes_datamodels() -> List[str]: # noqa: UP006
raise NotImplementedError()
@staticmethod
def get_test_type() -> str:
return "dashboard"
def prepare(self) -> None:
pass