Beispiel #1
0
    def test_get_zone_capabilities_expired_host(self):
        zm = zone_manager.ZoneManager()
        expiry_time = (FLAGS.periodic_interval * 3) + 1

        # Service capabilities stale
        zm.update_service_capabilities("svc1", "host1", dict(a=1, b=2))
        time_future = utils.utcnow() + datetime.timedelta(seconds=expiry_time)
        utils.set_time_override(time_future)
        caps = zm.get_zone_capabilities(None)
        self.assertEquals(caps, {})
        utils.clear_time_override()
Beispiel #2
0
    def test_get_zone_capabilities_expired_host(self):
        zm = zone_manager.ZoneManager()
        expiry_time = (FLAGS.periodic_interval * 3) + 1

        # Service capabilities stale
        zm.update_service_capabilities("svc1", "host1", dict(a=1, b=2))
        time_future = utils.utcnow() + datetime.timedelta(seconds=expiry_time)
        utils.set_time_override(time_future)
        caps = zm.get_zone_capabilities(None)
        self.assertEquals(caps, {})
        utils.clear_time_override()
Beispiel #3
0
    def test_host_service_caps_stale_all_stale_services(self):
        zm = zone_manager.ZoneManager()
        expiry_time = (FLAGS.periodic_interval * 3) + 1

        # Both services became stale
        zm.update_service_capabilities("svc1", "host1", dict(a=1, b=2))
        zm.update_service_capabilities("svc2", "host1", dict(a=3, b=4))
        time_future = utils.utcnow() + datetime.timedelta(seconds=expiry_time)
        utils.set_time_override(time_future)
        self.assertTrue(zm.host_service_caps_stale("host1", "svc1"))
        self.assertTrue(zm.host_service_caps_stale("host1", "svc2"))
        utils.clear_time_override()
Beispiel #4
0
    def test_host_service_caps_stale_all_stale_services(self):
        zm = zone_manager.ZoneManager()
        expiry_time = (FLAGS.periodic_interval * 3) + 1

        # Both services became stale
        zm.update_service_capabilities("svc1", "host1", dict(a=1, b=2))
        zm.update_service_capabilities("svc2", "host1", dict(a=3, b=4))
        time_future = utils.utcnow() + datetime.timedelta(seconds=expiry_time)
        utils.set_time_override(time_future)
        self.assertTrue(zm.host_service_caps_stale("host1", "svc1"))
        self.assertTrue(zm.host_service_caps_stale("host1", "svc2"))
        utils.clear_time_override()
Beispiel #5
0
 def tearDown(self):
     utils.clear_time_override()
     super(AuditPeriodTest, self).tearDown()
Beispiel #6
0
 def tearDown(self):  # pylint: disable=C0103
     utils.clear_time_override()
     super(LockoutTestCase, self).tearDown()
Beispiel #7
0
 def tearDown(self):  # pylint: disable=C0103
     utils.clear_time_override()
     super(LockoutTestCase, self).tearDown()