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)
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")
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")
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)