2021-03-22 23:11:29 -07:00
|
|
|
from datahub.ingestion.run.pipeline import Pipeline
|
2021-04-13 17:30:24 -07:00
|
|
|
from tests.test_helpers import mce_helpers
|
2021-03-22 23:11:29 -07:00
|
|
|
|
|
|
|
|
2021-03-23 20:15:44 -07:00
|
|
|
def test_dbt_ingest(pytestconfig, tmp_path, mock_time):
|
2021-03-22 23:11:29 -07:00
|
|
|
test_resources_dir = pytestconfig.rootpath / "tests/integration/dbt"
|
|
|
|
|
2021-06-23 13:56:20 -07:00
|
|
|
# test manifest, catalog, sources are generated from https://github.com/kevinhu/sample-dbt
|
2021-03-22 23:11:29 -07:00
|
|
|
pipeline = Pipeline.create(
|
|
|
|
{
|
|
|
|
"run_id": "dbt-test",
|
|
|
|
"source": {
|
|
|
|
"type": "dbt",
|
|
|
|
"config": {
|
|
|
|
"manifest_path": f"{test_resources_dir}/dbt_manifest.json",
|
|
|
|
"catalog_path": f"{test_resources_dir}/dbt_catalog.json",
|
2021-06-23 13:56:20 -07:00
|
|
|
"sources_path": f"{test_resources_dir}/dbt_sources.json",
|
2021-05-17 12:22:52 -07:00
|
|
|
"target_platform": "dbt",
|
|
|
|
"load_schemas": True,
|
2021-03-22 23:11:29 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
"sink": {
|
|
|
|
"type": "file",
|
|
|
|
"config": {
|
|
|
|
"filename": f"{tmp_path}/dbt_mces.json",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
)
|
|
|
|
pipeline.run()
|
|
|
|
pipeline.raise_from_status()
|
|
|
|
|
2021-06-30 16:53:20 -07:00
|
|
|
mce_helpers.check_golden_file(
|
|
|
|
pytestconfig,
|
|
|
|
output_path=tmp_path / "dbt_mces.json",
|
|
|
|
golden_path=test_resources_dir / "dbt_mces_golden.json",
|
2021-03-22 23:11:29 -07:00
|
|
|
)
|