create/renew timestamp is older than the cutoff date. This string will be a
date in the following format:
- 16-Jan-2009
- 02-Feb-2008
- 25-Dec-2007
+ 2009-01-16 (January 16th, 2009)
+ 2008-02-02
+ 2007-12-25
The actual cutoff time shall be midnight UTC at the beginning of the given
day. Lease timers should naturally be generous enough to not depend upon
s = remove_tags(html)
self.failUnlessIn("Expiration Enabled:"
" expired leases will be removed", s)
- date = time.strftime("%d-%b-%Y", time.gmtime(then))
+ date = time.strftime("%Y-%m-%d", time.gmtime(then))
self.failUnlessIn("Leases created or last renewed before %s"
" will be considered expired." % date, s)
self.failUnlessIn(" recovered: 2 shares, 2 buckets (1 mutable / 1 immutable), ", s)
self.failUnless("no unit (like day, month, or year) in '2kumquats'"
in str(e), str(e))
+ def test_parse_date(self):
+ p = time_format.parse_date
+ self.failUnlessEqual(p("2009-03-18"), 1237334400)
+
def test_limited_history(self):
basedir = "storage/LeaseCrawler/limited_history"
fileutil.make_dirs(basedir)
raise ValueError("no unit (like day, month, or year) in '%s'" % orig)
s = s.strip()
return int(s) * unit
+
+def parse_date(s):
+ # return seconds-since-epoch for the UTC midnight that starts the given
+ # day
+ return iso_utc_time_to_localseconds(s + "T00:00:00")
+
"will be considered expired."
% abbreviate_time(lc.override_lease_duration)]
else:
- assert lc.mode == "date-cutoff"
- date = time.strftime("%d-%b-%Y", time.gmtime(lc.date_cutoff))
+ assert lc.mode == "cutoff-date"
+ date = time.strftime("%Y-%m-%d", time.gmtime(lc.cutoff_date))
ctx.tag["Leases created or last renewed before %s "
"will be considered expired." % date]
if len(lc.mode) > 2: