diff --git a/dapr/clients/health.py b/dapr/clients/health.py index 120b5593..e3daec79 100644 --- a/dapr/clients/health.py +++ b/dapr/clients/health.py @@ -28,7 +28,7 @@ def wait_until_ready(): headers = {USER_AGENT_HEADER: DAPR_USER_AGENT} if settings.DAPR_API_TOKEN is not None: headers[DAPR_API_TOKEN_HEADER] = settings.DAPR_API_TOKEN - timeout = settings.DAPR_HEALTH_TIMEOUT + timeout = float(settings.DAPR_HEALTH_TIMEOUT) start = time.time() while True: diff --git a/tests/clients/test_heatlhcheck.py b/tests/clients/test_heatlhcheck.py index 5c67c2c6..f3be8a47 100644 --- a/tests/clients/test_heatlhcheck.py +++ b/tests/clients/test_heatlhcheck.py @@ -62,7 +62,7 @@ def test_wait_until_ready_success_with_api_token(self, mock_urlopen): self.assertIn('Dapr-api-token', headers) self.assertEqual(headers['Dapr-api-token'], 'mytoken') - @patch.object(settings, 'DAPR_HEALTH_TIMEOUT', 2) + @patch.object(settings, 'DAPR_HEALTH_TIMEOUT', '2.5') @patch('urllib.request.urlopen') def test_wait_until_ready_timeout(self, mock_urlopen): mock_urlopen.return_value.__enter__.return_value = MagicMock(status=500) @@ -72,5 +72,5 @@ def test_wait_until_ready_timeout(self, mock_urlopen): with self.assertRaises(TimeoutError): DaprHealth.wait_until_ready() - self.assertGreaterEqual(time.time() - start, 2) + self.assertGreaterEqual(time.time() - start, 2.5) self.assertGreater(mock_urlopen.call_count, 1)