From 6253626829fd94d2cc18332309048c8ef21c671d Mon Sep 17 00:00:00 2001 From: Sphoorti Joglekar Date: Sat, 20 Sep 2014 01:57:39 +0530 Subject: [PATCH] Replace misleading max_message_size option name The max_message_size option name is misleading. The option determines max size of message post body. Replacing the option name to max_messages_post_size. Change-Id: Ie01cee026e7ebf530cdb2709e2c17d030ad95480 Closes-Bug: #1357397 --- .../zaqar-config-ref/autogen/zaqar.flagmappings | 2 +- .../zaqar-config-ref/common/tables/zaqar-transport.xml | 2 +- etc/zaqar.conf.sample | 2 +- tests/etc/functional-zaqar.conf | 2 +- tests/etc/wsgi_sqlalchemy_validation.conf | 2 +- tests/functional/wsgi/v1/test_messages.py | 4 ++-- tests/functional/wsgi/v1_1/test_messages.py | 4 ++-- zaqar/queues/transport/validation.py | 9 +++++---- zaqar/tests/queues/transport/wsgi/v1/test_messages.py | 2 +- zaqar/tests/queues/transport/wsgi/v1/test_validation.py | 6 +++--- zaqar/tests/queues/transport/wsgi/v1_1/test_messages.py | 2 +- .../tests/queues/transport/wsgi/v1_1/test_validation.py | 6 +++--- 12 files changed, 22 insertions(+), 21 deletions(-) diff --git a/doc/user-guide/zaqar-config-ref/autogen/zaqar.flagmappings b/doc/user-guide/zaqar-config-ref/autogen/zaqar.flagmappings index 5c9da80cd..6e23a1462 100644 --- a/doc/user-guide/zaqar-config-ref/autogen/zaqar.flagmappings +++ b/doc/user-guide/zaqar-config-ref/autogen/zaqar.flagmappings @@ -78,7 +78,7 @@ transport/default_claim_ttl transport transport/default_message_ttl transport transport/max_claim_grace transport transport/max_claim_ttl transport -transport/max_message_size transport +transport/max_messages_post_size transport transport/max_message_ttl transport transport/max_messages_per_claim_or_pop transport transport/max_messages_per_page transport diff --git a/doc/user-guide/zaqar-config-ref/common/tables/zaqar-transport.xml b/doc/user-guide/zaqar-config-ref/common/tables/zaqar-transport.xml index 27a766a98..308d7251b 100644 --- a/doc/user-guide/zaqar-config-ref/common/tables/zaqar-transport.xml +++ b/doc/user-guide/zaqar-config-ref/common/tables/zaqar-transport.xml @@ -38,7 +38,7 @@ (IntOpt) No help text available for this option. - max_message_size = 262144 + max_messages_post_size = 262144 (IntOpt) No help text available for this option. diff --git a/etc/zaqar.conf.sample b/etc/zaqar.conf.sample index e19745d23..7132b5b13 100644 --- a/etc/zaqar.conf.sample +++ b/etc/zaqar.conf.sample @@ -491,7 +491,7 @@ # (integer value) # Deprecated group/name - [limits:transport]/message_size_uplimit -#max_message_size=262144 +#max_messages_post_size=262144 # (integer value) # Deprecated group/name - [limits:transport]/message_ttl_max diff --git a/tests/etc/functional-zaqar.conf b/tests/etc/functional-zaqar.conf index 613c37105..8eb4ecd55 100644 --- a/tests/etc/functional-zaqar.conf +++ b/tests/etc/functional-zaqar.conf @@ -51,4 +51,4 @@ port = 8888 # Maximum size in bytes allowed for queue metadata and bulk/single # message post bodies (including whitespace and envelope fields). ;max_queue_metadata = 65536 -;max_message_size = 262144 +;max_messages_post_size = 262144 diff --git a/tests/etc/wsgi_sqlalchemy_validation.conf b/tests/etc/wsgi_sqlalchemy_validation.conf index db04d4b66..1890cf7cd 100644 --- a/tests/etc/wsgi_sqlalchemy_validation.conf +++ b/tests/etc/wsgi_sqlalchemy_validation.conf @@ -7,4 +7,4 @@ storage = sqlalchemy metadata_size_uplimit = 64 [transport] -max_message_size = 256 +max_messages_post_size = 256 diff --git a/tests/functional/wsgi/v1/test_messages.py b/tests/functional/wsgi/v1/test_messages.py index 4c4c89ebd..6bff7e0fd 100644 --- a/tests/functional/wsgi/v1/test_messages.py +++ b/tests/functional/wsgi/v1/test_messages.py @@ -54,7 +54,7 @@ class TestMessages(base.V1FunctionalTestBase): doc = '[{{"body": "{0}", "ttl": 300}}, {{"body": "{1}", "ttl": 120}}]' overhead = len(doc.format('', '')) - half_size = (self.limits.max_message_size - overhead) // 2 + half_size = (self.limits.max_messages_post_size - overhead) // 2 doc = doc.format(helpers.generate_random_string(half_size), helpers.generate_random_string(half_size + offset)) @@ -276,7 +276,7 @@ class TestMessages(base.V1FunctionalTestBase): doc = '[{{"body": "{0}", "ttl": 300}}, {{"body": "{1}", "ttl": 120}}]' overhead = len(doc.format('', '')) - half_size = (self.limits.max_message_size - overhead) // 2 + half_size = (self.limits.max_messages_post_size - overhead) // 2 doc = doc.format(helpers.generate_random_string(half_size), helpers.generate_random_string(half_size + 1)) diff --git a/tests/functional/wsgi/v1_1/test_messages.py b/tests/functional/wsgi/v1_1/test_messages.py index 289c6fe06..309189fa5 100644 --- a/tests/functional/wsgi/v1_1/test_messages.py +++ b/tests/functional/wsgi/v1_1/test_messages.py @@ -56,7 +56,7 @@ class TestMessages(base.V1_1FunctionalTestBase): '{{"body": "{1}", "ttl": 120}}]}}') overhead = len(doc.format('', '')) - half_size = (self.limits.max_message_size - overhead) // 2 + half_size = (self.limits.max_messages_post_size - overhead) // 2 doc = doc.format(helpers.generate_random_string(half_size), helpers.generate_random_string(half_size + offset)) @@ -408,7 +408,7 @@ class TestMessages(base.V1_1FunctionalTestBase): doc = '[{{"body": "{0}", "ttl": 300}}, {{"body": "{1}", "ttl": 120}}]' overhead = len(doc.format('', '')) - half_size = (self.limits.max_message_size - overhead) // 2 + half_size = (self.limits.max_messages_post_size - overhead) // 2 doc = doc.format(helpers.generate_random_string(half_size), helpers.generate_random_string(half_size + 1)) diff --git a/zaqar/queues/transport/validation.py b/zaqar/queues/transport/validation.py index 8e1b23991..09cdbcb7e 100644 --- a/zaqar/queues/transport/validation.py +++ b/zaqar/queues/transport/validation.py @@ -39,9 +39,10 @@ _TRANSPORT_LIMITS_OPTIONS = ( cfg.IntOpt('max_queue_metadata', default=64 * 1024, deprecated_name='metadata_size_uplimit', deprecated_group='limits:transport'), - cfg.IntOpt('max_message_size', default=256 * 1024, + cfg.IntOpt('max_messages_post_size', default=256 * 1024, deprecated_name='message_size_uplimit', - deprecated_group='limits:transport'), + deprecated_group='limits:transport', + deprecated_opts=[cfg.DeprecatedOpt('max_message_size')]), cfg.IntOpt('max_message_ttl', default=1209600, deprecated_name='message_ttl_max', @@ -153,10 +154,10 @@ class Validator(object): """ if content_length is None: return - if content_length > self._limits_conf.max_message_size: + if content_length > self._limits_conf.max_messages_post_size: raise ValidationFailed( _(u'Message collection size is too large. Max size {0}'), - self._limits_conf.max_message_size) + self._limits_conf.max_messages_post_size) def message_content(self, message): """Restrictions on each message.""" diff --git a/zaqar/tests/queues/transport/wsgi/v1/test_messages.py b/zaqar/tests/queues/transport/wsgi/v1/test_messages.py index 094bdfcbb..a4559b6c0 100644 --- a/zaqar/tests/queues/transport/wsgi/v1/test_messages.py +++ b/zaqar/tests/queues/transport/wsgi/v1/test_messages.py @@ -254,7 +254,7 @@ class MessagesBaseTest(base.V1Base): doc = jsonutils.dumps([{'body': "some body", 'ttl': 100}] * 20, indent=4) - max_len = self.transport_cfg.max_message_size + max_len = self.transport_cfg.max_messages_post_size long_doc = doc + (' ' * (max_len - len(doc) + 1)) self.simulate_post(self.queue_path + '/messages', diff --git a/zaqar/tests/queues/transport/wsgi/v1/test_validation.py b/zaqar/tests/queues/transport/wsgi/v1/test_validation.py index 80f02575b..daa833e25 100644 --- a/zaqar/tests/queues/transport/wsgi/v1/test_validation.py +++ b/zaqar/tests/queues/transport/wsgi/v1/test_validation.py @@ -75,13 +75,13 @@ class TestValidation(base.V1Base): self.assertEqual(self.srmock.status, falcon.HTTP_201) # Both messages' size are too long - max_message_size = 256 + max_messages_post_size = 256 obj = {'a': 0, 'b': ''} envelope_length = len(json.dumps(obj, separators=(',', ':'))) - obj['b'] = 'x' * (max_message_size - envelope_length + 1) + obj['b'] = 'x' * (max_messages_post_size - envelope_length + 1) - for long_body in ('a' * (max_message_size - 2 + 1), obj): + for long_body in ('a' * (max_messages_post_size - 2 + 1), obj): doc = json.dumps([{'body': long_body, 'ttl': 100}]) self.simulate_post(self.queue_path + '/messages', self.project_id, diff --git a/zaqar/tests/queues/transport/wsgi/v1_1/test_messages.py b/zaqar/tests/queues/transport/wsgi/v1_1/test_messages.py index 338c0c137..3908a9c5a 100644 --- a/zaqar/tests/queues/transport/wsgi/v1_1/test_messages.py +++ b/zaqar/tests/queues/transport/wsgi/v1_1/test_messages.py @@ -278,7 +278,7 @@ class MessagesBaseTest(base.V1_1Base): doc = {'messages': [{'body': "some body", 'ttl': 100}] * 20} body = jsonutils.dumps(doc, indent=4) - max_len = self.transport_cfg.max_message_size + max_len = self.transport_cfg.max_messages_post_size long_body = body + (' ' * (max_len - len(body) + 1)) self.simulate_post(self.queue_path + '/messages', diff --git a/zaqar/tests/queues/transport/wsgi/v1_1/test_validation.py b/zaqar/tests/queues/transport/wsgi/v1_1/test_validation.py index 418e9f9ab..22503f751 100644 --- a/zaqar/tests/queues/transport/wsgi/v1_1/test_validation.py +++ b/zaqar/tests/queues/transport/wsgi/v1_1/test_validation.py @@ -75,13 +75,13 @@ class TestValidation(base.V1_1Base): self.assertEqual(self.srmock.status, falcon.HTTP_201) # Both messages' size are too long - max_message_size = 256 + max_messages_post_size = 256 obj = {'a': 0, 'b': ''} envelope_length = len(json.dumps(obj, separators=(',', ':'))) - obj['b'] = 'x' * (max_message_size - envelope_length + 1) + obj['b'] = 'x' * (max_messages_post_size - envelope_length + 1) - for long_body in ('a' * (max_message_size - 2 + 1), obj): + for long_body in ('a' * (max_messages_post_size - 2 + 1), obj): doc = json.dumps([{'body': long_body, 'ttl': 100}]) self.simulate_post(self.queue_path + '/messages', self.project_id,