Skip to content

Commit

Permalink
Add test which demonstrates loss of information during ser/de
Browse files Browse the repository at this point in the history
  • Loading branch information
SamWheating committed Sep 5, 2023
1 parent 3ef3dde commit 4ec62d1
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/serialization/test_dag_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ def get_timetable_based_simple_dag(timetable):
dag.schedule_interval = timetable.summary
return dag


def serialize_subprocess(queue, dag_folder):
"""Validate pickle in a subprocess."""
dags = collect_dags(dag_folder)
Expand Down Expand Up @@ -430,6 +429,19 @@ def test_dag_serialization_to_timetable(self, timetable, serialized_timetable):
print(task["task_id"], k, v)
assert actual == expected

def test_dag_serialization_preserves_empty_access_roles(self):
"""Verify that an explicitlty empty access_control dict is preserved through serialization and deserialization."""
dag = collect_dags(["airflow/example_dags"])["simple_dag"]

Check failure on line 434 in tests/serialization/test_dag_serialization.py

View workflow job for this annotation

GitHub Actions / Static checks

Ruff (E501)

tests/serialization/test_dag_serialization.py:434:111: E501 Line too long (122 > 110 characters)
dag.access_control = {}
serialized_dag = SerializedDAG.to_dict(dag)
SerializedDAG.validate_schema(serialized_dag)

assert serialized_dag["dag"]["_access_control"] == {
"__type": "dict",
"__var": {}
}


def test_dag_serialization_unregistered_custom_timetable(self):
"""Verify serialization fails without timetable registration."""
dag = get_timetable_based_simple_dag(CustomSerializationTimetable("bar"))
Expand Down

0 comments on commit 4ec62d1

Please sign in to comment.