Esempio n. 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()
Esempio n. 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()
Esempio n. 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()
Esempio n. 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()
Esempio n. 5
0
    def test_get_zone_capabilities_all_stale_host_services(self):
        zm = zone_manager.ZoneManager()
        expiry_time = (FLAGS.periodic_interval * 3) + 1

        # All the host services  become stale
        zm.update_service_capabilities("svc1", "host1", dict(a=1, b=2))
        zm.update_service_capabilities("svc1", "host2", dict(a=3, b=4))
        zm.update_service_capabilities("svc2", "host1", dict(a=5, b=6))
        zm.update_service_capabilities("svc2", "host2", dict(a=7, b=8))
        time_future = utils.utcnow() + datetime.timedelta(seconds=expiry_time)
        utils.set_time_override(time_future)
        caps = zm.get_zone_capabilities(None)
        self.assertEquals(caps, {})
Esempio n. 6
0
    def test_get_zone_capabilities_all_stale_host_services(self):
        zm = zone_manager.ZoneManager()
        expiry_time = (FLAGS.periodic_interval * 3) + 1

        # All the host services  become stale
        zm.update_service_capabilities("svc1", "host1", dict(a=1, b=2))
        zm.update_service_capabilities("svc1", "host2", dict(a=3, b=4))
        zm.update_service_capabilities("svc2", "host1", dict(a=5, b=6))
        zm.update_service_capabilities("svc2", "host2", dict(a=7, b=8))
        time_future = utils.utcnow() + datetime.timedelta(seconds=expiry_time)
        utils.set_time_override(time_future)
        caps = zm.get_zone_capabilities(None)
        self.assertEquals(caps, {})
 def setUp(self):  # pylint: disable=C0103
     super(LockoutTestCase, self).setUp()
     utils.set_time_override()
     self.lockout = ec2.Lockout(conditional_forbid)
Esempio n. 8
0
 def setUp(self):  # pylint: disable=C0103
     super(LockoutTestCase, self).setUp()
     utils.set_time_override()
     self.lockout = ec2.Lockout(conditional_forbid)