dimberman commented on a change in pull request #4952: 
feat/AIRFLOW-4008/k8s-executor-env-from
URL: https://github.com/apache/airflow/pull/4952#discussion_r267557050
 
 

 ##########
 File path: 
tests/contrib/kubernetes/kubernetes_request_factory/test_pod_request_factory.py
 ##########
 @@ -0,0 +1,154 @@
+# -*- coding: utf-8 -*-
+#
+# 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.\
+    pod_request_factory import SimplePodRequestFactory, \
+    ExtractXcomPodRequestFactory
+from airflow.contrib.kubernetes.pod import Pod
+from mock import ANY
+import unittest
+
+
+class TestSimplePodRequestFactory(unittest.TestCase):
+
+    def setUp(self):
+        self.simple_pod_request_factory = SimplePodRequestFactory()
+        self.xcom_pod_request_factory = ExtractXcomPodRequestFactory()
+        self.pod = Pod(
+            image='busybox',
+            envs={
+                'ENVIRONMENT': 'prod',
+                'LOG_LEVEL': 'warning'
+            },
+            name='myapp-pod',
+            cmds=['sh', '-c', 'echo Hello Kubernetes!'],
+            labels={'app': 'myapp'},
+            env_from_configmap_ref='env_from_configmap',
+            env_from_secret_ref='env_from_secret_a,env_from_secret_b',
+            image_pull_secrets='pull_secret_a,pull_secret_b'
+        )
+        self.maxDiff = None
+
+    def test_simple_pod_request_factory_create(self):
+        expected_result = {
+            'apiVersion': 'v1',
+            'kind': 'Pod',
 
 Review comment:
   there seems to be a lot of boiler plate code copied between these tests. 
Could you please create a base object and then copy + modify that object as 
needed for each function?

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to