From 88f33743c65f0e4ec61c1e1cfa99c806c4a40495 Mon Sep 17 00:00:00 2001 From: micafer Date: Fri, 27 Nov 2020 11:36:04 +0100 Subject: [PATCH] Fix/Iprove Kube conn --- test/unit/connectors/Kubernetes.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/unit/connectors/Kubernetes.py b/test/unit/connectors/Kubernetes.py index 98dd7486a..14b7b62c8 100755 --- a/test/unit/connectors/Kubernetes.py +++ b/test/unit/connectors/Kubernetes.py @@ -90,6 +90,8 @@ def get_response(self, method, url, verify, headers, data): resp.text = ('{"metadata": {"namespace":"namespace", "name": "name"}, "status": ' '{"phase":"Running", "hostIP": "158.42.1.1", "podIP": "10.0.0.1"}, ' '"spec": {"volumes": [{"persistentVolumeClaim": {"claimName" : "cname"}}]}}') + if url == "/api/v1/namespaces/infid": + resp.status_code = 200 elif method == "POST": if url.endswith("/pods"): resp.status_code = 201 @@ -142,7 +144,9 @@ def test_20_launch(self, save_data, requests): requests.side_effect = self.get_response - res = kube_cloud.launch(InfrastructureInfo(), radl, radl, 1, auth) + inf = MagicMock(["id", "_lock", "add_vm"]) + inf.id = "infid" + res = kube_cloud.launch(inf, radl, radl, 1, auth) success, _ = res[0] self.assertTrue(success, msg="ERROR: launching a VM.") self.assertNotIn("ERROR", self.log.getvalue(), msg="ERROR found in log: %s" % self.log.getvalue())