From 7aad083dca2240258acba20882053b8270a1dacb Mon Sep 17 00:00:00 2001
From: Varac <varac@varac.net>
Date: Wed, 18 Dec 2019 09:18:14 +0100
Subject: [PATCH] Use proper KUBECONFIG file for helmrelease test

---
 test/pytest/test_helmreleases.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/test/pytest/test_helmreleases.py b/test/pytest/test_helmreleases.py
index 85483b2af..476dcebd4 100644
--- a/test/pytest/test_helmreleases.py
+++ b/test/pytest/test_helmreleases.py
@@ -1,6 +1,7 @@
 import pytest
 from kubernetes import client, config
 from kubernetes.client.rest import ApiException
+import os
 
 
 def get_release(name, namespace, api):
@@ -26,7 +27,7 @@ def get_release(name, namespace, api):
 
 
 @pytest.mark.helmreleases
-def test_helmreleases():
+def test_helmreleases(host):
     """Checks if all desired HelmReleases installed by weave flux are in
     DEPLOYED state.
     """
@@ -35,7 +36,10 @@ def test_helmreleases():
         'oas-apps': ['nextcloud']
     }
 
-    config.load_kube_config()
+    cluster_dir = os.path.dirname(os.environ.get("INVENTORY"))
+    kubeconfig = os.path.join(cluster_dir, 'secrets',
+                              'kube_config_cluster.yml')
+    config.load_kube_config(config_file=kubeconfig)
     customObjects = client.CustomObjectsApi()
 
     failed = 0
-- 
GitLab