Skip to content

Commit a0ce15b

Browse files
committed
Move integration tests docker files to docker/ directory. Rename image -> runner.
1 parent 1656910 commit a0ce15b

20 files changed

+57
-49
lines changed

docker/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## ClickHouse Dockerfiles
22

3-
This directory contain Dockerfiles for `clickhouse-client` and `clickhouse-server`. They updated each release.
3+
This directory contain Dockerfiles for `clickhouse-client` and `clickhouse-server`. They are updated in each release.
44

55
Also there is bunch of images for testing and CI. They are listed in `images.json` file and updated on each commit to master. If you need to add another image, place information about it into `images.json`.

docker/images.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
"docker/test/stress": "yandex/clickhouse-stress-test",
1616
"docker/test/split_build_smoke_test": "yandex/clickhouse-split-build-smoke-test",
1717
"docker/test/codebrowser": "yandex/clickhouse-codebrowser",
18-
"tests/integration/image": "yandex/clickhouse-integration-tests-runner"
18+
"docker/test/integration/runner": "yandex/clickhouse-integration-tests-runner"
1919
}

docker/test/integration/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Docker containers for integration tests
2+
- `base` container with required packages
3+
- `runner` container with that runs integration tests in docker
4+
- `compose` contains docker_compose YaML files that are used in tests
5+
6+
How to run integration tests is described in tests/integration/README.md
File renamed without changes.

tests/integration/image/Dockerfile docker/test/integration/runner/Dockerfile

+19-19
Original file line numberDiff line numberDiff line change
@@ -41,32 +41,32 @@ ENV DOCKER_CHANNEL stable
4141
ENV DOCKER_VERSION 17.09.1-ce
4242

4343
RUN set -eux; \
44-
\
44+
\
4545
# this "case" statement is generated via "update.sh"
46-
\
47-
if ! wget -O docker.tgz "https://download.docker.com/linux/static/${DOCKER_CHANNEL}/x86_64/docker-${DOCKER_VERSION}.tgz"; then \
48-
echo >&2 "error: failed to download 'docker-${DOCKER_VERSION}' from '${DOCKER_CHANNEL}' for '${x86_64}'"; \
49-
exit 1; \
50-
fi; \
51-
\
52-
tar --extract \
53-
--file docker.tgz \
54-
--strip-components 1 \
55-
--directory /usr/local/bin/ \
56-
; \
57-
rm docker.tgz; \
58-
\
59-
dockerd --version; \
60-
docker --version
46+
\
47+
if ! wget -O docker.tgz "https://download.docker.com/linux/static/${DOCKER_CHANNEL}/x86_64/docker-${DOCKER_VERSION}.tgz"; then \
48+
echo >&2 "error: failed to download 'docker-${DOCKER_VERSION}' from '${DOCKER_CHANNEL}' for '${x86_64}'"; \
49+
exit 1; \
50+
fi; \
51+
\
52+
tar --extract \
53+
--file docker.tgz \
54+
--strip-components 1 \
55+
--directory /usr/local/bin/ \
56+
; \
57+
rm docker.tgz; \
58+
\
59+
dockerd --version; \
60+
docker --version
6161

6262
COPY modprobe.sh /usr/local/bin/modprobe
6363
COPY dockerd-entrypoint.sh /usr/local/bin/
6464

6565
RUN set -x \
66-
&& addgroup --system dockremap \
66+
&& addgroup --system dockremap \
6767
&& adduser --system dockremap \
68-
&& adduser dockremap dockremap \
69-
&& echo 'dockremap:165536:65536' >> /etc/subuid \
68+
&& adduser dockremap dockremap \
69+
&& echo 'dockremap:165536:65536' >> /etc/subuid \
7070
&& echo 'dockremap:165536:65536' >> /etc/subgid
7171

7272
VOLUME /var/lib/docker

tests/integration/image/modprobe.sh docker/test/integration/runner/modprobe.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ set -eu
99
# Docker often uses "modprobe -va foo bar baz"
1010
# so we ignore modules that start with "-"
1111
for module; do
12-
if [ "${module#-}" = "$module" ]; then
13-
ip link show "$module" || true
14-
lsmod | grep "$module" || true
15-
fi
12+
if [ "${module#-}" = "$module" ]; then
13+
ip link show "$module" || true
14+
lsmod | grep "$module" || true
15+
fi
1616
done
1717

1818
# remove /usr/local/... from PATH so we can exec the real modprobe as a last resort

tests/integration/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ cd docker/test/integration
9494
docker build -t yandex/clickhouse-integration-test .
9595
```
9696

97-
The helper container used by the `runner` script is in `tests/integration/image/Dockerfile`.
97+
The helper container used by the `runner` script is in `docker/test/integration/runner/Dockerfile`.
9898

9999
### Adding new tests
100100

tests/integration/helpers/cluster.py

+23-21
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
from .hdfs_api import HDFSApi
2929

3030
HELPERS_DIR = p.dirname(__file__)
31+
CLICKHOUSE_ROOT_DIR = p.join(p.dirname(__file__), "../../..")
32+
DOCKER_COMPOSE_DIR = p.join(CLICKHOUSE_ROOT_DIR, "docker/test/integration/compose/")
3133
DEFAULT_ENV_NAME = 'env_file'
3234

3335
SANITIZER_SIGN = "=================="
@@ -174,14 +176,14 @@ def add_instance(self, name, config_dir=None, main_configs=None, user_configs=No
174176
self.instances[name] = instance
175177
if ipv4_address is not None or ipv6_address is not None:
176178
self.with_net_trics = True
177-
self.base_cmd.extend(['--file', p.join(HELPERS_DIR, 'docker_compose_net.yml')])
179+
self.base_cmd.extend(['--file', p.join(DOCKER_COMPOSE_DIR, 'docker_compose_net.yml')])
178180

179181
self.base_cmd.extend(['--file', instance.docker_compose_path])
180182

181183
cmds = []
182184
if with_zookeeper and not self.with_zookeeper:
183185
if not zookeeper_docker_compose_path:
184-
zookeeper_docker_compose_path = p.join(HELPERS_DIR, 'docker_compose_zookeeper.yml')
186+
zookeeper_docker_compose_path = p.join(DOCKER_COMPOSE_DIR, 'docker_compose_zookeeper.yml')
185187

186188
self.with_zookeeper = True
187189
self.base_cmd.extend(['--file', zookeeper_docker_compose_path])
@@ -191,72 +193,72 @@ def add_instance(self, name, config_dir=None, main_configs=None, user_configs=No
191193

192194
if with_mysql and not self.with_mysql:
193195
self.with_mysql = True
194-
self.base_cmd.extend(['--file', p.join(HELPERS_DIR, 'docker_compose_mysql.yml')])
196+
self.base_cmd.extend(['--file', p.join(DOCKER_COMPOSE_DIR, 'docker_compose_mysql.yml')])
195197
self.base_mysql_cmd = ['docker-compose', '--project-directory', self.base_dir, '--project-name',
196-
self.project_name, '--file', p.join(HELPERS_DIR, 'docker_compose_mysql.yml')]
198+
self.project_name, '--file', p.join(DOCKER_COMPOSE_DIR, 'docker_compose_mysql.yml')]
197199

198200
cmds.append(self.base_mysql_cmd)
199201

200202
if with_postgres and not self.with_postgres:
201203
self.with_postgres = True
202-
self.base_cmd.extend(['--file', p.join(HELPERS_DIR, 'docker_compose_postgres.yml')])
204+
self.base_cmd.extend(['--file', p.join(DOCKER_COMPOSE_DIR, 'docker_compose_postgres.yml')])
203205
self.base_postgres_cmd = ['docker-compose', '--project-directory', self.base_dir, '--project-name',
204-
self.project_name, '--file', p.join(HELPERS_DIR, 'docker_compose_postgres.yml')]
206+
self.project_name, '--file', p.join(DOCKER_COMPOSE_DIR, 'docker_compose_postgres.yml')]
205207
cmds.append(self.base_postgres_cmd)
206208

207209
if with_odbc_drivers and not self.with_odbc_drivers:
208210
self.with_odbc_drivers = True
209211
if not self.with_mysql:
210212
self.with_mysql = True
211-
self.base_cmd.extend(['--file', p.join(HELPERS_DIR, 'docker_compose_mysql.yml')])
213+
self.base_cmd.extend(['--file', p.join(DOCKER_COMPOSE_DIR, 'docker_compose_mysql.yml')])
212214
self.base_mysql_cmd = ['docker-compose', '--project-directory', self.base_dir, '--project-name',
213-
self.project_name, '--file', p.join(HELPERS_DIR, 'docker_compose_mysql.yml')]
215+
self.project_name, '--file', p.join(DOCKER_COMPOSE_DIR, 'docker_compose_mysql.yml')]
214216
cmds.append(self.base_mysql_cmd)
215217

216218
if not self.with_postgres:
217219
self.with_postgres = True
218-
self.base_cmd.extend(['--file', p.join(HELPERS_DIR, 'docker_compose_postgres.yml')])
220+
self.base_cmd.extend(['--file', p.join(DOCKER_COMPOSE_DIR, 'docker_compose_postgres.yml')])
219221
self.base_postgres_cmd = ['docker-compose', '--project-directory', self.base_dir, '--project-name',
220222
self.project_name, '--file',
221-
p.join(HELPERS_DIR, 'docker_compose_postgres.yml')]
223+
p.join(DOCKER_COMPOSE_DIR, 'docker_compose_postgres.yml')]
222224
cmds.append(self.base_postgres_cmd)
223225

224226
if with_kafka and not self.with_kafka:
225227
self.with_kafka = True
226-
self.base_cmd.extend(['--file', p.join(HELPERS_DIR, 'docker_compose_kafka.yml')])
228+
self.base_cmd.extend(['--file', p.join(DOCKER_COMPOSE_DIR, 'docker_compose_kafka.yml')])
227229
self.base_kafka_cmd = ['docker-compose', '--project-directory', self.base_dir, '--project-name',
228-
self.project_name, '--file', p.join(HELPERS_DIR, 'docker_compose_kafka.yml')]
230+
self.project_name, '--file', p.join(DOCKER_COMPOSE_DIR, 'docker_compose_kafka.yml')]
229231
cmds.append(self.base_kafka_cmd)
230232

231233
if with_hdfs and not self.with_hdfs:
232234
self.with_hdfs = True
233-
self.base_cmd.extend(['--file', p.join(HELPERS_DIR, 'docker_compose_hdfs.yml')])
235+
self.base_cmd.extend(['--file', p.join(DOCKER_COMPOSE_DIR, 'docker_compose_hdfs.yml')])
234236
self.base_hdfs_cmd = ['docker-compose', '--project-directory', self.base_dir, '--project-name',
235-
self.project_name, '--file', p.join(HELPERS_DIR, 'docker_compose_hdfs.yml')]
237+
self.project_name, '--file', p.join(DOCKER_COMPOSE_DIR, 'docker_compose_hdfs.yml')]
236238
cmds.append(self.base_hdfs_cmd)
237239

238240
if with_mongo and not self.with_mongo:
239241
self.with_mongo = True
240-
self.base_cmd.extend(['--file', p.join(HELPERS_DIR, 'docker_compose_mongo.yml')])
242+
self.base_cmd.extend(['--file', p.join(DOCKER_COMPOSE_DIR, 'docker_compose_mongo.yml')])
241243
self.base_mongo_cmd = ['docker-compose', '--project-directory', self.base_dir, '--project-name',
242-
self.project_name, '--file', p.join(HELPERS_DIR, 'docker_compose_mongo.yml')]
244+
self.project_name, '--file', p.join(DOCKER_COMPOSE_DIR, 'docker_compose_mongo.yml')]
243245
cmds.append(self.base_mongo_cmd)
244246

245247
if self.with_net_trics:
246248
for cmd in cmds:
247-
cmd.extend(['--file', p.join(HELPERS_DIR, 'docker_compose_net.yml')])
249+
cmd.extend(['--file', p.join(DOCKER_COMPOSE_DIR, 'docker_compose_net.yml')])
248250

249251
if with_redis and not self.with_redis:
250252
self.with_redis = True
251-
self.base_cmd.extend(['--file', p.join(HELPERS_DIR, 'docker_compose_redis.yml')])
253+
self.base_cmd.extend(['--file', p.join(DOCKER_COMPOSE_DIR, 'docker_compose_redis.yml')])
252254
self.base_redis_cmd = ['docker-compose', '--project-directory', self.base_dir, '--project-name',
253-
self.project_name, '--file', p.join(HELPERS_DIR, 'docker_compose_redis.yml')]
255+
self.project_name, '--file', p.join(DOCKER_COMPOSE_DIR, 'docker_compose_redis.yml')]
254256

255257
if with_minio and not self.with_minio:
256258
self.with_minio = True
257-
self.base_cmd.extend(['--file', p.join(HELPERS_DIR, 'docker_compose_minio.yml')])
259+
self.base_cmd.extend(['--file', p.join(DOCKER_COMPOSE_DIR, 'docker_compose_minio.yml')])
258260
self.base_minio_cmd = ['docker-compose', '--project-directory', self.base_dir, '--project-name',
259-
self.project_name, '--file', p.join(HELPERS_DIR, 'docker_compose_minio.yml')]
261+
self.project_name, '--file', p.join(DOCKER_COMPOSE_DIR, 'docker_compose_minio.yml')]
260262
cmds.append(self.base_minio_cmd)
261263

262264
return instance

tests/integration/helpers/network.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import docker
77

8-
from .cluster import HELPERS_DIR
8+
from .cluster import CLICKHOUSE_ROOT_DIR
99

1010

1111
class PartitionManager:
@@ -156,7 +156,7 @@ def _iptables_cmd_suffix(
156156
def __init__(
157157
self,
158158
image_name='clickhouse_tests_helper',
159-
image_path=p.join(HELPERS_DIR, 'helper_container'),
159+
image_path=p.join(CLICKHOUSE_ROOT_DIR, 'docker', 'test', 'integration', 'helper_container'),
160160
container_expire_timeout=50, container_exit_timeout=60):
161161

162162
self.container_expire_timeout = container_expire_timeout

0 commit comments

Comments
 (0)