Skip to content

Commit

Permalink
fix(ingestion): enable compat with avro 1.11 (#4205)
Browse files Browse the repository at this point in the history
  • Loading branch information
hsheth2 authored Feb 23, 2022
1 parent e6ff600 commit 49a8ece
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion metadata-ingestion/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def get_long_description():
"entrypoints",
"docker",
"expandvars>=0.6.5",
"avro-gen3==0.7.1",
"avro-gen3==0.7.2",
"avro>=1.10.2,<1.11",
"python-dateutil>=2.8.0",
"stackprinter",
Expand Down
22 changes: 22 additions & 0 deletions metadata-ingestion/tests/unit/serde/test_serde.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

import fastavro
import pytest
from avrogen import avrojson
from freezegun import freeze_time

import datahub.metadata.schema_classes as models
from datahub.cli.json_file import check_mce_file
from datahub.emitter import mce_builder
from datahub.ingestion.run.pipeline import Pipeline
from datahub.ingestion.source.file import iterate_mce_file
from datahub.metadata.schema_classes import MetadataChangeEventClass
Expand Down Expand Up @@ -145,3 +147,23 @@ def test_field_discriminator() -> None:
)

assert cost_object.validate()


def test_type_error() -> None:
dataflow = models.DataFlowSnapshotClass(
urn=mce_builder.make_data_flow_urn(
orchestrator="argo", flow_id="42", cluster="DEV"
),
aspects=[
models.DataFlowInfoClass(
name="hello_datahub",
description="Hello Datahub",
externalUrl="http://example.com",
# This is a type error - custom properties should be a Dict[str, str].
customProperties={"x": 1}, # type: ignore
)
],
)

with pytest.raises(avrojson.AvroTypeException):
dataflow.to_obj()

0 comments on commit 49a8ece

Please sign in to comment.