You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2020/11/15 15:06:19 UTC

[airflow] branch v1-10-test updated: fixup! Added k9s as integrated tool to help with kubernetes testing (#12163)

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch v1-10-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v1-10-test by this push:
     new 759a564  fixup! Added k9s as integrated tool to help with kubernetes testing (#12163)
759a564 is described below

commit 759a564daf0ecb18a4238c81149810c0e18fd757
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Sun Nov 15 16:04:47 2020 +0100

    fixup! Added k9s as integrated tool to help with kubernetes testing (#12163)
---
 kubernetes_tests/test_kubernetes_pod_operator.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/kubernetes_tests/test_kubernetes_pod_operator.py b/kubernetes_tests/test_kubernetes_pod_operator.py
index 7a8674a..dce9e86 100644
--- a/kubernetes_tests/test_kubernetes_pod_operator.py
+++ b/kubernetes_tests/test_kubernetes_pod_operator.py
@@ -60,6 +60,11 @@ def create_context(task):
     }
 
 
+def get_kubeconfig_path():
+    kubeconfig_path = os.environ.get('KUBECONFIG')
+    return kubeconfig_path if kubeconfig_path else os.path.expanduser('~/.kube/config')
+
+
 # noinspection DuplicatedCode,PyUnusedLocal
 class TestKubernetesPodOperatorSystem(unittest.TestCase):
     def get_current_task_name(self):
@@ -128,7 +133,7 @@ class TestKubernetesPodOperatorSystem(unittest.TestCase):
 
     def test_do_xcom_push_defaults_false(self):
         new_config_path = '/tmp/kube_config'
-        old_config_path = os.path.expanduser('~/.kube/config')
+        old_config_path = get_kubeconfig_path()
         shutil.copy(old_config_path, new_config_path)
 
         k = KubernetesPodOperator(
@@ -147,7 +152,7 @@ class TestKubernetesPodOperatorSystem(unittest.TestCase):
 
     def test_config_path_move(self):
         new_config_path = '/tmp/kube_config'
-        old_config_path = os.path.expanduser('~/.kube/config')
+        old_config_path = get_kubeconfig_path()
         shutil.copy(old_config_path, new_config_path)
 
         k = KubernetesPodOperator(