def test_get_timeout(self): api_client = self.mock_keep_services(count=1) force_timeout = [socket.timeout("timed out")] with tutil.mock_get(force_timeout) as mock_session: keep_client = arvados.KeepClient(api_client=api_client) with self.assertRaises(arvados.errors.KeepReadError): keep_client.get('ffffffffffffffffffffffffffffffff') self.assertTrue(mock_session.return_value.get.called) self.assertEqual( arvados.KeepClient.DEFAULT_TIMEOUT, mock_session.return_value.get.call_args[1]['timeout'])
def test_proxy_get_timeout(self): # Force a timeout, verifying that the requests.get or # requests.put method was called with the proxy_timeout # setting rather than the default timeout. api_client = self.mock_keep_services(service_type='proxy', count=1) force_timeout = [socket.timeout("timed out")] with tutil.mock_get(force_timeout) as mock_session: keep_client = arvados.KeepClient(api_client=api_client) with self.assertRaises(arvados.errors.KeepReadError): keep_client.get('ffffffffffffffffffffffffffffffff') self.assertTrue(mock_session.return_value.get.called) self.assertEqual( arvados.KeepClient.DEFAULT_PROXY_TIMEOUT, mock_session.return_value.get.call_args[1]['timeout'])
def test_retry_data_with_wrong_checksum(self): with tutil.mock_get((tutil.fake_requests_response(200, s) for s in ['baddata', self.TEST_DATA])): self.check_success(locator=self.HINTED_LOCATOR)
def test_try_next_server_after_timeout(self): with tutil.mock_get([ socket.timeout("timed out"), tutil.fake_requests_response(200, self.DEFAULT_EXPECT)]): self.check_success(locator=self.HINTED_LOCATOR)
def test_try_next_server_after_timeout(self): with tutil.mock_get([ socket.timeout("timed out"), tutil.fake_requests_response(200, self.DEFAULT_EXPECT) ]): self.check_success(locator=self.HINTED_LOCATOR)