You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/03/20 01:44:05 UTC

[GitHub] [airflow] kaxil commented on a change in pull request #14909: Sort lists, sets and tuples in Serialized DAGs

kaxil commented on a change in pull request #14909:
URL: https://github.com/apache/airflow/pull/14909#discussion_r598044524



##########
File path: tests/serialization/test_dag_serialization.py
##########
@@ -1027,6 +1027,33 @@ def test_dag_on_failure_callback_roundtrip(self, passed_failure_callback, expect
 
         assert deserialized_dag.has_on_failure_callback is expected_value
 
+    @parameterized.expand(
+        [
+            (
+                ['task_1', 'task_5', 'task_2', 'task_4'],
+                ['task_1', 'task_2', 'task_4', 'task_5'],
+            ),
+            (
+                {'task_1', 'task_5', 'task_2', 'task_4'},
+                ['task_1', 'task_2', 'task_4', 'task_5'],
+            ),
+            (
+                ('task_1', 'task_5', 'task_2', 'task_4'),
+                ['task_1', 'task_2', 'task_4', 'task_5'],
+            ),
+            (
+                {"task3": "test3", "task2": "test2", "task1": "test1"},
+                {"task1": "test1", "task2": "test2", "task3": "test3"},
+            ),
+        ]
+    )
+    def test_serialized_objects_are_sorted(self, object_to_serialized, expected_output):
+        """Test Serialized Lists, Sets and Tuples are sorted"""
+        serialized_obj = SerializedDAG._serialize(object_to_serialized)
+        if isinstance(serialized_obj, dict) and "__type" in serialized_obj:
+            serialized_obj = serialized_obj["__var"]

Review comment:
       This is to take care of the following code:
   
   https://github.com/apache/airflow/blob/2f32df7b711cf63d18efd5e0023b22a79040cc86/airflow/serialization/serialized_objects.py#L190-L193




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org