示例#1
0
    def test_queue_timeout(self):

        taskrunner = TaskRunner("guest", "guest", "localhost", "/", "ots",
                                5672, "test_taskrunner", 1, 1, 1, 1)

        _init_queue(self.channel, "test_taskrunner",
                    taskrunner._services_exchange, "test_taskrunner")

        taskrunner.add_task("dummycommand")
        self.assertRaises(OtsQueueTimeoutError, taskrunner.run)
示例#2
0
 def setUp(self):
     self.taskrunner = TaskRunner("guest", "guest", "localhost", "/", "ots",
                                  5672, "test_taskrunner", 1, 60, 1, 1)
     self.connection = amqp.Connection(host="localhost",
                                       userid="guest",
                                       password="******",
                                       virtual_host="/",
                                       insist=False)
     self.channel = self.connection.channel()
     _init_queue(self.channel, "test_taskrunner",
                 self.taskrunner._services_exchange, "test_taskrunner")
示例#3
0
 def setUp(self):
     self.taskrunner = TaskRunner("guest", "guest", "localhost",
                                  "/", "ots", 5672, "test_taskrunner", 
                                  1, 60, 1, 1)
     self.connection = amqp.Connection(host = "localhost", 
                                       userid = "guest",
                                       password = "******",
                                       virtual_host = "/", 
                                       insist = False)
     self.channel = self.connection.channel()
     _init_queue(self.channel, 
                 "test_taskrunner", 
                 self.taskrunner._services_exchange,
                 "test_taskrunner")
示例#4
0
    def test_queue_timeout(self):

        taskrunner = TaskRunner("guest", "guest", "localhost",
                                "/", "ots", 5672, "test_taskrunner", 
                                1, 1, 1, 1)

        _init_queue(self.channel, 
                    "test_taskrunner", 
                    taskrunner._services_exchange,
                    "test_taskrunner")


        taskrunner.add_task("dummycommand")
        self.assertRaises(OtsQueueTimeoutError, taskrunner.run)
示例#5
0
    def test_server_side_global_timeout(self):

        # taskrunner with long enough queue timeout to get message processed
        # and very short global timeout to get hit after task started
        taskrunner = TaskRunner("guest", "guest", "localhost", "/", "ots",
                                5672, "test_taskrunner", 1, 1, 1, 1)

        _init_queue(self.channel, "test_taskrunner",
                    taskrunner._services_exchange, "test_taskrunner")

        # Create a task
        task_1 = Task(["1", "2"], 10)

        # Create a "started" state change message

        taskrunner._tasks = [task_1]
        self._publish_message(task_1.task_id, taskrunner._testrun_queue)
        self.assertRaises(OtsExecutionTimeoutError, taskrunner.run)
示例#6
0
    def test_server_side_global_timeout(self):

        # taskrunner with long enough queue timeout to get message processed
        # and very short global timeout to get hit after task started
        taskrunner = TaskRunner("guest", "guest", "localhost",
                                "/", "ots", 5672, "test_taskrunner", 
                                1, 1, 1, 1)

        _init_queue(self.channel, 
                    "test_taskrunner", 
                    taskrunner._services_exchange,
                    "test_taskrunner")


        # Create a task
        task_1 = Task(["1", "2"], 10)
     
        # Create a "started" state change message

        taskrunner._tasks = [task_1] 
        self._publish_message(task_1.task_id, taskrunner._testrun_queue)
        self.assertRaises(OtsExecutionTimeoutError,
                          taskrunner.run)