changed severity of cc failures
This commit is contained in:
parent
06279d1346
commit
879b241060
@ -39,7 +39,7 @@ class ConsumerCommunicator:
|
|||||||
response = self._session.post(f"http://{ip}/sync", json={'uuid': os.environ['LOCAL_UUID']}, timeout=5)
|
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:
|
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
|
return
|
||||||
|
|
||||||
if response.status_code == 200:
|
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)
|
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:
|
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
|
continue
|
||||||
|
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
|
@ -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):
|
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)
|
requests_mock.post("http://127.0.0.2/sync", exc=requests.exceptions.ConnectTimeout)
|
||||||
|
|
||||||
consumer_communicator_instance.targeted_snyc("127.0.0.2")
|
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):
|
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):
|
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: [
|
consumer_communicator_instance._redis_store.r.keys.side_effect = lambda a: [
|
||||||
b"consumer_uuid1",
|
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
|
assert first.last_request.json()['uuid'] == LOCAL_UUID
|
||||||
|
|
||||||
logging.error.assert_called_once()
|
logging.warning.assert_called_once()
|
||||||
|
|
||||||
|
|
||||||
# ========================================
|
# ========================================
|
||||||
|
Reference in New Issue
Block a user