Skip to content
Snippets Groups Projects
Unverified Commit b98614cb authored by Varac's avatar Varac
Browse files

Allow running tests_resources.py with only KUBECONFIG exported

parent f1408151
No related branches found
No related tags found
No related merge requests found
......@@ -10,10 +10,10 @@ Documentation for the kubernetes client:
* https://github.com/kubernetes-client/python/tree/master/examples
"""
import os
from kubernetes import client, config
from kubernetes.client.rest import ApiException
import pytest
from kubernetes import client, config
from kubernetes.client.rest import ApiException
# Helper functions
......@@ -134,7 +134,10 @@ def run_around_tests():
Prepare kube config before running a test
"""
cluster_dir = os.environ.get("CLUSTER_DIR")
kubeconfig = os.path.join('..', str(cluster_dir), 'kube_config_cluster.yml')
if cluster_dir:
kubeconfig = os.path.join('..', str(cluster_dir), 'kube_config_cluster.yml')
else:
kubeconfig = os.path.join(os.environ.get("KUBECONFIG"))
config.load_kube_config(config_file=kubeconfig)
yield
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment