X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FN2VC.git;a=blobdiff_plain;f=n2vc%2Ftests%2Funit%2Ftest_k8s_helm3_conn.py;h=3b8132395148d3cb9ae3d273cf3ffd791d87caf3;hp=e5af88161d91f705c2c8269ed6413e411a01647f;hb=04686d9251e8dd3c5ac2d617aa5a1b5552e769d1;hpb=1c83f2e4d061ad37ba898e114cb42e70fdee5145 diff --git a/n2vc/tests/unit/test_k8s_helm3_conn.py b/n2vc/tests/unit/test_k8s_helm3_conn.py index e5af881..3b81323 100644 --- a/n2vc/tests/unit/test_k8s_helm3_conn.py +++ b/n2vc/tests/unit/test_k8s_helm3_conn.py @@ -68,7 +68,7 @@ class TestK8sHelm3Conn(asynctest.TestCase): self.helm_conn._create_namespace.assert_called_once_with(self.cluster_id, self.namespace) self.helm_conn.repo_list.assert_called_once_with(k8scluster_uuid) self.helm_conn.repo_add.assert_called_once_with( - k8scluster_uuid, "stable", "https://kubernetes-charts.storage.googleapis.com/") + k8scluster_uuid, "stable", "https://charts.helm.sh/stable") self.helm_conn.fs.reverse_sync.assert_called_once_with(from_path=self.cluster_id) self.logger.debug(f"cluster_uuid: {k8scluster_uuid}") @@ -134,21 +134,24 @@ class TestK8sHelm3Conn(asynctest.TestCase): self.helm_conn._local_async_exec = asynctest.CoroutineMock(return_value=("", 0)) self.helm_conn._status_kdu = asynctest.CoroutineMock(return_value=None) self.helm_conn._store_status = asynctest.CoroutineMock() - self.helm_conn._generate_release_name = Mock(return_value="stable-openldap-0005399828") + self.kdu_instance = "stable-openldap-0005399828" + self.helm_conn.generate_kdu_instance_name = Mock(return_value=self.kdu_instance) + self.helm_conn._get_namespaces = asynctest.CoroutineMock(return_value=[]) + self.helm_conn._create_namespace = asynctest.CoroutineMock() - kdu_instance = await self.helm_conn.install(self.cluster_uuid, - kdu_model, - atomic=True, - namespace=self.namespace, - db_dict=db_dict) + await self.helm_conn.install( + self.cluster_uuid, + kdu_model, + self.kdu_instance, + atomic=True, + namespace=self.namespace, + db_dict=db_dict + ) + self.helm_conn._get_namespaces.assert_called_once() + self.helm_conn._create_namespace.assert_called_once_with(self.cluster_id, self.namespace) self.helm_conn.fs.sync.assert_called_once_with(from_path=self.cluster_id) self.helm_conn.fs.reverse_sync.assert_called_once_with(from_path=self.cluster_id) - self.helm_conn._generate_release_name.assert_called_once_with("stable/openldap") - self.helm_conn._status_kdu.assert_called_once_with(cluster_id=self.cluster_id, - kdu_instance=kdu_instance, - namespace=self.namespace, - show_error_log=False) self.helm_conn._store_status.assert_called_with(cluster_id=self.cluster_id, kdu_instance=kdu_instance, namespace=self.namespace, @@ -442,7 +445,7 @@ class TestK8sHelm3Conn(asynctest.TestCase): if args[0] == "k8sclusters": return { "_admin": { - "helm_chart_repos" : [ + "helm_chart_repos": [ "4b5550a9-990d-4d95-8a48-1f4614d6ac9c" ] }