예제 #1
0
    def test_task_list(self):
        INIT = consts.TaskStatus.INIT
        task_init = sorted(self._create_task()["uuid"] for i in moves.range(3))
        FINISHED = consts.TaskStatus.FINISHED
        task_finished = sorted(
            self._create_task({
                "status": FINISHED,
                "deployment_uuid": self.deploy["uuid"]
            })["uuid"] for i in moves.range(3))

        task_all = sorted(task_init + task_finished)

        def get_uuids(status=None, deployment=None):
            tasks = db.task_list(status=status, deployment=deployment)
            return sorted(task["uuid"] for task in tasks)

        self.assertEqual(task_all, get_uuids(None))

        self.assertEqual(task_init, get_uuids(status=INIT))
        self.assertEqual(task_finished, get_uuids(status=FINISHED))
        self.assertRaises(exceptions.DeploymentNotFound,
                          get_uuids,
                          deployment="non-existing-deployment")

        deleted_task_uuid = task_finished.pop()
        db.task_delete(deleted_task_uuid)
        self.assertEqual(task_init, get_uuids(INIT))
        self.assertEqual(sorted(task_finished), get_uuids(FINISHED))
예제 #2
0
    def cleanup_previous_tasks(self, deployment_id):
        tasks = self.get_tasks_uuid_from_db(deployment_id)

        for task_id in tasks:
            db.task_delete(task_id)

        logging.info("Delete all tasks of deployment[ID: %s]" % deployment_id)
예제 #3
0
    def test_task_list(self):
        fake_deploy_uuid = str(uuid.uuid4())
        INIT = consts.TaskStatus.INIT
        task_init = sorted(self._create_task()['uuid'] for i in xrange(3))
        FINISHED = consts.TaskStatus.FINISHED
        task_finished = sorted(self._create_task(
            {'status': FINISHED,
             'deployment_uuid': fake_deploy_uuid})[
             'uuid']
                               for i in xrange(3))

        task_all = sorted(task_init + task_finished)

        def get_uuids(status=None, deployment=None):
            tasks = db.task_list(status=status, deployment=deployment)
            return sorted(task['uuid'] for task in tasks)

        self.assertEqual(task_all, get_uuids(None))

        self.assertEqual(task_init, get_uuids(status=INIT))
        self.assertEqual(task_finished, get_uuids(status=FINISHED))
        self.assertRaises(exceptions.DeploymentNotFound,
                          get_uuids, deployment=fake_deploy_uuid)

        deleted_task_uuid = task_finished.pop()
        db.task_delete(deleted_task_uuid)
        self.assertEqual(task_init, get_uuids(INIT))
        self.assertEqual(sorted(task_finished), get_uuids(FINISHED))
예제 #4
0
    def test_task_list(self):
        INIT = consts.TaskStatus.INIT
        task_init = sorted(self._create_task()["uuid"] for i in moves.range(3))
        FINISHED = consts.TaskStatus.FINISHED
        task_finished = sorted(self._create_task(
            {"status": FINISHED,
             "deployment_uuid": self.deploy["uuid"]})[
             "uuid"]
                               for i in moves.range(3))

        task_all = sorted(task_init + task_finished)

        def get_uuids(status=None, deployment=None):
            tasks = db.task_list(status=status, deployment=deployment)
            return sorted(task["uuid"] for task in tasks)

        self.assertEqual(task_all, get_uuids(None))

        self.assertEqual(task_init, get_uuids(status=INIT))
        self.assertEqual(task_finished, get_uuids(status=FINISHED))
        self.assertRaises(exceptions.DeploymentNotFound,
                          get_uuids, deployment="non-existing-deployment")

        deleted_task_uuid = task_finished.pop()
        db.task_delete(deleted_task_uuid)
        self.assertEqual(task_init, get_uuids(INIT))
        self.assertEqual(sorted(task_finished), get_uuids(FINISHED))
예제 #5
0
    def cleanup_previous_tasks(self, deployment_id):
        tasks = self.get_tasks_uuid_from_db(deployment_id)

        for task_id in tasks:
            db.task_delete(task_id)

        logging.info("Delete all tasks of deployment[ID: %s]" % deployment_id)
예제 #6
0
 def test_task_delete_with_results(self):
     task_id = self._create_task()['uuid']
     db.task_result_create(task_id, {task_id: task_id}, {task_id: task_id})
     res = db.task_result_get_all_by_uuid(task_id)
     self.assertEqual(len(res), 1)
     db.task_delete(task_id)
     res = db.task_result_get_all_by_uuid(task_id)
     self.assertEqual(len(res), 0)
예제 #7
0
 def test_task_delete_by_uuid_and_status(self):
     values = {
         'status': consts.TaskStatus.FINISHED,
     }
     task1 = self._create_task(values=values)['uuid']
     task2 = self._create_task(values=values)['uuid']
     db.task_delete(task1, status=consts.TaskStatus.FINISHED)
     self.assertRaises(exceptions.TaskNotFound, self._get_task, task1)
     self.assertEqual(task2, self._get_task(task2)['uuid'])
예제 #8
0
 def test_task_delete_by_uuid_and_status(self):
     values = {
         'status': consts.TaskStatus.FINISHED,
     }
     task1 = self._create_task(values=values)['uuid']
     task2 = self._create_task(values=values)['uuid']
     db.task_delete(task1, status=consts.TaskStatus.FINISHED)
     self.assertRaises(exceptions.TaskNotFound, self._get_task, task1)
     self.assertEqual(task2, self._get_task(task2)['uuid'])
예제 #9
0
 def test_task_delete_with_results(self):
     task_id = self._create_task()['uuid']
     db.task_result_create(task_id,
                           {task_id: task_id},
                           {task_id: task_id})
     res = db.task_result_get_all_by_uuid(task_id)
     self.assertEqual(len(res), 1)
     db.task_delete(task_id)
     res = db.task_result_get_all_by_uuid(task_id)
     self.assertEqual(len(res), 0)
예제 #10
0
    def test_task_list(self):
        INIT = consts.TaskStatus.INIT
        task_init = sorted(self._create_task()['uuid'] for i in xrange(3))
        FINISHED = consts.TaskStatus.FINISHED
        task_finished = sorted(self._create_task({'status': FINISHED})['uuid']
                               for i in xrange(3))

        task_all = sorted(task_init + task_finished)

        def get_uuids(status):
            tasks = db.task_list(status=status)
            return sorted(task['uuid'] for task in tasks)

        self.assertEqual(task_all, get_uuids(None))

        self.assertEqual(task_init, get_uuids(INIT))
        self.assertEqual(task_finished, get_uuids(FINISHED))

        deleted_task_uuid = task_finished.pop()
        db.task_delete(deleted_task_uuid)
        self.assertEqual(task_init, get_uuids(INIT))
        self.assertEqual(sorted(task_finished), get_uuids(FINISHED))
예제 #11
0
    def test_task_list(self):
        INIT = consts.TaskStatus.INIT
        task_init = sorted(self._create_task()["uuid"] for i in xrange(3))
        FINISHED = consts.TaskStatus.FINISHED
        task_finished = sorted(self._create_task({"status": FINISHED})["uuid"] for i in xrange(3))

        task_all = sorted(task_init + task_finished)

        def get_uuids(status, active=True):
            tasks = db.task_list(status=status, active=active)
            return sorted(task["uuid"] for task in tasks)

        self.assertEqual(task_all, get_uuids(None))

        self.assertEqual(task_init, get_uuids(INIT))
        self.assertEqual(task_finished, get_uuids(FINISHED))

        deleted_task_uuid = task_finished.pop()
        db.task_delete(deleted_task_uuid)
        self.assertEqual(sorted(task_finished), get_uuids(FINISHED))
        self.assertEqual(task_all, get_uuids(None, active=None))
        self.assertEqual([deleted_task_uuid], get_uuids(None, active=False))
예제 #12
0
    def test_task_list(self):
        INIT = consts.TaskStatus.INIT
        task_init = sorted(self._create_task()['uuid'] for i in xrange(3))
        FINISHED = consts.TaskStatus.FINISHED
        task_finished = sorted(
            self._create_task({'status': FINISHED})['uuid'] for i in xrange(3))

        task_all = sorted(task_init + task_finished)

        def get_uuids(status):
            tasks = db.task_list(status=status)
            return sorted(task['uuid'] for task in tasks)

        self.assertEqual(task_all, get_uuids(None))

        self.assertEqual(task_init, get_uuids(INIT))
        self.assertEqual(task_finished, get_uuids(FINISHED))

        deleted_task_uuid = task_finished.pop()
        db.task_delete(deleted_task_uuid)
        self.assertEqual(task_init, get_uuids(INIT))
        self.assertEqual(sorted(task_finished), get_uuids(FINISHED))
예제 #13
0
 def test_task_delete(self):
     task1, task2 = self._create_task()['uuid'], self._create_task()['uuid']
     db.task_delete(task1)
     self.assertRaises(exceptions.TaskNotFound, self._get_task, task1)
     self.assertEqual(task2, self._get_task(task2)['uuid'])
예제 #14
0
파일: task.py 프로젝트: yongfengdu/rally
 def delete(self, status=None):
     db.task_delete(self.task["uuid"], status=status)
예제 #15
0
파일: task.py 프로젝트: hughsaunders/rally
 def delete(self, status=None):
     db.task_delete(self.task['uuid'], status=status)
예제 #16
0
파일: task.py 프로젝트: hughsaunders/rally
 def delete_by_uuid(uuid, status=None):
     db.task_delete(uuid, status=status)
예제 #17
0
파일: task.py 프로젝트: Vaidyanath/rally
 def delete(self, status=None):
     db.task_delete(self.task["uuid"], status=status)
예제 #18
0
 def delete(self, status=None):
     db.task_delete(self.task['uuid'], status=status)
예제 #19
0
 def test_task_delete(self):
     task1, task2 = self._create_task()['uuid'], self._create_task()['uuid']
     db.task_delete(task1)
     self.assertRaises(exceptions.TaskNotFound, self._get_task, task1)
     self.assertEqual(task2, self._get_task(task2)['uuid'])
예제 #20
0
파일: task.py 프로젝트: yongfengdu/rally
 def delete_by_uuid(uuid, status=None):
     db.task_delete(uuid, status=status)