def test_filter_instance_age(self):
now = datetime.now(tz=tz.tzutc())
three_months = now - timedelta(90)
two_months = now - timedelta(60)
one_month = now - timedelta(30)
def i(d):
return instance(LaunchTime=d)
for ii, v in [
(i(now), False),
(i(three_months), True),
(i(two_months), True),
(i(one_month), False)
]:
self.assertFilter({'type': 'instance-uptime', 'op': 'gte', 'days': 60}, ii, v)
评论列表
文章目录