Beispiel #1
0
    def test_amqp_instances(self):
        self.day = 1
        self.requests = []
        service = amqp.Service()
        
        self.stubs.Set(service.billing_heart, "event", self.fake_event)
        self.stubs.Set(service, "get_event_datetime", self.fake_get_event_datetime)
        self.stubs.Set(instances, "get_instance_flavor", self.fake_get_instance_flavor)

        json_in = self.json_load_from_file("os_amqp.instances.in.json") 
        run_instance_body = json_in["run"]
        any_instance_body = json_in["any"]
        self.flavor = run_instance_body["args"]["request_spec"]["instance_type"]

        service.process_event(run_instance_body, None)
        for method in ("stop_instance", "start_instance",
                       "pause_instance", "unpause_instance",
                       "suspend_instance", "resume_instance",
                       "terminate_instance"):
            any_instance_body["method"] = method
            service.process_event(any_instance_body, None)
        service.process_event(run_instance_body, None)
        for method in ("stop_instance", "start_instance"):
            any_instance_body["method"] = method
            service.process_event(any_instance_body, None)

        self.stubs.UnsetAll()
        self.json_check_with_file(self.requests, 
            "os_amqp.instances.out.json")
Beispiel #2
0
    def test_amqp_local_volumes(self):
        self.day = 1
        self.requests = []
        service = amqp.Service()
        
        self.stubs.Set(service.billing_heart, "event", self.fake_event)
        self.stubs.Set(service, "get_event_datetime", self.fake_get_event_datetime)
        self.stubs.Set(instances, "get_instance_flavor", self.fake_get_instance_flavor)

        json_in = self.json_load_from_file("os_amqp.local_volumes.in.json")
        
        for event in json_in:
            service.process_event(event, None)

        self.stubs.UnsetAll()
        self.json_check_with_file(self.requests,
            "os_amqp.local_volumes.out.json")
Beispiel #3
0
def main():
    global_conf.logging()
    global_conf.load_nova_conf()
    service = amqp.Service()
    service.start()
    service.wait()
Beispiel #4
0
def main():
    global_conf.logging()
    LOG.info("starting os_amqp")
    service = amqp.Service()
    service.start()
    service.wait()