Allow floats for a couple more intervals

Somehow I missed these on the first go-round.

Change-Id: I8baef6ba35a2f59eac30695943a671d53228e75c
Related-Change: I91e9bc02d94fe7ea6e89307305705c383087845a
This commit is contained in:
Tim Burke 2021-06-04 12:51:56 -07:00
parent 5bc28a7feb
commit eacebbb167
3 changed files with 10 additions and 8 deletions

View File

@ -72,7 +72,7 @@ class ContainerSyncRealms(object):
% {'conf': self.conf_path, 'error': err})
else:
try:
self.mtime_check_interval = conf.getint(
self.mtime_check_interval = conf.getfloat(
'DEFAULT', 'mtime_check_interval')
self.next_mtime_check = \
now + self.mtime_check_interval

View File

@ -213,7 +213,7 @@ class Application(object):
self.trans_id_suffix = conf.get('trans_id_suffix', '')
self.post_quorum_timeout = float(conf.get('post_quorum_timeout', 0.5))
self.error_suppression_interval = \
int(conf.get('error_suppression_interval', 60))
float(conf.get('error_suppression_interval', 60))
self.error_suppression_limit = \
int(conf.get('error_suppression_limit', 10))
self.recheck_container_existence = \

View File

@ -20,7 +20,7 @@ import uuid
import six
from mock import patch
from mock import ANY, patch
from swift.common.container_sync_realms import ContainerSyncRealms
from test.debug_logger import debug_logger
from test.unit import temptree
@ -177,11 +177,13 @@ mtime_check_interval = invalid
logger = debug_logger()
fpath = os.path.join(tempdir, fname)
csr = ContainerSyncRealms(fpath, logger)
self.assertEqual(
logger.all_log_lines(),
{'error': [
"Error in '%s' with mtime_check_interval: invalid literal "
"for int() with base 10: 'invalid'" % fpath]})
logs = logger.all_log_lines()
self.assertEqual(logs, {'error': [ANY]})
line = logs['error'][0]
self.assertIn(
"Error in '%s' with mtime_check_interval: "
"could not convert string to float:" % fpath, line)
self.assertEqual(csr.mtime_check_interval, 300)
def test_get_sig(self):