davlum commented on a change in pull request #4952: [AIRFLOW-4008] add envFrom 
for Kubernetes Executor
URL: https://github.com/apache/airflow/pull/4952#discussion_r270146654
 
 

 ##########
 File path: 
tests/contrib/kubernetes/kubernetes_request_factory/test_kubernetes_request_factory.py
 ##########
 @@ -0,0 +1,380 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from airflow.contrib.kubernetes.kubernetes_request_factory.\
+    kubernetes_request_factory import KubernetesRequestFactory
+from airflow.contrib.kubernetes.pod import Pod, Resources
+from airflow.contrib.kubernetes.secret import Secret
+import yaml
+import unittest
+
+
+class TestKubernetesRequestFactory(unittest.TestCase):
+
+    _yaml = """
+apiVersion: v1
+kind: Pod
+metadata:
+  name: name
+spec:
+  containers:
+    - name: base
+      image: airflow-worker:latest
+      command: ["/usr/local/airflow/entrypoint.sh", "/bin/bash sleep 25"]
+  restartPolicy: Never
+"""
+
+    def setUp(self) -> None:
+        self.kubernetes_request_factory = KubernetesRequestFactory()
+
+        self.req = yaml.load(self._yaml)
+
+    def test_extract_image(self):
+        input_req = self.req.copy()
+        reference = self.req.copy()
+        pod = Pod('v3.14', {}, [])
+        self.kubernetes_request_factory.extract_image(pod, input_req)
+        reference['spec']['containers'][0]['image'] = pod.image
 
 Review comment:
   I tried to clarify what's being tested.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to