Issue - 1091 (#1096)

* fixed issue with not being able to load config file; cleaned up unused code

* fixed test case to test configuration error

Co-authored-by: Vijay Mariadassou <vijay@mariadassou.com>
This commit is contained in:
vijaypm 2021-11-07 11:19:06 -08:00 committed by GitHub
parent 3489cbbfb1
commit d14755b4e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,7 +2,7 @@ import importlib
import pathlib
from unittest import TestCase
from metadata.config.common import load_config_file
from metadata.config.common import load_config_file, ConfigurationError
from metadata.ingestion.api.workflow import Workflow
from metadata.ingestion.ometa.ometa_api import OpenMetadata
from metadata.ingestion.ometa.openmetadata_rest import MetadataServerConfig
@ -49,7 +49,8 @@ class WorkflowTest(TestCase):
self.assertEqual(replace, "QueryParser")
def test_execute_200(self):
config_file = pathlib.Path("tests/unit/mysql_test.json")
current_dir = pathlib.Path(__file__).resolve().parent
config_file = current_dir.joinpath("mysql_test.json")
workflow_config = load_config_file(config_file)
workflow = Workflow.create(workflow_config)
workflow.execute()
@ -69,12 +70,8 @@ class WorkflowTest(TestCase):
self.assertEqual(ingestionData is not None, True)
def test_execute_4xx(self):
config_file = pathlib.Path("tests/unit/mysql_test.json")
workflow_config = load_config_file(config_file)
ingestionData = None
config_file = pathlib.Path("/tmp/mysql_test123")
try:
file_path = "/tmp/mysql_test123"
with open(file_path) as ingestionFile:
ingestionData = ingestionFile.read()
except FileNotFoundError:
self.assertRaises(FileNotFoundError)
workflow_config = load_config_file(config_file)
except ConfigurationError:
self.assertRaises(ConfigurationError)