Skip to content

Commit

Permalink
tests: Use a specific cache file for every k8s_client
Browse files Browse the repository at this point in the history
Since the k8s_client cached information may change between runs, for
example when we run a test before upgrade and after, we need to reload
the cache
  • Loading branch information
TeddyAndrieux committed Jun 2, 2022
1 parent 7dba6d4 commit 3356dfd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/conftest.py
Expand Up @@ -104,12 +104,14 @@ def control_plane_ingress_ep(k8s_client, control_plane_ingress_ip):


@pytest.fixture
def k8s_client(request, kubeconfig):
def k8s_client(kubeconfig, tmp_path):
"""Return a DynamicClient to use for interaction with all K8s APIs."""
k8s_apiclient = kubernetes.config.new_client_from_config(
config_file=kubeconfig, persist_config=False
)
return kubernetes.dynamic.DynamicClient(k8s_apiclient)
return kubernetes.dynamic.DynamicClient(
k8s_apiclient, cache_file=str(tmp_path / "k8s-client-cache")
)


@pytest.fixture
Expand Down

0 comments on commit 3356dfd

Please sign in to comment.