Fix fernet token test/rotate to use UTC only
The test/code was using localtime; this changes it to UTC so that DST changes don't affect rotations. Change-Id: I1c8247c08103833a842c422e19b5cd121515c054
This commit is contained in:
parent
3c34a8520a
commit
60fd4de2b3
|
@ -2069,7 +2069,8 @@ def fernet_keys_rotate_and_sync(log_func=log):
|
|||
if last_rotation + rotation_time > now:
|
||||
# Nothing to do as not reached rotation time
|
||||
log_func("No rotation until at least {}"
|
||||
.format(time.ctime(last_rotation + rotation_time)),
|
||||
.format(
|
||||
time.asctime(time.gmtime(last_rotation + rotation_time))),
|
||||
level=DEBUG)
|
||||
return
|
||||
# now rotate the keys and sync them
|
||||
|
|
|
@ -1259,7 +1259,8 @@ class TestKeystoneUtils(CharmTestCase):
|
|||
mock_os.stat.side_effect = None
|
||||
# now set up the times, so that it still shouldn't be called.
|
||||
self.time.time.return_value = 30
|
||||
self.time.ctime = time.ctime
|
||||
self.time.gmtime = time.gmtime
|
||||
self.time.asctime = time.asctime
|
||||
_stat = MagicMock()
|
||||
_stat.st_mtime = 10
|
||||
mock_os.stat.return_value = _stat
|
||||
|
|
Loading…
Reference in New Issue