mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-08 09:08:34 +00:00
MINOR - Fallback for testsuite imports (#18710)
This commit is contained in:
parent
dc101044d9
commit
6623ab17dc
@ -112,10 +112,14 @@ class BaseTestSuiteRunner:
|
|||||||
entity=self.entity, metadata=self.ometa_client
|
entity=self.entity, metadata=self.ometa_client
|
||||||
)
|
)
|
||||||
test_suite_class = import_test_suite_class(
|
test_suite_class = import_test_suite_class(
|
||||||
ServiceType.Database, source_type=self._interface_type
|
ServiceType.Database,
|
||||||
|
source_type=self._interface_type,
|
||||||
|
source_config_type=self.service_conn_config.type.value,
|
||||||
)
|
)
|
||||||
sampler_class = import_sampler_class(
|
sampler_class = import_sampler_class(
|
||||||
ServiceType.Database, source_type=self._interface_type
|
ServiceType.Database,
|
||||||
|
source_type=self._interface_type,
|
||||||
|
source_config_type=self.service_conn_config.type.value,
|
||||||
)
|
)
|
||||||
# This is shared between the sampler and DQ interfaces
|
# This is shared between the sampler and DQ interfaces
|
||||||
_orm = self._build_table_orm(self.entity)
|
_orm = self._build_table_orm(self.entity)
|
||||||
|
@ -14,6 +14,7 @@ from metadata.profiler.interface.profiler_interface import ProfilerInterface
|
|||||||
from metadata.sampler.sampler_interface import SamplerInterface
|
from metadata.sampler.sampler_interface import SamplerInterface
|
||||||
from metadata.utils.importer import (
|
from metadata.utils.importer import (
|
||||||
TYPE_SEPARATOR,
|
TYPE_SEPARATOR,
|
||||||
|
DynamicImportException,
|
||||||
get_class_path,
|
get_class_path,
|
||||||
get_module_dir,
|
get_module_dir,
|
||||||
import_from_module,
|
import_from_module,
|
||||||
@ -112,14 +113,34 @@ def import_profiler_class(
|
|||||||
|
|
||||||
|
|
||||||
def import_test_suite_class(
|
def import_test_suite_class(
|
||||||
service_type: ServiceType, source_type: str
|
service_type: ServiceType,
|
||||||
|
source_type: str,
|
||||||
|
source_config_type: Optional[str] = None,
|
||||||
) -> Type[TestSuiteInterface]:
|
) -> Type[TestSuiteInterface]:
|
||||||
class_path = BaseSpec.get_for_source(service_type, source_type).test_suite_class
|
try:
|
||||||
|
class_path = BaseSpec.get_for_source(service_type, source_type).test_suite_class
|
||||||
|
except DynamicImportException:
|
||||||
|
if source_config_type:
|
||||||
|
class_path = BaseSpec.get_for_source(
|
||||||
|
service_type, source_config_type.lower()
|
||||||
|
).test_suite_class
|
||||||
|
else:
|
||||||
|
raise
|
||||||
return cast(Type[TestSuiteInterface], import_from_module(class_path))
|
return cast(Type[TestSuiteInterface], import_from_module(class_path))
|
||||||
|
|
||||||
|
|
||||||
def import_sampler_class(
|
def import_sampler_class(
|
||||||
service_type: ServiceType, source_type: str
|
service_type: ServiceType,
|
||||||
|
source_type: str,
|
||||||
|
source_config_type: Optional[str] = None,
|
||||||
) -> Type[SamplerInterface]:
|
) -> Type[SamplerInterface]:
|
||||||
class_path = BaseSpec.get_for_source(service_type, source_type).sampler_class
|
try:
|
||||||
|
class_path = BaseSpec.get_for_source(service_type, source_type).sampler_class
|
||||||
|
except DynamicImportException:
|
||||||
|
if source_config_type:
|
||||||
|
class_path = BaseSpec.get_for_source(
|
||||||
|
service_type, source_config_type.lower()
|
||||||
|
).sampler_class
|
||||||
|
else:
|
||||||
|
raise
|
||||||
return cast(Type[SamplerInterface], import_from_module(class_path))
|
return cast(Type[SamplerInterface], import_from_module(class_path))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user