Add option fake_runtime to override runtime in britney.conf

This is useful to run tests with the data files from a specific point in time,
without changes due to ageing when the test runs later.

Signed-off-by: Ivo De Decker <ivodd@debian.org>
ubuntu/rebased
Ivo De Decker 6 years ago
parent 179faeb23b
commit 348274947e

@ -182,7 +182,12 @@ class AgePolicy(BasePolicy):
self._min_days_default = None # initialised later self._min_days_default = None # initialised later
# britney's "day" begins at 7pm (we want aging to occur in the 22:00Z run and we run Britney 2-4 times a day) # britney's "day" begins at 7pm (we want aging to occur in the 22:00Z run and we run Britney 2-4 times a day)
# NB: _date_now is used in tests # NB: _date_now is used in tests
self._date_now = int(((time.time() / (60*60)) - 19) / 24) time_now = time.time()
if hasattr(self.options, 'fake_runtime'):
time_now = int(self.options.fake_runtime)
self.logger.info("overriding runtime with fake_runtime %d"%time_now)
self._date_now = int(((time_now / (60*60)) - 19) / 24)
self._dates = {} self._dates = {}
self._urgencies = {} self._urgencies = {}
self._default_urgency = self.options.default_urgency self._default_urgency = self.options.default_urgency

Loading…
Cancel
Save