コード例 #1
0
    def test_fail_task(self):
        t = Task.objects.create(
            worker=self._worker,
            arch=self._arch,
            channel=self._channel,
            owner=self._user,
            state=TASK_STATES['OPEN'],
        )

        req = _make_request(self._worker)
        worker.fail_task(req, t.id, '')

        t = Task.objects.get(id=t.id)
        self.assertEqual(t.state, TASK_STATES['FAILED'])
コード例 #2
0
    def test_fail_task(self):
        t = Task.objects.create(
            worker=self._worker,
            arch=self._arch,
            channel=self._channel,
            owner=self._user,
            state=TASK_STATES['OPEN'],
        )

        req = _make_request(self._worker)
        worker.fail_task(req, t.id, '')

        t = Task.objects.get(id=t.id)
        self.assertEqual(t.state, TASK_STATES['FAILED'])
コード例 #3
0
    def test_fail_task_fails_to_fail_another_worker_task(self):
        w = Worker.objects.create(
            worker_key='other-worker',
            name='other-worker',
        )

        t = Task.objects.create(
            worker=w,
            arch=self._arch,
            channel=self._channel,
            owner=self._user,
            state=TASK_STATES['OPEN'],
        )

        req = _make_request(self._worker)

        with self.assertRaises(Task.DoesNotExist):
            worker.fail_task(req, t.id, '')

        t = Task.objects.get(id=t.id)
        self.assertEqual(t.state, TASK_STATES['OPEN'])
コード例 #4
0
    def test_fail_task_fails_to_fail_another_worker_task(self):
        w = Worker.objects.create(
            worker_key='other-worker',
            name='other-worker',
        )

        t = Task.objects.create(
            worker=w,
            arch=self._arch,
            channel=self._channel,
            owner=self._user,
            state=TASK_STATES['OPEN'],
        )

        req = _make_request(self._worker)

        with self.assertRaises(Task.DoesNotExist):
            worker.fail_task(req, t.id, '')

        t = Task.objects.get(id=t.id)
        self.assertEqual(t.state, TASK_STATES['OPEN'])
コード例 #5
0
 def fail_task(self, task_id, task_result):
     return worker.fail_task(self._request, task_id, task_result)
コード例 #6
0
 def test_fail_task(self):
     with self.assertRaises(PermissionDenied):
         worker.fail_task(_make_request(None, False), 1, None)
コード例 #7
0
 def test_fail_task(self):
     with self.assertRaises(PermissionDenied):
         worker.fail_task(_make_request(None, False), 1, None)