summaryrefslogtreecommitdiffstats
path: root/k8s/tests/conftest.py
diff options
context:
space:
mode:
authorSylwia_Jakubek <sylwia.jakubek@nokia.com>2020-07-23 11:34:53 +0200
committerSylwia Jakubek <sylwia.jakubek@nokia.com>2020-07-29 09:30:29 +0000
commit769649003dba4fbdb5330505518f161c798f2583 (patch)
tree33f5febd30896d62a444f7d451fe8a077ded47e0 /k8s/tests/conftest.py
parent3465a3b57448f406a3308949d4951c305973e935 (diff)
Adapt DCAE CFY K8S Plugin with K8S 1.17 version of APIs
Issue-ID: DCAEGEN2-2309 Signed-off-by: Sylwia Jakubek <sylwia.jakubek@nokia.com> Change-Id: I40db1bcaae65f6d30a71ac7831b6c316e82b5576
Diffstat (limited to 'k8s/tests/conftest.py')
-rw-r--r--k8s/tests/conftest.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/k8s/tests/conftest.py b/k8s/tests/conftest.py
index ae09da1..442e03c 100644
--- a/k8s/tests/conftest.py
+++ b/k8s/tests/conftest.py
@@ -2,6 +2,7 @@
# org.onap.dcae
# ================================================================================
# Copyright (c) 2018-2020 AT&T Intellectual Property. All rights reserved.
+# Copyright (c) 2020 Nokia. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -39,6 +40,7 @@ def mockk8sapi(monkeypatch):
# to get an API object
core = client.CoreV1Api()
ext = client.ExtensionsV1beta1Api()
+ appsv1 = client.AppsV1Api()
def pseudo_deploy(namespace, dep):
return dep
@@ -60,9 +62,17 @@ def mockk8sapi(monkeypatch):
monkeypatch.setattr(ext,"create_namespaced_deployment", pseudo_deploy)
return ext
+ # patched_appsv1 returns an AppsV1Api object with the
+ # create_namespaced_deployment method stubbed out so that there
+ # is no attempt to call the k8s API server
+ def patched_appsv1():
+ monkeypatch.setattr(ext,"create_namespaced_deployment", pseudo_deploy)
+ return ext
+
def pseudo_configure(loc):
pass
monkeypatch.setattr(k8sclient.k8sclient,"_configure_api", pseudo_configure)
monkeypatch.setattr(client, "CoreV1Api", patched_core)
monkeypatch.setattr(client,"ExtensionsV1beta1Api", patched_ext)
+ monkeypatch.setattr(client,"AppsV1Api", patched_appsv1)