2021-02-11 12:53:44 -08:00
|
|
|
import mce_helpers
|
2021-02-18 14:47:49 -08:00
|
|
|
from click.testing import CliRunner
|
2021-02-11 12:53:44 -08:00
|
|
|
|
2021-02-18 14:47:49 -08:00
|
|
|
from datahub.entrypoints import datahub
|
2021-02-09 01:02:05 -08:00
|
|
|
|
2021-02-11 12:24:20 -08:00
|
|
|
|
2021-02-18 14:47:49 -08:00
|
|
|
def test_mysql_ingest(mysql, pytestconfig):
|
|
|
|
test_resources_dir = pytestconfig.rootpath / "tests/integration/mysql"
|
2021-02-11 16:00:29 -08:00
|
|
|
config_file = (test_resources_dir / "mysql_to_file.yml").resolve()
|
2021-02-09 01:02:05 -08:00
|
|
|
|
2021-02-18 14:47:49 -08:00
|
|
|
# Run the metadata ingestion pipeline.
|
|
|
|
runner = CliRunner()
|
|
|
|
with runner.isolated_filesystem():
|
|
|
|
result = runner.invoke(datahub, ["ingest", "-c", f"{config_file}"])
|
|
|
|
assert result.exit_code == 0
|
|
|
|
|
|
|
|
output = mce_helpers.load_json_file("mysql_mces.json")
|
|
|
|
|
|
|
|
# Verify the output.
|
2021-02-11 22:48:08 -08:00
|
|
|
golden = mce_helpers.load_json_file(
|
|
|
|
str(test_resources_dir / "mysql_mce_golden.json")
|
|
|
|
)
|
2021-02-11 12:53:44 -08:00
|
|
|
mce_helpers.assert_mces_equal(output, golden)
|