ashb commented on a change in pull request #4772: [AIRFLOW-3937]
KubernetesPodOperator support for envFrom configMapRef…
URL: https://github.com/apache/airflow/pull/4772#discussion_r266894610
##########
File path: tests/contrib/minikube/test_kubernetes_pod_operator.py
##########
@@ -326,6 +330,69 @@ def test_xcom_push(self):
)
self.assertEqual(k.execute(None), json.loads(return_value))
+ def test_envs_from_configmaps(self):
+ # GIVEN
+ return_value = 123
+ configmap_name = 'test-configmap'
+ metadata = V1ObjectMeta(
+ name=configmap_name,
+ namespace='default'
+ )
+ configmap_object = V1ConfigMap(
+ data={
+ "TEST_CONFIGMAP_VALUE": str(return_value)
+ },
+ metadata=metadata
+ )
+ client = get_kube_client(in_cluster=False)
+ client.create_namespaced_config_map(namespace='default',
body=configmap_object)
Review comment:
This leaves the ConfigMap object hanging around in kubernetes, which means
if you try to run the same test twice in the cluster it will fail the second
time around.
Please use `try`/`finally` to remove the config map at the end. (Similarly
for the Secret).
Alternatively I would accept not actually running the pod (as this started
to get in to the realm of testing behaviour of kubernetes itself) but instead
mocking and checking that we pass the expected structure to kube clients etc.
----------------------------------------------------------------
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