Commit bfa0be18 authored by André Anjos's avatar André Anjos 💬
Browse files

Fix dockerized tests

parent 87ffa07b
......@@ -29,6 +29,7 @@
# Tests for experiment execution within Docker containers
from ..dock import Host
from ..utils import cleanup
from ..execution import DockerExecutor
from .test_execution import BaseExecutionMixIn
......
......@@ -51,83 +51,6 @@ class TestOneWorkerDocker(TestOneWorker):
#----------------------------------------------------------
class TestTwoWorkers(TestWorkerBase):
def setUp(self):
self.tearDown() # In case another test failed badly during its setUp()
super(TestTwoWorkers, self).setUp()
self.start_controller()
self.start_worker(WORKER1)
self.start_worker(WORKER2)
self.wait_for_worker_connection(WORKER1)
self.wait_for_worker_connection(WORKER2)
def _test_success_one_worker(self, worker_name):
self.controller.execute(worker_name, 1, CONFIGURATION1)
message = None
while message is None:
message = self.controller.process(100)
(worker, status, job_id, data) = message
self.assertEqual(worker, worker_name)
self.assertEqual(status, WorkerController.DONE)
self.assertEqual(job_id, 1)
result = simplejson.loads(data[0])
self.assertEqual(result['status'], 0)
def test_success_worker1(self):
self._test_success_one_worker(WORKER1)
def test_success_worker2(self):
self._test_success_one_worker(WORKER2)
def test_success_both_workers(self):
def _check(worker, status, job_id, data):
self.assertEqual(status, WorkerController.DONE)
if worker == WORKER1:
self.assertEqual(job_id, 1)
else:
self.assertEqual(worker, WORKER2)
self.assertEqual(job_id, 2)
result = simplejson.loads(data[0])
self.assertEqual(result['status'], 0)
self.controller.execute(WORKER1, 1, CONFIGURATION1)
self.controller.execute(WORKER2, 2, CONFIGURATION2)
message = None
while message is None:
message = self.controller.process(100)
(worker1, status, job_id, data) = message
_check(worker1, status, job_id, data)
message = None
while message is None:
message = self.controller.process(100)
(worker2, status, job_id, data) = message
_check(worker2, status, job_id, data)
self.assertNotEqual(worker1, worker2)
#----------------------------------------------------------
class TestTwoWorkersDocker(TestTwoWorkers):
def __init__(self, methodName='runTest'):
......
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