Commit a9640ebb authored by Samuel GAIST's avatar Samuel GAIST

[test][worker] Ensure correct handling of _wait output

Not all tests were checking for None which might happen
for reason outside of tests error.
parent ab6d850a
......@@ -443,7 +443,9 @@ class TestOneWorker(TestWorkerBase):
self.controller.execute(WORKER1, 1, config)
(worker, status, job_id, data) = self._wait()
message = self._wait()
self.assertTrue(message is not None)
(worker, status, job_id, data) = message
self.assertEqual(worker, WORKER1)
self.assertEqual(status, WorkerController.JOB_ERROR)
......@@ -461,7 +463,9 @@ class TestOneWorker(TestWorkerBase):
self.controller.execute(WORKER1, 1, config)
(worker, status, job_id, data) = self._wait()
message = self._wait()
self.assertTrue(message is not None)
(worker, status, job_id, data) = message
self.assertEqual(worker, WORKER1)
self.assertEqual(status, WorkerController.JOB_ERROR)
......@@ -475,7 +479,9 @@ class TestOneWorker(TestWorkerBase):
self.controller.execute(WORKER1, 1, config)
(worker, status, job_id, data) = self._wait()
message = self._wait()
self.assertTrue(message is not None)
(worker, status, job_id, data) = message
self.assertEqual(worker, WORKER1)
self.assertTrue(status in [WorkerController.ERROR, WorkerController.JOB_ERROR])
......@@ -514,7 +520,9 @@ class TestOneWorker(TestWorkerBase):
self.controller.execute(WORKER1, 1, config)
self.controller.cancel(WORKER1, 1)
(worker, status, job_id, data) = self._wait()
message = self._wait()
self.assertTrue(message is not None)
(worker, status, job_id, data) = message
self.assertEqual(worker, WORKER1)
self.assertEqual(status, WorkerController.CANCELLED)
......@@ -525,7 +533,9 @@ class TestOneWorker(TestWorkerBase):
def test_error_cancel_unknown_job(self):
self.controller.cancel(WORKER1, 1)
(worker, status, job_id, data) = self._wait()
message = self._wait()
self.assertTrue(message is not None)
(worker, status, job_id, data) = message
self.assertEqual(worker, WORKER1)
self.assertEqual(status, WorkerController.ERROR)
......@@ -557,6 +567,7 @@ class TestTwoWorkers(TestWorkerBase):
while message is None:
message = self.controller.process(100)
self.assertTrue(message is not None)
(worker, status, job_id, data) = message
self.assertEqual(worker, worker_name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment