Merge "Using oslo_config's min attribute"

This commit is contained in:
Jenkins 2016-10-02 21:37:02 +00:00 committed by Gerrit Code Review
commit d9a02f75ee
3 changed files with 1 additions and 5 deletions

View File

@ -75,7 +75,7 @@ _COMMON_OPTIONS = (
group=_deprecated_group), ],
help='Database name.'),
cfg.IntOpt('max_attempts', default=1000,
cfg.IntOpt('max_attempts', min=0, default=1000,
deprecated_opts=[cfg.DeprecatedOpt(
'max_attempts',
group=_deprecated_group), ],

View File

@ -87,8 +87,6 @@ def calculate_backoff(attempt, max_attempts, max_sleep, max_jitter=0):
the interval [0, max_sleep), determined linearly according to
the ratio attempt / max_attempts, with optional jitter.
"""
if max_attempts < 0:
raise ValueError(u'max_attempts must be >= 0')
if max_sleep < 0:
raise ValueError(u'max_sleep must be >= 0')

View File

@ -110,8 +110,6 @@ class MongodbUtilsTest(MongodbSetupMixin, testing.TestBase):
self.assertRaises(ValueError, utils.calculate_backoff, 0, 10, -2, 0)
self.assertRaises(ValueError, utils.calculate_backoff, 0, 10, 2, -1)
self.assertRaises(ValueError, utils.calculate_backoff, -2, -10, 2, 0)
self.assertRaises(ValueError, utils.calculate_backoff, 2, -10, 2, 0)
self.assertRaises(ValueError, utils.calculate_backoff, -2, 10, 2, 0)
self.assertRaises(ValueError, utils.calculate_backoff, -1, 10, 2, 0)
self.assertRaises(ValueError, utils.calculate_backoff, 10, 10, 2, 0)