hussein-awala commented on code in PR #33174:
URL: https://github.com/apache/airflow/pull/33174#discussion_r1289115208


##########
tests/providers/cncf/kubernetes/operators/test_pod.py:
##########
@@ -920,6 +921,64 @@ def test_pod_template_file_kwargs_override(self, 
randomize_name, pod_template_fi
             "run_id": "test",
         }
 
+    @pytest.mark.parametrize(("randomize_name",), ([True], [False]))
+    def test_pod_template_dict(self, randomize_name):
+        templated_pod = k8s.V1Pod(
+            metadata=k8s.V1ObjectMeta(
+                namespace="templatenamespace",
+                name="hello",
+                labels={"release": "stable"},
+            ),
+            spec=k8s.V1PodSpec(
+                containers=[],
+                init_containers=[
+                    k8s.V1Container(
+                        name="git-clone",
+                        image="registry.k8s.io/git-sync:v3.1.1",
+                        args=[
+                            "[email protected]:airflow/some_repo.git",
+                            "--branch={{ params.get('repo_branch', 'master') 
}}",
+                        ],
+                    ),
+                ],
+            ),
+        )
+        k = KubernetesPodOperator(
+            task_id="task",
+            random_name_suffix=randomize_name,
+            
pod_template_dict=pod_generator.PodGenerator.serialize_pod(templated_pod),

Review Comment:
   I wonder if we should support both types `V1Pod` and dict :thinking: 
   I tested it and it seems like when we use `V1Pod` the template fields are 
not resolved. I will check if there is a simple solution for that.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to