X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FN2VC.git;a=blobdiff_plain;f=n2vc%2Ftests%2Funit%2Ftest_k8s_helm_conn.py;h=907ff404e357291c21ba5289f42dcdfacf45b37d;hp=736405f01bde09f1b1061eedad3a1f7fb282607e;hb=b46f88d2ce319c7661dc6064c8c76d020e314fb6;hpb=a8980cc3f6508f2659dc4ba4fcbeed65ba3c8e95 diff --git a/n2vc/tests/unit/test_k8s_helm_conn.py b/n2vc/tests/unit/test_k8s_helm_conn.py index 736405f..907ff40 100644 --- a/n2vc/tests/unit/test_k8s_helm_conn.py +++ b/n2vc/tests/unit/test_k8s_helm_conn.py @@ -42,7 +42,7 @@ class TestK8sHelmConn(asynctest.TestCase): # pass fake kubectl and helm commands to make sure it does not call actual commands K8sHelmConnector._check_file_exists = asynctest.Mock(return_value=True) K8sHelmConnector._local_async_exec = asynctest.CoroutineMock( - return_value=("", 0) + return_value=(0, "") ) cluster_dir = self.fs.path + self.cluster_id self.kube_config = self.fs.path + self.cluster_id + "/.kube/config" @@ -79,7 +79,9 @@ class TestK8sHelmConn(asynctest.TestCase): ), ) - repo_update_command = "env KUBECONFIG=./tmp/helm_cluster_id/.kube/config /usr/bin/helm repo update" + repo_update_command = ( + "env KUBECONFIG=./tmp/helm_cluster_id/.kube/config /usr/bin/helm repo update {}" + ).format(repo_name) repo_add_command = ( "env KUBECONFIG=./tmp/helm_cluster_id/.kube/config /usr/bin/helm repo add {} {}" ).format(repo_name, repo_url) @@ -87,24 +89,24 @@ class TestK8sHelmConn(asynctest.TestCase): call0_kargs = calls[0][1] self.assertEqual( call0_kargs.get("command"), - repo_update_command, - "Invalid repo update command: {}".format(call0_kargs.get("command")), + repo_add_command, + "Invalid repo add command: {}".format(call0_kargs.get("command")), ) self.assertEqual( call0_kargs.get("env"), self.env, - "Invalid env for update command: {}".format(call0_kargs.get("env")), + "Invalid env for add command: {}".format(call0_kargs.get("env")), ) call1_kargs = calls[1][1] self.assertEqual( call1_kargs.get("command"), - repo_add_command, - "Invalid repo add command: {}".format(call1_kargs.get("command")), + repo_update_command, + "Invalid repo update command: {}".format(call1_kargs.get("command")), ) self.assertEqual( call1_kargs.get("env"), self.env, - "Invalid env for add command: {}".format(call1_kargs.get("env")), + "Invalid env for update command: {}".format(call1_kargs.get("env")), ) @asynctest.fail_on(active_handles=True) @@ -168,8 +170,6 @@ class TestK8sHelmConn(asynctest.TestCase): namespace=self.namespace, db_dict=db_dict, operation="install", - run_once=True, - check_every=0, ) command = ( "env KUBECONFIG=./tmp/helm_cluster_id/.kube/config /usr/bin/helm install " @@ -212,8 +212,6 @@ class TestK8sHelmConn(asynctest.TestCase): namespace=self.namespace, db_dict=db_dict, operation="upgrade", - run_once=True, - check_every=0, ) command = ( "env KUBECONFIG=./tmp/helm_cluster_id/.kube/config /usr/bin/helm upgrade " @@ -305,8 +303,6 @@ class TestK8sHelmConn(asynctest.TestCase): namespace=self.namespace, db_dict=db_dict, operation="scale", - run_once=True, - check_every=0, ) @asynctest.fail_on(active_handles=True) @@ -339,8 +335,6 @@ class TestK8sHelmConn(asynctest.TestCase): namespace=self.namespace, db_dict=db_dict, operation="rollback", - run_once=True, - check_every=0, ) command = ( "env KUBECONFIG=./tmp/helm_cluster_id/.kube/config " @@ -544,8 +538,6 @@ class TestK8sHelmConn(asynctest.TestCase): namespace=self.namespace, db_dict=db_dict, operation="install", - run_once=True, - check_every=0, ) self.helm_conn._status_kdu.assert_called_once_with( cluster_id=self.cluster_id,