提交 4bd6261d 编写于 作者: Y Yatsishin Ilya

Use prebuilt helper_container for integration tests

上级 abdd160d
......@@ -155,8 +155,6 @@ class _NetworkManager:
def __init__(
self,
image_name='clickhouse_tests_helper',
image_path=p.join(CLICKHOUSE_ROOT_DIR, 'docker', 'test', 'integration', 'helper_container'),
container_expire_timeout=50, container_exit_timeout=60):
self.container_expire_timeout = container_expire_timeout
......@@ -164,14 +162,6 @@ class _NetworkManager:
self._docker_client = docker.from_env(version=os.environ.get("DOCKER_API_VERSION"))
try:
self._image = self._docker_client.images.get(image_name)
except docker.errors.ImageNotFound:
# Use docker console client instead of python API to work around https://github.com/docker/docker-py/issues/1397
subprocess.check_call(
['docker', 'build', '--force-rm', '--tag', image_name, '--network', 'host', image_path])
self._image = self._docker_client.images.get(image_name)
self._container = None
self._ensure_container()
......@@ -185,15 +175,11 @@ class _NetworkManager:
except docker.errors.NotFound:
pass
# Work around https://github.com/docker/docker-py/issues/1477
host_config = self._docker_client.api.create_host_config(network_mode='host', auto_remove=True)
container_id = self._docker_client.api.create_container(
self._image.id, command=('sleep %s' % self.container_exit_timeout),
detach=True, host_config=host_config)['Id']
self._container = self._docker_client.containers.run('yandex/clickhouse-integration-helper', auto_remove=True,
command=('sleep %s' % self.container_exit_timeout),
detach=True, network_mode='host')
container_id = self._container.id
self._container_expire_time = time.time() + self.container_expire_timeout
self._docker_client.api.start(container_id)
self._container = self._docker_client.containers.get(container_id)
return self._container
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册