InternalClient: error if allow_modify_pipeline is True
allow_modify_pipeline is no longer supported, but if a caller is still setting it to True then raise ValueError, because the InternalClient instance will no longer behave in the way the caller previously expected. Change-Id: I24015b8becc7289a7d72f9a5863d201e27bcc955
This commit is contained in:
parent
e5105ffa09
commit
bbf9687b71
@ -160,6 +160,8 @@ class InternalClient(object):
|
|||||||
raise ValueError('request_tries must be positive')
|
raise ValueError('request_tries must be positive')
|
||||||
# Internal clients don't use the gatekeeper and the pipeline remains
|
# Internal clients don't use the gatekeeper and the pipeline remains
|
||||||
# static so we never allow anything to modify the proxy pipeline.
|
# static so we never allow anything to modify the proxy pipeline.
|
||||||
|
if kwargs.get('allow_modify_pipeline'):
|
||||||
|
raise ValueError("'allow_modify_pipeline' is no longer supported")
|
||||||
self.app = app or loadapp(conf_path, global_conf=global_conf,
|
self.app = app or loadapp(conf_path, global_conf=global_conf,
|
||||||
allow_modify_pipeline=False,)
|
allow_modify_pipeline=False,)
|
||||||
self.check_gatekeeper_not_loaded(self.app)
|
self.check_gatekeeper_not_loaded(self.app)
|
||||||
|
@ -437,6 +437,27 @@ class TestInternalClient(unittest.TestCase):
|
|||||||
self.assertEqual(request_tries, client.request_tries)
|
self.assertEqual(request_tries, client.request_tries)
|
||||||
self.assertTrue(client.use_replication_network)
|
self.assertTrue(client.use_replication_network)
|
||||||
|
|
||||||
|
def test_init_allow_modify_pipeline(self):
|
||||||
|
conf_path = 'some_path'
|
||||||
|
app = FakeSwift()
|
||||||
|
user_agent = 'some_user_agent'
|
||||||
|
|
||||||
|
with mock.patch.object(
|
||||||
|
internal_client, 'loadapp', return_value=app) as mock_loadapp,\
|
||||||
|
self.assertRaises(ValueError) as cm:
|
||||||
|
internal_client.InternalClient(
|
||||||
|
conf_path, user_agent, 1, allow_modify_pipeline=True)
|
||||||
|
mock_loadapp.assert_not_called()
|
||||||
|
self.assertIn("'allow_modify_pipeline' is no longer supported",
|
||||||
|
str(cm.exception))
|
||||||
|
|
||||||
|
with mock.patch.object(
|
||||||
|
internal_client, 'loadapp', return_value=app) as mock_loadapp:
|
||||||
|
internal_client.InternalClient(
|
||||||
|
conf_path, user_agent, 1, allow_modify_pipeline=False)
|
||||||
|
mock_loadapp.assert_called_once_with(
|
||||||
|
conf_path, allow_modify_pipeline=False, global_conf=None)
|
||||||
|
|
||||||
def test_gatekeeper_not_loaded(self):
|
def test_gatekeeper_not_loaded(self):
|
||||||
app = FakeSwift()
|
app = FakeSwift()
|
||||||
pipeline = [app]
|
pipeline = [app]
|
||||||
|
Loading…
Reference in New Issue
Block a user