Feature 10996: Adds handling of nslcmop cancel event. kafka_read_callback is now...
[osm/LCM.git] / osm_lcm / tests / test_lcm.py
index e05836a..df6b49e 100644 (file)
@@ -64,7 +64,7 @@ def check_file_content(health_check_file: str) -> str:
 
 class TestLcm(TestCase):
     def setUp(self):
-        self.config_file = os.getcwd() + "/osm_lcm/tests/test_lcm_config_file_ini.cfg"
+        self.config_file = os.getcwd() + "/osm_lcm/tests/test_lcm_config_file.yaml"
         self.config_file_without_storage_path = tempfile.mkstemp()[1]
         Database.instance = None
         self.db = Mock(Database({"database": {"driver": "memory"}}).instance.db)
@@ -85,40 +85,40 @@ class TestLcm(TestCase):
     #     with self.assertRaises(LcmException):
     #         Lcm(config_file=self.config_file_without_storage_path)
 
-    def test_kafka_admin_topic_ping_command(self):
+    async def test_kafka_admin_topic_ping_command(self):
         params = {
             "to": "lcm",
             "from": "lcm",
             "worker_id": self.my_lcm.worker_id,
         }
         self.my_lcm.health_check_file = tempfile.mkstemp()[1]
-        self.my_lcm.kafka_read_callback("admin", "ping", params)
+        await self.my_lcm.kafka_read_callback("admin", "ping", params)
         pattern = "[0-9]{10}.[0-9]{5,8}"
         # Epoch time is written in health check file.
         result = re.findall(pattern, check_file_content(self.my_lcm.health_check_file))
         self.assertTrue(result)
 
-    def test_kafka_wrong_topic_ping_command(self):
+    async def test_kafka_wrong_topic_ping_command(self):
         params = {
             "to": "lcm",
             "from": "lcm",
             "worker_id": self.my_lcm.worker_id,
         }
         self.my_lcm.health_check_file = tempfile.mkstemp()[1]
-        self.my_lcm.kafka_read_callback("kafka", "ping", params)
+        await self.my_lcm.kafka_read_callback("kafka", "ping", params)
         pattern = "[0-9]{10}.[0-9]{5,8}"
         # Health check file is empty.
         result = re.findall(pattern, check_file_content(self.my_lcm.health_check_file))
         self.assertFalse(result)
 
-    def test_kafka_admin_topic_ping_command_wrong_worker_id(self):
+    async def test_kafka_admin_topic_ping_command_wrong_worker_id(self):
         params = {
             "to": "lcm",
             "from": "lcm",
             "worker_id": 5,
         }
         self.my_lcm.health_check_file = tempfile.mkstemp()[1]
-        self.my_lcm.kafka_read_callback("admin", "ping", params)
+        await self.my_lcm.kafka_read_callback("admin", "ping", params)
         pattern = "[0-9]{10}.[0-9]{5,8}"
         # Health check file is empty.
         result = re.findall(pattern, check_file_content(self.my_lcm.health_check_file))