Resolved bug 1719 - POL hangs waiting for webhook response 90/11290/2 v9.0 v9.1.5
authorAtul Agarwal <Atul.Agarwal@Altran.com>
Mon, 25 Oct 2021 15:44:45 +0000 (15:44 +0000)
committeragarwalat <atul.agarwal@altran.com>
Tue, 26 Oct 2021 10:29:14 +0000 (12:29 +0200)
Change-Id: Id12dc098053557c2904754b29371c693c1b1054b
Signed-off-by: Atul Agarwal <Atul.Agarwal@Altran.com>
osm_policy_module/alarming/service.py
osm_policy_module/tests/unit/alarming/test_alarming_service.py

index 1cc1a8d..ec1b354 100644 (file)
@@ -192,7 +192,7 @@ class AlarmingService:
                         log.info("Executing request to url %s for vnf alarm %s with status %s", action.url,
                                  alarm.alarm_id, status)
                         try:
-                            requests.post(url=action.url, json=json.dumps(payload))
+                            requests.post(url=action.url, json=json.dumps(payload), timeout=10)
                         except RequestException as e:
                             log.info("Error connecting to url %s", action.url)
                             log.debug("RequestException %s", e)
index 4edfa86..51edef2 100644 (file)
@@ -50,15 +50,15 @@ class TestAlarmingService(TestCase):
 
         service = AlarmingService(self.config)
         self.loop.run_until_complete(service.handle_alarm('test_id', 'alarm', {}))
-        requests_post.assert_called_once_with(json='{}', url='http://alarm-url/')
+        requests_post.assert_called_once_with(json='{}', url='http://alarm-url/', timeout=10)
 
         requests_post.reset_mock()
         self.loop.run_until_complete(service.handle_alarm('test_id', 'ok', {}))
-        requests_post.assert_called_once_with(json='{}', url='http://ok-url/')
+        requests_post.assert_called_once_with(json='{}', url='http://ok-url/', timeout=10)
 
         requests_post.reset_mock()
         self.loop.run_until_complete(service.handle_alarm('test_id', 'insufficient-data', {}))
-        requests_post.assert_called_once_with(json='{}', url='http://insufficient-data-url/')
+        requests_post.assert_called_once_with(json='{}', url='http://insufficient-data-url/', timeout=10)
 
     @mock.patch.object(VnfAlarmRepository, 'get')
     @mock.patch('requests.post')