Commit befb6184 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[test][databases] Use random port for tests

parent 02faac7f
......@@ -49,6 +49,7 @@ from beat.backend.python.data import RemoteDataSource
from beat.backend.python.data import RemoteException
from ..dock import Host
from ..utils import find_free_port
from . import prefix
from . import tmp_prefix
......@@ -149,10 +150,11 @@ class TestDatabasesProvider(unittest.TestCase):
view = database.view(input_cfg['protocol'], input_cfg['set'])
view.index(os.path.join(self.cache_root, input_cfg['path']))
port = find_free_port()
cmd = [
'databases_provider',
'--debug',
'0.0.0.0:51000',
'0.0.0.0:%i' % port,
'/beat/prefix',
'/beat/cache',
]
......@@ -165,13 +167,13 @@ class TestDatabasesProvider(unittest.TestCase):
self.databases_container.add_volume('/tmp', os.path.join('/beat/datasets', input_cfg['database']))
self.databases_container.add_volume(self.cache_root, '/beat/cache')
self.databases_container.add_port(51000, 51000, host_address=self.host.ip)
self.databases_container.add_port(port, port, host_address=self.host.ip)
self.host.start(self.databases_container)
self.client_context = zmq.Context()
self.client_socket = self.client_context.socket(zmq.PAIR)
self.client_socket.connect('tcp://' + self.host.ip + ':51000')
self.client_socket.connect('tcp://{}:{}'.format(self.host.ip, port))
dataformat_name = database.set(input_cfg['protocol'], input_cfg['set'])['outputs'][input_cfg['output']]
......
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