Commit d0fc75da authored by Samuel GAIST's avatar Samuel GAIST

[test][bcp] Build docker images cache at the start of the test

parent f3ddf4ee
......@@ -46,6 +46,7 @@ from ..bcp import broker
from ..database import Database
from ..utils import find_free_port
from ..dock import Host
from . import prefix, tmp_prefix
from . import VERBOSE_BCP_LOGGING
......@@ -131,12 +132,15 @@ class ZMQBrokerProcess(multiprocessing.Process):
class ZMQWorkerProcess(multiprocessing.Process):
def __init__(self, address, name, verbose, use_docker=False):
def __init__(
self, address, name, verbose, use_docker=False, docker_images_cache=None
):
super(ZMQWorkerProcess, self).__init__()
self.broker_address = address
self.service_name = name
self.verbose = verbose
self.use_docker = use_docker
self.docker_images_cache = None
def run(self):
return worker.run(
......@@ -146,6 +150,7 @@ class ZMQWorkerProcess(multiprocessing.Process):
prefix=prefix,
cache=tmp_prefix,
use_docker=self.use_docker,
docker_images_cache=self.docker_images_cache,
)
......@@ -202,6 +207,7 @@ class TestBroker(unittest.TestCase):
class TestBCP(ExcecutionTestCase):
use_docker = False
docker_images_cache = None
def setUp(self):
self.worker_name = b"test_worker"
......@@ -213,7 +219,11 @@ class TestBCP(ExcecutionTestCase):
self.broker_p.start()
self.worker = ZMQWorkerProcess(
broker_address, self.worker_name, VERBOSE_BCP_LOGGING, self.use_docker
broker_address,
self.worker_name,
VERBOSE_BCP_LOGGING,
self.use_docker,
self.docker_images_cache,
)
self.worker.start()
......@@ -296,6 +306,11 @@ class TestBCP(ExcecutionTestCase):
class TestBCPDocker(TestBCP):
use_docker = True
@classmethod
def setUpClass(cls):
cls.images_cache = os.path.join(tmp_prefix, "docker_images_cache.json")
cls.host = Host(images_cache=cls.docker_images_cache, raise_on_errors=False)
class TestExcecutionProcess(ExcecutionTestCase):
address = "ipc://execution_feed"
......
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