def test_dbt_parse_dbt_test_event(mock_datetime, mock_uuid, parent_run_metadata): mock_datetime.now.return_value.isoformat.return_value = '2021-08-25T11:00:25.277467+00:00' mock_uuid.side_effect = [ '6edf42ed-d8d0-454a-b819-d09b9067ff99', '1a69c0a7-04bb-408b-980e-cbbfb1831ef7', 'f99310b4-339a-4381-ad3e-c1b95c24ff11', 'c11f2efd-4415-45fc-8081-10d2aaa594d2', ] processor = DbtArtifactProcessor( producer= 'https://github.com/OpenLineage/OpenLineage/tree/0.0.1/integration/dbt', project_dir='tests/dbt/test', ) processor.dbt_run_metadata = parent_run_metadata dbt_events = processor.parse() events = [ attr.asdict(event, value_serializer=serialize) for event in dbt_events.starts + dbt_events.completes + dbt_events.fails ] with open('tests/dbt/test/result.json', 'r') as f: assert match(json.load(f), events)
def test_dbt_parse_and_compare_event(path, parent_run_metadata): processor = DbtArtifactProcessor( producer= 'https://github.com/OpenLineage/OpenLineage/tree/0.0.1/integration/dbt', project_dir=path) processor.dbt_run_metadata = parent_run_metadata dbt_events = processor.parse() events = [ attr.asdict(event, value_serializer=serialize) for event in dbt_events.starts + dbt_events.completes + dbt_events.fails ] with open(f'{path}/result.json', 'r') as f: assert match(json.load(f), events)
def test_dbt_parse_profile_with_env_vars(mock_uuid, parent_run_metadata): mock_uuid.side_effect = [ '6edf42ed-d8d0-454a-b819-d09b9067ff99', ] processor = DbtArtifactProcessor( producer= 'https://github.com/OpenLineage/OpenLineage/tree/0.0.1/integration/dbt', project_dir='tests/dbt/env_vars', target='prod', ) processor.dbt_run_metadata = parent_run_metadata dbt_events = processor.parse() events = [ attr.asdict(event, value_serializer=serialize) for event in dbt_events.starts + dbt_events.completes + dbt_events.fails ] with open('tests/dbt/env_vars/result.json', 'r') as f: assert match(json.load(f), events)