diff --git a/communicators.py b/communicators.py index 25427b1..0d8f910 100644 --- a/communicators.py +++ b/communicators.py @@ -39,7 +39,7 @@ class ConsumerCommunicator: response = self._session.post(f"http://{ip}/sync", json={'uuid': os.environ['LOCAL_UUID']}, timeout=5) except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e: - logging.error(f"Error while syncing to {ip}: {str(e)}") + logging.warning(f"Error while syncing to {ip}: {str(e)}") return if response.status_code == 200: @@ -53,7 +53,7 @@ class ConsumerCommunicator: response = self._session.post(f"http://{ip}/sync", json={'uuid': os.environ['LOCAL_UUID']}, timeout=5) except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e: - logging.error(f"Error while syncing to {ip}: {str(e)}") + logging.warning(f"Error while syncing to {ip}: {str(e)}") continue if response.status_code == 200: diff --git a/test_everything.py b/test_everything.py index 3a5a7ab..8c843af 100644 --- a/test_everything.py +++ b/test_everything.py @@ -347,13 +347,13 @@ def test_cc_targeted_sync(requests_mock, consumer_communicator_instance): def test_cc_targeted_sync_error_logged(mocker, requests_mock, consumer_communicator_instance): - mocker.patch("logging.error") + mocker.patch("logging.warning") requests_mock.post("http://127.0.0.2/sync", exc=requests.exceptions.ConnectTimeout) consumer_communicator_instance.targeted_snyc("127.0.0.2") - logging.error.assert_called_once() + logging.warning.assert_called_once() def test_cc_sync_all(requests_mock, consumer_communicator_instance): @@ -399,7 +399,7 @@ def test_cc_sync_all(requests_mock, consumer_communicator_instance): def test_cc_sync_all_error_logged(mocker, requests_mock, consumer_communicator_instance): - mocker.patch("logging.error") + mocker.patch("logging.warning") consumer_communicator_instance._redis_store.r.keys.side_effect = lambda a: [ b"consumer_uuid1", @@ -441,7 +441,7 @@ def test_cc_sync_all_error_logged(mocker, requests_mock, consumer_communicator_i assert first.last_request.json()['uuid'] == LOCAL_UUID - logging.error.assert_called_once() + logging.warning.assert_called_once() # ========================================