Add tests and comments re constraints in /info
Add test to check that only the expected keys are reported by proxy in /info, and add comments to raise awareness that default constraints will be automatically published by proxy in response to /info requests. Change-Id: Ia5f6339b06cdc2e1dc960d1f75562a2505530202
This commit is contained in:
3 changed files with 10 additions and 1 deletions
@@ -10,7 +10,8 @@ swift_hash_path_prefix = changeme
# The swift-constraints section sets the basic constraints on data
# saved in the swift cluster.
# saved in the swift cluster. These constraints are automatically
# published by the proxy server in responses to /info requests.
[swift-constraints]
@@ -34,6 +34,10 @@ ACCOUNT_LISTING_LIMIT = 10000
MAX_ACCOUNT_NAME_LENGTH = 256
MAX_CONTAINER_NAME_LENGTH = 256
# If adding an entry to DEFAULT_CONSTRAINTS, note that
# these constraints are automatically published by the
# proxy server in responses to /info requests, with values
# updated by reload_constraints()
DEFAULT_CONSTRAINTS = {
'max_file_size': MAX_FILE_SIZE,
'max_meta_name_length': MAX_META_NAME_LENGTH,
@@ -5915,6 +5915,10 @@ class TestSwiftInfo(unittest.TestCase):
constraints.MAX_CONTAINER_NAME_LENGTH)
self.assertEqual(si['max_object_name_length'],
constraints.MAX_OBJECT_NAME_LENGTH)
self.assertTrue('strict_cors_mode' in si)
# this next test is deliberately brittle in order to alert if
# other items are added to swift info
self.assertEqual(len(si), 13)
if __name__ == '__main__':
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.