mirror of
https://github.com/datahub-project/datahub.git
synced 2025-07-24 10:00:07 +00:00
43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
![]() |
import logging
|
||
|
import sys
|
||
|
|
||
|
import pytest
|
||
|
|
||
|
from datahub.ingestion.run.pipeline import Pipeline
|
||
|
from tests.test_helpers import mce_helpers
|
||
|
|
||
|
logging.getLogger("lkml").setLevel(logging.INFO)
|
||
|
|
||
|
|
||
|
@pytest.mark.skipif(sys.version_info < (3, 7), reason="lkml requires Python 3.7+")
|
||
|
def test_lookml_ingest(pytestconfig, tmp_path, mock_time):
|
||
|
test_resources_dir = pytestconfig.rootpath / "tests/integration/lookml"
|
||
|
|
||
|
pipeline = Pipeline.create(
|
||
|
{
|
||
|
"run_id": "lookml-test",
|
||
|
"source": {
|
||
|
"type": "lookml",
|
||
|
"config": {
|
||
|
"base_folder": str(test_resources_dir),
|
||
|
"connection_to_platform_map": {"my_connection": "conn"},
|
||
|
"parse_table_names_from_sql": True,
|
||
|
},
|
||
|
},
|
||
|
"sink": {
|
||
|
"type": "file",
|
||
|
"config": {
|
||
|
"filename": f"{tmp_path}/lookml_mces.json",
|
||
|
},
|
||
|
},
|
||
|
}
|
||
|
)
|
||
|
pipeline.run()
|
||
|
pipeline.raise_from_status()
|
||
|
|
||
|
output = mce_helpers.load_json_file(str(tmp_path / "lookml_mces.json"))
|
||
|
expected = mce_helpers.load_json_file(
|
||
|
str(test_resources_dir / "expected_output.json")
|
||
|
)
|
||
|
mce_helpers.assert_mces_equal(output, expected)
|