Revert "Bug 1964 fixed: removed the variable cluster_uuid from init_env method"
[osm/N2VC.git] / n2vc / tests / unit / test_k8s_helm3_conn.py
index 25a5c0d..3163b85 100644 (file)
@@ -39,7 +39,7 @@ class TestK8sHelm3Conn(asynctest.TestCase):
         self.fs.path = "./tmp/"
         self.namespace = "testk8s"
         self.cluster_id = "helm3_cluster_id"
-        self.cluster_uuid = self.cluster_id
+        self.cluster_uuid = "{}:{}".format(self.namespace, self.cluster_id)
         # pass fake kubectl and helm commands to make sure it does not call actual commands
         K8sHelm3Connector._check_file_exists = asynctest.Mock(return_value=True)
         cluster_dir = self.fs.path + self.cluster_id
@@ -66,8 +66,8 @@ class TestK8sHelm3Conn(asynctest.TestCase):
 
         self.assertEqual(
             k8scluster_uuid,
-            self.cluster_id,
-            "Check cluster_uuid",
+            "{}:{}".format(self.namespace, self.cluster_id),
+            "Check cluster_uuid format: <namespace>.<cluster_id>",
         )
         self.helm_conn._get_namespaces.assert_called_once_with(self.cluster_id)
         self.helm_conn._create_namespace.assert_called_once_with(
@@ -92,7 +92,7 @@ class TestK8sHelm3Conn(asynctest.TestCase):
 
         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
+            from_path=self.cluster_uuid
         )
         self.assertEqual(
             self.helm_conn._local_async_exec.call_count,
@@ -559,7 +559,6 @@ class TestK8sHelm3Conn(asynctest.TestCase):
                 "updated": "2020-10-30 11:11:20.376744191 +0000 UTC",
             }
         ]
-        self.helm_conn._get_namespace = Mock(return_value=self.namespace)
         self.helm_conn._uninstall_sw = asynctest.CoroutineMock()
         self.helm_conn.instances_list = asynctest.CoroutineMock(return_value=instances)
         self.helm_conn.uninstall = asynctest.CoroutineMock()
@@ -569,9 +568,6 @@ class TestK8sHelm3Conn(asynctest.TestCase):
         self.helm_conn.fs.file_delete.assert_called_once_with(
             self.cluster_id, ignore_non_exist=True
         )
-        self.helm_conn._get_namespace.assert_called_once_with(
-            cluster_uuid=self.cluster_uuid
-        )
         self.helm_conn.instances_list.assert_called_once_with(
             cluster_uuid=self.cluster_uuid
         )
@@ -579,7 +575,7 @@ class TestK8sHelm3Conn(asynctest.TestCase):
             cluster_uuid=self.cluster_uuid, kdu_instance=kdu_instance
         )
         self.helm_conn._uninstall_sw.assert_called_once_with(
-            cluster_id=self.cluster_id, namespace=self.namespace
+            self.cluster_id, self.namespace
         )
 
     @asynctest.fail_on(active_handles=True)