def test_classic_replication_check_connectionerror(): with nested( mock.patch('paasta_tools.monitoring.check_classic_service_replication.get_replication_for_services'), mock.patch('paasta_tools.monitoring.check_classic_service_replication.ClassicServiceReplicationCheck.__init__'), ) as ( mock_get_replication_for_services, mock_init, ): mock_get_replication_for_services.side_effect = requests.exceptions.ConnectionError mock_init.return_value = None check = ClassicServiceReplicationCheck() check.critical = mock.Mock() check.get_service_replication(['this', 'that'], 'localhost', 12345, DEFAULT_SYNAPSE_HAPROXY_URL_FORMAT) check.critical.assert_called_once_with('Failed to connect synapse haproxy on localhost:12345')
def test_classic_replication_check_unknownexception(): with mock.patch( 'paasta_tools.monitoring.check_classic_service_replication.get_replication_for_services', autospec=True, ) as mock_get_replication_for_services, mock.patch( 'paasta_tools.monitoring.check_classic_service_replication.ClassicServiceReplicationCheck.__init__', autospec=True, ) as mock_init: mock_get_replication_for_services.side_effect = Exception mock_init.return_value = None check = ClassicServiceReplicationCheck() check.critical = mock.Mock() check.get_service_replication(['this', 'that'], 'localhost', 12345, DEFAULT_SYNAPSE_HAPROXY_URL_FORMAT) check.critical.assert_called_once_with(mock.ANY)
def test_classic_replication_check_unknownexception(): with nested( mock.patch('paasta_tools.monitoring.check_classic_service_replication.get_replication_for_services'), mock.patch( 'paasta_tools.monitoring.check_classic_service_replication.ClassicServiceReplicationCheck.__init__'), ) as ( mock_get_replication_for_services, mock_init, ): mock_get_replication_for_services.side_effect = Exception mock_init.return_value = None check = ClassicServiceReplicationCheck() check.critical = mock.Mock() check.get_service_replication(['this', 'that'], 'localhost', 12345, DEFAULT_SYNAPSE_HAPROXY_URL_FORMAT) check.critical.assert_called_once_with(mock.ANY)
def test_classic_replication_check_unknownexception(): with nested( mock.patch( 'paasta_tools.monitoring.check_classic_service_replication.get_replication_for_services' ), mock.patch( 'paasta_tools.monitoring.check_classic_service_replication.ClassicServiceReplicationCheck.__init__' ), ) as ( mock_get_replication_for_services, mock_init, ): mock_get_replication_for_services.side_effect = Exception mock_init.return_value = None check = ClassicServiceReplicationCheck() check.critical = mock.Mock() check.get_service_replication(['this', 'that']) check.critical.assert_called_once_with(mock.ANY)