예제 #1
0
파일: test_utils.py 프로젝트: scpham/nova
 def setUp(self):
     super(AuditPeriodTest, self).setUp()
     #a fairly random time to test with
     self.test_time = datetime.datetime(second=23,
                                        minute=12,
                                        hour=8,
                                        day=5,
                                        month=3,
                                        year=2012)
     utils.set_time_override(override_time=self.test_time)
예제 #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()
예제 #3
0
파일: test_zones.py 프로젝트: Razique/nova
    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()
예제 #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()
예제 #5
0
파일: test_zones.py 프로젝트: Razique/nova
    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()
예제 #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, {})
예제 #7
0
파일: test_zones.py 프로젝트: Razique/nova
    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, {})
예제 #8
0
 def setUp(self):  # pylint: disable=C0103
     super(LockoutTestCase, self).setUp()
     utils.set_time_override()
     self.lockout = ec2.Lockout(conditional_forbid)
예제 #9
0
 def setUp(self):  # pylint: disable=C0103
     super(LockoutTestCase, self).setUp()
     utils.set_time_override()
     self.lockout = ec2.Lockout(conditional_forbid)